[PATCH] D93377: [Clang] Add __ibm128 type to represent ppc_fp128

2021-09-01 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Okay, thanks.  LGTM, then.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93377/new/

https://reviews.llvm.org/D93377

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109126: [PowerPC] [NFC] Add Big-Endian checks for existing MMA tests

2021-09-01 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf added inline comments.



Comment at: clang/test/CodeGen/builtins-ppc-pair-mma.c:5
+// RUN: %clang_cc1 -O3 -triple powerpc64-unknown-unknown -target-cpu pwr10 \
+// RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-BE
 

Seems just adding `%clang_cc1 -O3 -triple powerpc64-unknown-unknown -target-cpu 
pwr10 -emit-llvm %s -o - | FileCheck %s` also makes the test pass. `CHECK` and 
`CHECK-BE` contents are the same.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109126/new/

https://reviews.llvm.org/D109126

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-01 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 370155.
keith added a comment.

Some of the other checks were invalid given the current tests, these seem to be 
enough to solve this issue without breaking existing tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109128/new/

https://reviews.llvm.org/D109128

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/lib/Support/VirtualFileSystem.cpp


Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -2013,7 +2013,7 @@
   ErrorOr Result = lookupPath(Path);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
-  return ExternalFS->openFileForRead(Path);
+  return ExternalFS->openFileForRead(Path_);
 return Result.getError();
   }
 
@@ -2026,7 +2026,7 @@
   auto ExternalFile = ExternalFS->openFileForRead(ExtRedirect);
   if (!ExternalFile) {
 if (shouldFallBackToExternalFS(ExternalFile.getError(), Result->E))
-  return ExternalFS->openFileForRead(Path);
+  return ExternalFS->openFileForRead(Path_);
 return ExternalFile;
   }
 
Index: clang/test/VFS/relative-path-errors.c
===
--- /dev/null
+++ clang/test/VFS/relative-path-errors.c
@@ -0,0 +1,8 @@
+// RUN: mkdir -p %t
+// RUN: cd %t
+// RUN: echo '{"roots": [],"version": 0}' > %t.yaml
+// RUN: cp %s main.c
+// RUN: not %clang_cc1 -ivfsoverlay %t.yaml main.c 2>&1 | FileCheck %s
+
+// CHECK: {{^}}main.c:8:1: error:
+foobarbaz


Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -2013,7 +2013,7 @@
   ErrorOr Result = lookupPath(Path);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
-  return ExternalFS->openFileForRead(Path);
+  return ExternalFS->openFileForRead(Path_);
 return Result.getError();
   }
 
@@ -2026,7 +2026,7 @@
   auto ExternalFile = ExternalFS->openFileForRead(ExtRedirect);
   if (!ExternalFile) {
 if (shouldFallBackToExternalFS(ExternalFile.getError(), Result->E))
-  return ExternalFS->openFileForRead(Path);
+  return ExternalFS->openFileForRead(Path_);
 return ExternalFile;
   }
 
Index: clang/test/VFS/relative-path-errors.c
===
--- /dev/null
+++ clang/test/VFS/relative-path-errors.c
@@ -0,0 +1,8 @@
+// RUN: mkdir -p %t
+// RUN: cd %t
+// RUN: echo '{"roots": [],"version": 0}' > %t.yaml
+// RUN: cp %s main.c
+// RUN: not %clang_cc1 -ivfsoverlay %t.yaml main.c 2>&1 | FileCheck %s
+
+// CHECK: {{^}}main.c:8:1: error:
+foobarbaz
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-01 Thread Keith Smiley via Phabricator via cfe-commits
keith created this revision.
keith added a reviewer: JDevlieghere.
Herald added subscribers: dexonsmith, hiraditya.
keith requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This is a follow up to 0be9ca7c0f9a733f846bb6bc4e8e36d46b518162 
 to make
paths in the case of falling back to the external file system use the
original format, preserving relative paths, and allow the external
filesystem to canonicalize them if needed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109128

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/lib/Support/VirtualFileSystem.cpp


Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -1202,7 +1202,7 @@
   if (!Result) {
 EC = Result.getError();
 if (shouldFallBackToExternalFS(EC))
-  return ExternalFS->dir_begin(Path, EC);
+  return ExternalFS->dir_begin(Dir, EC);
 return {};
   }
 
@@ -1967,13 +1967,13 @@
   ErrorOr Result = lookupPath(Path);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
-  return ExternalFS->status(Path);
+  return ExternalFS->status(Path_);
 return Result.getError();
   }
 
   ErrorOr S = status(Path, *Result);
   if (!S && shouldFallBackToExternalFS(S.getError(), Result->E))
-S = ExternalFS->status(Path);
+S = ExternalFS->status(Path_);
   return S;
 }
 
@@ -2013,7 +2013,7 @@
   ErrorOr Result = lookupPath(Path);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
-  return ExternalFS->openFileForRead(Path);
+  return ExternalFS->openFileForRead(Path_);
 return Result.getError();
   }
 
@@ -2026,7 +2026,7 @@
   auto ExternalFile = ExternalFS->openFileForRead(ExtRedirect);
   if (!ExternalFile) {
 if (shouldFallBackToExternalFS(ExternalFile.getError(), Result->E))
-  return ExternalFS->openFileForRead(Path);
+  return ExternalFS->openFileForRead(Path_);
 return ExternalFile;
   }
 
@@ -2053,7 +2053,7 @@
   ErrorOr Result = lookupPath(Path);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
-  return ExternalFS->getRealPath(Path, Output);
+  return ExternalFS->getRealPath(Path_, Output);
 return Result.getError();
   }
 
@@ -2062,14 +2062,14 @@
   if (auto ExtRedirect = Result->getExternalRedirect()) {
 auto P = ExternalFS->getRealPath(*ExtRedirect, Output);
 if (!P && shouldFallBackToExternalFS(P, Result->E)) {
-  return ExternalFS->getRealPath(Path, Output);
+  return ExternalFS->getRealPath(Path_, Output);
 }
 return P;
   }
 
   // If we found a DirectoryEntry, still fall back to ExternalFS if allowed,
   // because directories don't have a single external contents path.
-  return shouldUseExternalFS() ? ExternalFS->getRealPath(Path, Output)
+  return shouldUseExternalFS() ? ExternalFS->getRealPath(Path_, Output)
: llvm::errc::invalid_argument;
 }
 
Index: clang/test/VFS/relative-path-errors.c
===
--- /dev/null
+++ clang/test/VFS/relative-path-errors.c
@@ -0,0 +1,8 @@
+// RUN: mkdir -p %t
+// RUN: cd %t
+// RUN: echo '{"roots": [],"version": 0}' > %t.yaml
+// RUN: cp %s main.c
+// RUN: not %clang_cc1 -ivfsoverlay %t.yaml main.c 2>&1 | FileCheck %s
+
+// CHECK: {{^}}main.c:8:1: error:
+foobarbaz


Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -1202,7 +1202,7 @@
   if (!Result) {
 EC = Result.getError();
 if (shouldFallBackToExternalFS(EC))
-  return ExternalFS->dir_begin(Path, EC);
+  return ExternalFS->dir_begin(Dir, EC);
 return {};
   }
 
@@ -1967,13 +1967,13 @@
   ErrorOr Result = lookupPath(Path);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
-  return ExternalFS->status(Path);
+  return ExternalFS->status(Path_);
 return Result.getError();
   }
 
   ErrorOr S = status(Path, *Result);
   if (!S && shouldFallBackToExternalFS(S.getError(), Result->E))
-S = ExternalFS->status(Path);
+S = ExternalFS->status(Path_);
   return S;
 }
 
@@ -2013,7 +2013,7 @@
   ErrorOr Result = lookupPath(Path);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
-  return ExternalFS->openFileForRead(Path);
+  return ExternalFS->openFileForRead(Path_);
 return Result.getError();
   }
 
@@ -2026,7 +2026,7 @@
   auto ExternalFile = ExternalFS->openFileForRead(ExtRedirect);
   if (!ExternalFile) {
 if (shouldFallBackToExternalFS(ExternalFile.getError(), Result->E))
-  return ExternalFS->openFileForRead(Path);
+  return 

[PATCH] D108756: [clang] Add '-ast-dump-filter=' support

2021-09-01 Thread Tommy Chiang via Phabricator via cfe-commits
oToToT added a comment.

ping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108756/new/

https://reviews.llvm.org/D108756

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109127: Use python 3 in add_new_check.py and rename_check.py

2021-09-01 Thread Matt Beardsley via Phabricator via cfe-commits
mattbeardsley created this revision.
mattbeardsley added a reviewer: kbobyrev.
mattbeardsley requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

As of this commit:

  https://github.com/llvm/llvm-project/commit/307b1fdd

If either of those scripts are invoked with python 2, neither works due to:

  "TypeError: write() argument 1 must be unicode, not str"

Figured I'd send a quick review for the easier fix of "just use python 3", given
that these scripts already don't work with python 2.

Let me know if these are indeed expected/required to continue working with
python 2 though, and I'll look into fixing the "f.write" calls instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109127

Files:
  clang-tools-extra/clang-tidy/add_new_check.py
  clang-tools-extra/clang-tidy/rename_check.py


Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 #===- rename_check.py - clang-tidy check renamer *- python -*--===#
 #
@@ -13,6 +13,9 @@
 import io
 import os
 import re
+import sys
+
+assert sys.version_info >= (3,), "Requires python 3"
 
 def replaceInFileRegex(fileName, sFrom, sTo):
   if sFrom == sTo:
Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 #===- add_new_check.py - clang-tidy check generator -*- python -*--===#
 #
@@ -16,6 +16,8 @@
 import re
 import sys
 
+assert sys.version_info >= (3,), "Requires python 3"
+
 # Adapts the module's CMakelist file. Returns 'True' if it could add a new
 # entry and 'False' if the entry already existed.
 def adapt_cmake(module_path, check_name_camel):


Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 #===- rename_check.py - clang-tidy check renamer *- python -*--===#
 #
@@ -13,6 +13,9 @@
 import io
 import os
 import re
+import sys
+
+assert sys.version_info >= (3,), "Requires python 3"
 
 def replaceInFileRegex(fileName, sFrom, sTo):
   if sFrom == sTo:
Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 #===- add_new_check.py - clang-tidy check generator -*- python -*--===#
 #
@@ -16,6 +16,8 @@
 import re
 import sys
 
+assert sys.version_info >= (3,), "Requires python 3"
+
 # Adapts the module's CMakelist file. Returns 'True' if it could add a new
 # entry and 'False' if the entry already existed.
 def adapt_cmake(module_path, check_name_camel):
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109126: [PowerPC] [NFC] Add Big-Endian checks for existing MMA tests

2021-09-01 Thread Ahsan Saghir via Phabricator via cfe-commits
saghir created this revision.
Herald added subscribers: shchenz, kbarton, nemanjai.
saghir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch adds Big-Endian checks for the existing MMA test cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109126

Files:
  clang/test/CodeGen/builtins-ppc-pair-mma.c
  clang/test/Sema/ppc-pair-mma-types.c
  clang/test/SemaCXX/ppc-pair-mma-types.cpp

Index: clang/test/SemaCXX/ppc-pair-mma-types.cpp
===
--- clang/test/SemaCXX/ppc-pair-mma-types.cpp
+++ clang/test/SemaCXX/ppc-pair-mma-types.cpp
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -fsyntax-only \
-// RUN:   -fcxx-exceptions -target-cpu future %s -verify
+// RUN:   -fcxx-exceptions -target-cpu pwr10 %s -verify
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -fsyntax-only \
+// RUN:   -fcxx-exceptions -target-cpu pwr10 %s -verify
 
 // vector quad
 
Index: clang/test/Sema/ppc-pair-mma-types.c
===
--- clang/test/Sema/ppc-pair-mma-types.c
+++ clang/test/Sema/ppc-pair-mma-types.c
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -fsyntax-only \
-// RUN:   -target-cpu future %s -verify
+// RUN:   -target-cpu pwr10 %s -verify
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -fsyntax-only \
+// RUN:   -target-cpu pwr10 %s -verify
 
 // The use of PPC MMA types is strongly restricted. Non-pointer MMA variables
 // can only be declared in functions and a limited number of operations are
Index: clang/test/CodeGen/builtins-ppc-pair-mma.c
===
--- clang/test/CodeGen/builtins-ppc-pair-mma.c
+++ clang/test/CodeGen/builtins-ppc-pair-mma.c
@@ -1,5 +1,8 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 -O3 -triple powerpc64le-unknown-unknown -target-cpu future -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -O3 -triple powerpc64le-unknown-unknown -target-cpu pwr10 \
+// RUN: -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -O3 -triple powerpc64-unknown-unknown -target-cpu pwr10 \
+// RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-BE
 
 // CHECK-LABEL: @test1(
 // CHECK-NEXT:  entry:
@@ -8,6 +11,13 @@
 // CHECK-NEXT:store <512 x i1> [[TMP0]], <512 x i1>* [[TMP1]], align 64, !tbaa [[TBAA2:![0-9]+]]
 // CHECK-NEXT:ret void
 //
+// CHECK-BE-LABEL: @test1(
+// CHECK-BE-NEXT:  entry:
+// CHECK-BE-NEXT:[[TMP0:%.*]] = tail call <512 x i1> @llvm.ppc.mma.assemble.acc(<16 x i8> [[VC:%.*]], <16 x i8> [[VC]], <16 x i8> [[VC]], <16 x i8> [[VC]])
+// CHECK-BE-NEXT:[[TMP1:%.*]] = bitcast i8* [[RESP:%.*]] to <512 x i1>*
+// CHECK-BE-NEXT:store <512 x i1> [[TMP0]], <512 x i1>* [[TMP1]], align 64, !tbaa [[TBAA2:![0-9]+]]
+// CHECK-BE-NEXT:ret void
+//
 void test1(unsigned char *vqp, unsigned char *vpp, vector unsigned char vc, unsigned char *resp) {
   __vector_quad vq = *((__vector_quad *)vqp);
   __vector_pair vp = *((__vector_pair *)vpp);
@@ -38,6 +48,28 @@
 // CHECK-NEXT:store <16 x i8> [[TMP11]], <16 x i8>* [[TMP13]], align 16
 // CHECK-NEXT:ret void
 //
+// CHECK-BE-LABEL: @test2(
+// CHECK-BE-NEXT:  entry:
+// CHECK-BE-NEXT:[[TMP0:%.*]] = bitcast i8* [[VQP:%.*]] to <512 x i1>*
+// CHECK-BE-NEXT:[[TMP1:%.*]] = load <512 x i1>, <512 x i1>* [[TMP0]], align 64
+// CHECK-BE-NEXT:[[TMP2:%.*]] = tail call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.ppc.mma.disassemble.acc(<512 x i1> [[TMP1]])
+// CHECK-BE-NEXT:[[TMP3:%.*]] = bitcast i8* [[RESP:%.*]] to <16 x i8>*
+// CHECK-BE-NEXT:[[TMP4:%.*]] = extractvalue { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } [[TMP2]], 0
+// CHECK-BE-NEXT:store <16 x i8> [[TMP4]], <16 x i8>* [[TMP3]], align 16
+// CHECK-BE-NEXT:[[TMP5:%.*]] = extractvalue { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } [[TMP2]], 1
+// CHECK-BE-NEXT:[[TMP6:%.*]] = getelementptr inbounds i8, i8* [[RESP]], i64 16
+// CHECK-BE-NEXT:[[TMP7:%.*]] = bitcast i8* [[TMP6]] to <16 x i8>*
+// CHECK-BE-NEXT:store <16 x i8> [[TMP5]], <16 x i8>* [[TMP7]], align 16
+// CHECK-BE-NEXT:[[TMP8:%.*]] = extractvalue { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } [[TMP2]], 2
+// CHECK-BE-NEXT:[[TMP9:%.*]] = getelementptr inbounds i8, i8* [[RESP]], i64 32
+// CHECK-BE-NEXT:[[TMP10:%.*]] = bitcast i8* [[TMP9]] to <16 x i8>*
+// CHECK-BE-NEXT:store <16 x i8> [[TMP8]], <16 x i8>* [[TMP10]], align 16
+// CHECK-BE-NEXT:[[TMP11:%.*]] = extractvalue { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } [[TMP2]], 3
+// CHECK-BE-NEXT:[[TMP12:%.*]] = getelementptr inbounds i8, i8* [[RESP]], i64 48
+// CHECK-BE-NEXT:[[TMP13:%.*]] = bitcast i8* [[TMP12]] to <16 x i8>*
+// CHECK-BE-NEXT:store <16 x i8> [[TMP11]], <16 x i8>* [[TMP13]], align 16
+// CHECK-BE-NEXT:

[PATCH] D104344: [modules] Track how headers are included by different submodules.

2021-09-01 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai planned changes to this revision.
vsapsai added a comment.

Investigate less heavy-weight approaches similar to those used for tracking 
macros from different submodules.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104344/new/

https://reviews.llvm.org/D104344

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104344: [modules] Track how headers are included by different submodules.

2021-09-01 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

That's a good point. Let me check how we track macros, I haven't thought about 
that approach. And I haven't considered using `Preprocessor::SubmoduleState`, 
was too excited `HeaderSearch::ShouldEnterIncludeFile` works correctly with the 
updated data.




Comment at: clang/include/clang/Lex/HeaderSearch.h:126
+  /// Bool represents if the header was included (false) or imported (true).
+  llvm::DenseMap ModuleIncludersMap;
+

rsmith wrote:
> This seems like a very expensive thing to include in `HeaderFileInfo`, which 
> we may have many thousands of in some compilations. (I have similar concerns 
> about `Aliases` FWIW.)
My fault. The fact that the struct is tightly packed, should have been a hint.



Comment at: clang/include/clang/Serialization/ASTBitCodes.h:44
 /// AST files at this time.
-const unsigned VERSION_MAJOR = 15;
+const unsigned VERSION_MAJOR = 16;
 

rsmith wrote:
> Do we really need to bump the version number? (Does this affect something we 
> read before we read the Clang version number and reject on a version 
> mismatch?)
Nope, there is no logic for VERSION_MAJOR. Just wanted to avoid old clang 
writing HeaderFileInfoTrait in one format and new clang reading it in the new 
format. But if that is resolved by Clang version number, no need for 
VERSION_MAJOR bump.



Comment at: clang/lib/Serialization/ASTReader.cpp:1912-1916
+// Update isImport and NumIncludes based on including module.
+if (Mod->NameVisibility == Module::NameVisibilityKind::AllVisible) {
+  HFI.isImport |= IsImport;
+  ++HFI.NumIncludes;
+}

rsmith wrote:
> This doesn't do the right thing in local submodule visibility mode. We need 
> to compute visibility locally from within `HeaderSearch` based on the 
> currently visible modules at the point of the query instead.
Is it wrong from general local submodule visibility approach or do you have a 
test case in mind? Don't need a specific case, general direction can help to 
come up with a test case.

In practice it was working because we were reading this part of PCM file only 
when HeaderFileInfo was requested and that was at the point when modules had 
correct visibility. Let me try with multiple unmodularized headers, that can be 
broken and it can be a good test case on its own.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104344/new/

https://reviews.llvm.org/D104344

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106343: [OpenCL] Support cl_ext_float_atomics

2021-09-01 Thread Yang Haonan via Phabricator via cfe-commits
haonanya added a comment.



In D106343#2967089 , @haonanya wrote:

> Hi, svenvh.
> Should we use cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics to 
> guard  the functions using atomic_double type?
> Thanks very much.
>
>   #if defined(__opencl_c_ext_fp64_local_atomic_min_max)
>   double __ovld atomic_fetch_min(volatile __local atomic_double *object,
>  double operand);
>   #endif

Hi, svenvh and Anastasia. Do you have any comments for adding 
cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics to guard 
atomic_double type?  I'd appreciate it if you have time to answer it.
And if there is no any comment, please commit the patch.
Thanks very much.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106343/new/

https://reviews.llvm.org/D106343

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108696: [Coroutines] [Frontend] Lookup in std namespace first

2021-09-01 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu added a comment.

@rjmccall @lxfind @junparser hi, do you feel comfortable with this?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108696/new/

https://reviews.llvm.org/D108696

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6eda66b - PR50294: Fix a performance regression from 2c9dbcd.

2021-09-01 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2021-09-01T18:00:07-07:00
New Revision: 6eda66b0a9f793c65852aa94430ae9bd891bcf63

URL: 
https://github.com/llvm/llvm-project/commit/6eda66b0a9f793c65852aa94430ae9bd891bcf63
DIFF: 
https://github.com/llvm/llvm-project/commit/6eda66b0a9f793c65852aa94430ae9bd891bcf63.diff

LOG: PR50294: Fix a performance regression from 2c9dbcd.

Per the contract of ReadLateParsedTemplates, we should not be returning
the same results multiple times. No functionality change intended, other
than to runtime.

Thanks to Luboš Luňák for identifying the cause of the regression!

Added: 


Modified: 
clang/lib/Serialization/ASTReader.cpp

Removed: 




diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 128350ce9ff8f..dfa7d55af735d 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -8412,6 +8412,8 @@ void ASTReader::ReadLateParsedTemplates(
   LPTMap.insert(std::make_pair(FD, std::move(LT)));
 }
   }
+
+  LateParsedTemplates.clear();
 }
 
 void ASTReader::LoadSelector(Selector Sel) {



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

In order to tackle the issues, I think we can do it this way: put the clang 
default lib ahead of `LIBRARY_PATH`. This can make sure `clang` always uses the 
bitcode library that comes with it, and if it is not there, it also has the 
ability to find a potential one from `LIBRARY_PATH`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107882: BPF: Enable frontend constant folding for VLA size

2021-09-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

I checked EmitAutoVarAlloca(). It emits the llvm.stacksave() due to

  // If the type is variably-modified, emit all the VLA sizes for it.
  if (Ty->isVariablyModifiedType())
EmitVariablyModifiedType(Ty);

Here, in order not to generate llvm.stacksave(), we need to evaluate the array 
size expression for `Ty`.
But it is probably not a good idea to re-evaluate `Ty` during code generation 
phase. If we really want to evaluate, we should evaluate earlier during 
semantic analysis phase like this patch.

Another solution is to implement pruning llvm.stacksave/stackrestore in 
backend. Currently InstCombine phase tries to remove some adjacent stacksave() 
and stackrestore() instrinsics. We could try to enhance InstCombine to handle 
more complicated cases, or considering this may be just a BPF use case (which 
doesn't support dynamic memory allocation), we can implement a bpf backend IR 
phase to remove it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107882/new/

https://reviews.llvm.org/D107882

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109105: [clang-cl] Emit nicer warning on unknown /arch: arguments

2021-09-01 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 370128.
thakis added a comment.

clang-format


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109105/new/

https://reviews.llvm.org/D109105

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/ToolChains/AVR.cpp
  clang/lib/Driver/ToolChains/Arch/Mips.cpp
  clang/lib/Driver/ToolChains/Arch/Mips.h
  clang/lib/Driver/ToolChains/Arch/X86.cpp
  clang/lib/Driver/ToolChains/Arch/X86.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/lib/Driver/ToolChains/OpenBSD.cpp
  clang/test/Driver/cl-x86-flags.c
  llvm/include/llvm/ADT/StringMap.h

Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -126,9 +126,7 @@
 
   StringMap(std::initializer_list> List)
   : StringMapImpl(List.size(), static_cast(sizeof(MapEntryTy))) {
-for (const auto  : List) {
-  insert(P);
-}
+insert(List);
   }
 
   StringMap(StringMap &)
@@ -297,6 +295,21 @@
 return try_emplace(KV.first, std::move(KV.second));
   }
 
+  /// Inserts elements from range [first, last). If multiple elements in the
+  /// range have keys that compare equivalent, it is unspecified which element
+  /// is inserted .
+  template  void insert(InputIt First, InputIt Last) {
+for (InputIt It = First; It != Last; ++It)
+  insert(*It);
+  }
+
+  ///  Inserts elements from initializer list ilist. If multiple elements in
+  /// the range have keys that compare equivalent, it is unspecified which
+  /// element is inserted
+  void insert(std::initializer_list> List) {
+insert(List.begin(), List.end());
+  }
+
   /// Inserts an element or assigns to the current element if the key already
   /// exists. The return type is the same as try_emplace.
   template 
Index: clang/test/Driver/cl-x86-flags.c
===
--- clang/test/Driver/cl-x86-flags.c
+++ clang/test/Driver/cl-x86-flags.c
@@ -6,7 +6,8 @@
 // flag space.
 // RUN: %clang_cl /Zs /WX -m32 -m64 -msse3 -msse4.1 -mavx -mno-avx \
 // RUN: --target=i386-pc-win32 -### -- 2>&1 %s | FileCheck -check-prefix=MFLAGS %s
-// MFLAGS-NOT: argument unused during compilation
+// MFLAGS-NOT: invalid /arch: argument
+//
 
 // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_IA32 -- %s
 #if defined(TEST_32_ARCH_IA32)
@@ -17,10 +18,10 @@
 
 // arch: args are case-sensitive.
 // RUN: %clang_cl -m32 -arch:ia32 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=ia32 %s
-// ia32: argument unused during compilation
+// ia32: invalid /arch: argument 'ia32'; for 32-bit expected one of AVX, AVX2, AVX512, AVX512F, IA32, SSE, SSE2
 
 // RUN: %clang_cl -m64 -arch:IA32 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=IA3264 %s
-// IA3264: argument unused during compilation
+// IA3264: invalid /arch: argument 'IA32'; for 64-bit expected one of AVX, AVX2, AVX512, AVX512F
 
 // RUN: %clang_cl -m32 -arch:SSE --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_SSE -- %s
 #if defined(TEST_32_ARCH_SSE)
@@ -30,7 +31,7 @@
 #endif
 
 // RUN: %clang_cl -m32 -arch:sse --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=sse %s
-// sse: argument unused during compilation
+// sse: invalid /arch: argument
 
 // RUN: %clang_cl -m32 -arch:SSE2 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_SSE2 -- %s
 #if defined(TEST_32_ARCH_SSE2)
@@ -40,13 +41,13 @@
 #endif
 
 // RUN: %clang_cl -m32 -arch:sse2 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=sse %s
-// sse2: argument unused during compilation
+// sse2: invalid /arch: argument
 
 // RUN: %clang_cl -m64 -arch:SSE --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=SSE64 %s
-// SSE64: argument unused during compilation
+// SSE64: invalid /arch: argument 'SSE'; for 64-bit expected one of AVX, AVX2, AVX512, AVX512F
 
 // RUN: %clang_cl -m64 -arch:SSE2 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=SSE264 %s
-// SSE264: argument unused during compilation
+// SSE264: invalid /arch: argument
 
 // RUN: %clang_cl -m32 -arch:AVX --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX -- %s
 #if defined(TEST_32_ARCH_AVX)
@@ -56,7 +57,7 @@
 #endif
 
 // RUN: %clang_cl -m32 -arch:avx --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx %s
-// avx: argument unused during compilation
+// avx: invalid /arch: argument
 
 // RUN: %clang_cl -m32 -arch:AVX2 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX2 -- %s
 #if defined(TEST_32_ARCH_AVX2)
@@ 

[PATCH] D104344: [modules] Track how headers are included by different submodules.

2021-09-01 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

I wonder if perhaps we're tracking this state in the wrong way. The "has been 
included" information for `#pragma once` / `#import` should behave exactly like 
macro definition visibility: it should be reset whenever we enter a new "clean 
slate" state and should be saved and restored suitably when switching 
visibility states. If we track, for each header file, a map from module to 
include information, then we'll be paying a fairly high cost: each time we see 
a `#include` we'll need to look up every currently-visible module in the map to 
see if the header was included in that module. It might be better to track an 
up-to-date list of the headers that have been either `#import`ed in the current 
preprocessor state (including via imported modules) or that have been both 
`#include`d and contain `#pragma once`. You could stash that in the 
`Preprocessor::SubmoduleState` so that it's suitably swapped out when we switch 
to a new preprocessing state.




Comment at: clang/include/clang/Lex/HeaderSearch.h:126
+  /// Bool represents if the header was included (false) or imported (true).
+  llvm::DenseMap ModuleIncludersMap;
+

This seems like a very expensive thing to include in `HeaderFileInfo`, which we 
may have many thousands of in some compilations. (I have similar concerns about 
`Aliases` FWIW.)



Comment at: clang/include/clang/Serialization/ASTBitCodes.h:44
 /// AST files at this time.
-const unsigned VERSION_MAJOR = 15;
+const unsigned VERSION_MAJOR = 16;
 

Do we really need to bump the version number? (Does this affect something we 
read before we read the Clang version number and reject on a version mismatch?)



Comment at: clang/lib/Serialization/ASTReader.cpp:1912-1916
+// Update isImport and NumIncludes based on including module.
+if (Mod->NameVisibility == Module::NameVisibilityKind::AllVisible) {
+  HFI.isImport |= IsImport;
+  ++HFI.NumIncludes;
+}

This doesn't do the right thing in local submodule visibility mode. We need to 
compute visibility locally from within `HeaderSearch` based on the currently 
visible modules at the point of the query instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104344/new/

https://reviews.llvm.org/D104344

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 64ebf31 - [HeaderSearch] Use `isImport` only for imported headers and not for `#pragma once`.

2021-09-01 Thread Volodymyr Sapsai via cfe-commits

Author: Volodymyr Sapsai
Date: 2021-09-01T17:07:35-07:00
New Revision: 64ebf313a7e485e1a90da9cd69c412e06615a9bc

URL: 
https://github.com/llvm/llvm-project/commit/64ebf313a7e485e1a90da9cd69c412e06615a9bc
DIFF: 
https://github.com/llvm/llvm-project/commit/64ebf313a7e485e1a90da9cd69c412e06615a9bc.diff

LOG: [HeaderSearch] Use `isImport` only for imported headers and not for 
`#pragma once`.

There is a separate field `isPragmaOnce` and when `isImport` combines
both, it complicates HeaderFileInfo serialization as `#pragma once` is
the inherent property of the header while `isImport` reflects how other
headers use it. The usage of the header can be different in different
contexts, that's why `isImport` requires tracking separate from `#pragma once`.

Differential Revision: https://reviews.llvm.org/D104351

Added: 


Modified: 
clang/include/clang/Lex/HeaderSearch.h
clang/lib/Lex/HeaderSearch.cpp

Removed: 




diff  --git a/clang/include/clang/Lex/HeaderSearch.h 
b/clang/include/clang/Lex/HeaderSearch.h
index a35a394f719b0..7df1127f42735 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -51,7 +51,7 @@ class TargetInfo;
 /// The preprocessor keeps track of this information for each
 /// file that is \#included.
 struct HeaderFileInfo {
-  /// True if this is a \#import'd or \#pragma once file.
+  /// True if this is a \#import'd file.
   unsigned isImport : 1;
 
   /// True if this is a \#pragma once file.
@@ -450,11 +450,10 @@ class HeaderSearch {
 return (SrcMgr::CharacteristicKind)getFileInfo(File).DirInfo;
   }
 
-  /// Mark the specified file as a "once only" file, e.g. due to
+  /// Mark the specified file as a "once only" file due to
   /// \#pragma once.
   void MarkFileIncludeOnce(const FileEntry *File) {
 HeaderFileInfo  = getFileInfo(File);
-FI.isImport = true;
 FI.isPragmaOnce = true;
   }
 
@@ -500,8 +499,7 @@ class HeaderSearch {
   /// This routine does not consider the effect of \#import
   bool isFileMultipleIncludeGuarded(const FileEntry *File);
 
-  /// Determine whether the given file is known to have ever been \#imported
-  /// (or if it has been \#included and we've encountered a \#pragma once).
+  /// Determine whether the given file is known to have ever been \#imported.
   bool hasFileBeenImported(const FileEntry *File) {
 const HeaderFileInfo *FI = getExistingFileInfo(File);
 return FI && FI->isImport;

diff  --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index d5adbcf62cbc5..8bf61a2ba5972 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -91,7 +91,7 @@ void HeaderSearch::PrintStats() {
<< FileInfo.size() << " files tracked.\n";
   unsigned NumOnceOnlyFiles = 0, MaxNumIncludes = 0, NumSingleIncludedFiles = 
0;
   for (unsigned i = 0, e = FileInfo.size(); i != e; ++i) {
-NumOnceOnlyFiles += FileInfo[i].isImport;
+NumOnceOnlyFiles += (FileInfo[i].isPragmaOnce || FileInfo[i].isImport);
 if (MaxNumIncludes < FileInfo[i].NumIncludes)
   MaxNumIncludes = FileInfo[i].NumIncludes;
 NumSingleIncludedFiles += FileInfo[i].NumIncludes == 1;
@@ -1325,7 +1325,7 @@ bool HeaderSearch::ShouldEnterIncludeFile(Preprocessor 
,
   } else {
 // Otherwise, if this is a #include of a file that was previously #import'd
 // or if this is the second #include of a #pragma once file, ignore it.
-if (FileInfo.isImport && !TryEnterImported())
+if ((FileInfo.isPragmaOnce || FileInfo.isImport) && !TryEnterImported())
   return false;
   }
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104351: [HeaderSearch] Use `isImport` only for imported headers and not for `#pragma once`.

2021-09-01 Thread Volodymyr Sapsai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG64ebf313a7e4: [HeaderSearch] Use `isImport` only for 
imported headers and not for `#pragma… (authored by vsapsai).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104351/new/

https://reviews.llvm.org/D104351

Files:
  clang/include/clang/Lex/HeaderSearch.h
  clang/lib/Lex/HeaderSearch.cpp


Index: clang/lib/Lex/HeaderSearch.cpp
===
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -91,7 +91,7 @@
<< FileInfo.size() << " files tracked.\n";
   unsigned NumOnceOnlyFiles = 0, MaxNumIncludes = 0, NumSingleIncludedFiles = 
0;
   for (unsigned i = 0, e = FileInfo.size(); i != e; ++i) {
-NumOnceOnlyFiles += FileInfo[i].isImport;
+NumOnceOnlyFiles += (FileInfo[i].isPragmaOnce || FileInfo[i].isImport);
 if (MaxNumIncludes < FileInfo[i].NumIncludes)
   MaxNumIncludes = FileInfo[i].NumIncludes;
 NumSingleIncludedFiles += FileInfo[i].NumIncludes == 1;
@@ -1325,7 +1325,7 @@
   } else {
 // Otherwise, if this is a #include of a file that was previously #import'd
 // or if this is the second #include of a #pragma once file, ignore it.
-if (FileInfo.isImport && !TryEnterImported())
+if ((FileInfo.isPragmaOnce || FileInfo.isImport) && !TryEnterImported())
   return false;
   }
 
Index: clang/include/clang/Lex/HeaderSearch.h
===
--- clang/include/clang/Lex/HeaderSearch.h
+++ clang/include/clang/Lex/HeaderSearch.h
@@ -51,7 +51,7 @@
 /// The preprocessor keeps track of this information for each
 /// file that is \#included.
 struct HeaderFileInfo {
-  /// True if this is a \#import'd or \#pragma once file.
+  /// True if this is a \#import'd file.
   unsigned isImport : 1;
 
   /// True if this is a \#pragma once file.
@@ -450,11 +450,10 @@
 return (SrcMgr::CharacteristicKind)getFileInfo(File).DirInfo;
   }
 
-  /// Mark the specified file as a "once only" file, e.g. due to
+  /// Mark the specified file as a "once only" file due to
   /// \#pragma once.
   void MarkFileIncludeOnce(const FileEntry *File) {
 HeaderFileInfo  = getFileInfo(File);
-FI.isImport = true;
 FI.isPragmaOnce = true;
   }
 
@@ -500,8 +499,7 @@
   /// This routine does not consider the effect of \#import
   bool isFileMultipleIncludeGuarded(const FileEntry *File);
 
-  /// Determine whether the given file is known to have ever been \#imported
-  /// (or if it has been \#included and we've encountered a \#pragma once).
+  /// Determine whether the given file is known to have ever been \#imported.
   bool hasFileBeenImported(const FileEntry *File) {
 const HeaderFileInfo *FI = getExistingFileInfo(File);
 return FI && FI->isImport;


Index: clang/lib/Lex/HeaderSearch.cpp
===
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -91,7 +91,7 @@
<< FileInfo.size() << " files tracked.\n";
   unsigned NumOnceOnlyFiles = 0, MaxNumIncludes = 0, NumSingleIncludedFiles = 0;
   for (unsigned i = 0, e = FileInfo.size(); i != e; ++i) {
-NumOnceOnlyFiles += FileInfo[i].isImport;
+NumOnceOnlyFiles += (FileInfo[i].isPragmaOnce || FileInfo[i].isImport);
 if (MaxNumIncludes < FileInfo[i].NumIncludes)
   MaxNumIncludes = FileInfo[i].NumIncludes;
 NumSingleIncludedFiles += FileInfo[i].NumIncludes == 1;
@@ -1325,7 +1325,7 @@
   } else {
 // Otherwise, if this is a #include of a file that was previously #import'd
 // or if this is the second #include of a #pragma once file, ignore it.
-if (FileInfo.isImport && !TryEnterImported())
+if ((FileInfo.isPragmaOnce || FileInfo.isImport) && !TryEnterImported())
   return false;
   }
 
Index: clang/include/clang/Lex/HeaderSearch.h
===
--- clang/include/clang/Lex/HeaderSearch.h
+++ clang/include/clang/Lex/HeaderSearch.h
@@ -51,7 +51,7 @@
 /// The preprocessor keeps track of this information for each
 /// file that is \#included.
 struct HeaderFileInfo {
-  /// True if this is a \#import'd or \#pragma once file.
+  /// True if this is a \#import'd file.
   unsigned isImport : 1;
 
   /// True if this is a \#pragma once file.
@@ -450,11 +450,10 @@
 return (SrcMgr::CharacteristicKind)getFileInfo(File).DirInfo;
   }
 
-  /// Mark the specified file as a "once only" file, e.g. due to
+  /// Mark the specified file as a "once only" file due to
   /// \#pragma once.
   void MarkFileIncludeOnce(const FileEntry *File) {
 HeaderFileInfo  = getFileInfo(File);
-FI.isImport = true;
 FI.isPragmaOnce = true;
   }
 
@@ -500,8 +499,7 @@
   /// This routine does not consider the effect of \#import
   bool isFileMultipleIncludeGuarded(const FileEntry *File);
 
-  /// Determine 

[PATCH] D104344: [modules] Track how headers are included by different modules.

2021-09-01 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai updated this revision to Diff 370117.
vsapsai added a comment.

Clarify some comments; rebase for a fresh pre-commit testing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104344/new/

https://reviews.llvm.org/D104344

Files:
  clang/include/clang/Lex/HeaderSearch.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  
clang/test/Modules/Inputs/import-nonmodular/MixedDirectives.framework/Headers/MixedDirectives.h
  
clang/test/Modules/Inputs/import-nonmodular/MixedDirectives.framework/Modules/module.modulemap
  
clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Headers/Invisible.h
  
clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Headers/Visible.h
  
clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Modules/module.modulemap
  
clang/test/Modules/Inputs/import-nonmodular/Unmodularized.framework/Headers/Unmodularized.h
  clang/test/Modules/import-nonmodular-directive-tracking.m
  clang/test/Modules/import-nonmodular.m

Index: clang/test/Modules/import-nonmodular.m
===
--- /dev/null
+++ clang/test/Modules/import-nonmodular.m
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs/import-nonmodular %s -verify
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs/import-nonmodular %s -verify -DTEST_IMPORT_FROM_MODULE
+// expected-no-diagnostics
+
+// Test non-modular headers are not skipped even if they are imported by
+// non-imported submodules of an imported module. Dependency graph is
+//
+//   Unmodularized.h
+//   ^   ^
+//   |   |
+//  Modularized.Visible  |Modularized.Invisible
+//  ^|
+//   \   |
+//import-nonmodular.m
+
+#import 
+#ifdef TEST_IMPORT_FROM_MODULE
+#import 
+#endif
+#import 
+void test(UnmodularizedStruct *s) {}
Index: clang/test/Modules/import-nonmodular-directive-tracking.m
===
--- /dev/null
+++ clang/test/Modules/import-nonmodular-directive-tracking.m
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F %S/Inputs/import-nonmodular %s -verify
+// expected-no-diagnostics
+
+// Test that #import in a module is "sticky" and isn't overwritten by subsequent #include.
+
+#import 
+// #include instead of #import on purpose.
+#include 
+void test(UnmodularizedStruct *s) {}
Index: clang/test/Modules/Inputs/import-nonmodular/Unmodularized.framework/Headers/Unmodularized.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/import-nonmodular/Unmodularized.framework/Headers/Unmodularized.h
@@ -0,0 +1,4 @@
+// No header guard on purpose.
+
+typedef struct UnmodularizedStruct {
+} UnmodularizedStruct;
Index: clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Modules/module.modulemap
===
--- /dev/null
+++ clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Modules/module.modulemap
@@ -0,0 +1,11 @@
+framework module Modularized {
+  module Visible {
+header "Visible.h"
+export *
+  }
+
+  module Invisible {
+header "Invisible.h"
+export *
+  }
+}
Index: clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Headers/Visible.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Headers/Visible.h
@@ -0,0 +1 @@
+// Empty.
Index: clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Headers/Invisible.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/import-nonmodular/Modularized.framework/Headers/Invisible.h
@@ -0,0 +1 @@
+#import 
Index: clang/test/Modules/Inputs/import-nonmodular/MixedDirectives.framework/Modules/module.modulemap
===
--- /dev/null
+++ clang/test/Modules/Inputs/import-nonmodular/MixedDirectives.framework/Modules/module.modulemap
@@ -0,0 +1,4 @@
+framework module MixedDirectives {
+  header "MixedDirectives.h"
+  export *
+}
Index: clang/test/Modules/Inputs/import-nonmodular/MixedDirectives.framework/Headers/MixedDirectives.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/import-nonmodular/MixedDirectives.framework/Headers/MixedDirectives.h
@@ -0,0 +1,2 @@
+#import 
+#include 
Index: clang/lib/Serialization/ASTWriter.cpp

[PATCH] D104344: [modules] Track how headers are included by different modules.

2021-09-01 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added inline comments.



Comment at: clang/lib/Serialization/ASTWriter.cpp:1671
   unsigned KeyLen = key.Filename.size() + 1 + 8 + 8;
-  unsigned DataLen = 1 + 2 + 4 + 4;
+  unsigned DataLen = 1 + 4 + 4 + 4;
+  for (auto ModuleIncluder : Data.HFI.ModuleIncludersMap)

Note for future readers (including myself). Can save 2 bytes because not 
writing `Data.HFI.NumIncludes` but need 4 extra bytes for 
`Data.HFI.ModuleIncludersMap` stop value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104344/new/

https://reviews.llvm.org/D104344

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D105671: [Intrinsics][ObjC] Mark objc_retain and friends as thisreturn.

2021-09-01 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Whoa.  That does not seem like it's in the contract for `stripPointerCasts()` 
generically.  At best that should be enabled by the strip kind.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105671/new/

https://reviews.llvm.org/D105671

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D105671: [Intrinsics][ObjC] Mark objc_retain and friends as thisreturn.

2021-09-01 Thread Jon Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

In D105671#2978248 , @rjmccall wrote:

> How does `stripPointerCasts` "see through" an attribute on the underlying 
> call instruction?

https://github.com/llvm/llvm-project/blob/bf77b11277411f6725cf09a66feb36d2c14bc8a7/llvm/lib/IR/Value.cpp#L652


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105671/new/

https://reviews.llvm.org/D105671

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D105671: [Intrinsics][ObjC] Mark objc_retain and friends as thisreturn.

2021-09-01 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

How does `stripPointerCasts` "see through" an attribute on the underlying call 
instruction?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105671/new/

https://reviews.llvm.org/D105671

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109105: [clang-cl] Emit nicer warning on unknown /arch: arguments

2021-09-01 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
Herald added subscribers: dexonsmith, Jim, atanasyan, jrtc27, fedor.sergeev, 
sdardis, dylanmckay, emaste.
thakis requested review of this revision.
Herald added a project: LLVM.

Now prints the list of known archs. This requires plumbing a Driver
arg through a few functions.

Also add two more convenience insert() overlods to StringMap.


https://reviews.llvm.org/D109105

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/ToolChains/AVR.cpp
  clang/lib/Driver/ToolChains/Arch/Mips.cpp
  clang/lib/Driver/ToolChains/Arch/Mips.h
  clang/lib/Driver/ToolChains/Arch/X86.cpp
  clang/lib/Driver/ToolChains/Arch/X86.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/lib/Driver/ToolChains/OpenBSD.cpp
  clang/test/Driver/cl-x86-flags.c
  llvm/include/llvm/ADT/StringMap.h

Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -126,9 +126,7 @@
 
   StringMap(std::initializer_list> List)
   : StringMapImpl(List.size(), static_cast(sizeof(MapEntryTy))) {
-for (const auto  : List) {
-  insert(P);
-}
+insert(List);
   }
 
   StringMap(StringMap &)
@@ -297,6 +295,21 @@
 return try_emplace(KV.first, std::move(KV.second));
   }
 
+  /// Inserts elements from range [first, last). If multiple elements in the
+  /// range have keys that compare equivalent, it is unspecified which element
+  /// is inserted .
+  template  void insert(InputIt First, InputIt Last) {
+for (InputIt It = First; It != Last; ++It)
+  insert(*It);
+  }
+
+  ///  Inserts elements from initializer list ilist. If multiple elements in
+  /// the range have keys that compare equivalent, it is unspecified which
+  /// element is inserted
+  void insert(std::initializer_list> List) {
+insert(List.begin(), List.end());
+  }
+
   /// Inserts an element or assigns to the current element if the key already
   /// exists. The return type is the same as try_emplace.
   template 
Index: clang/test/Driver/cl-x86-flags.c
===
--- clang/test/Driver/cl-x86-flags.c
+++ clang/test/Driver/cl-x86-flags.c
@@ -6,7 +6,8 @@
 // flag space.
 // RUN: %clang_cl /Zs /WX -m32 -m64 -msse3 -msse4.1 -mavx -mno-avx \
 // RUN: --target=i386-pc-win32 -### -- 2>&1 %s | FileCheck -check-prefix=MFLAGS %s
-// MFLAGS-NOT: argument unused during compilation
+// MFLAGS-NOT: invalid /arch: argument
+//
 
 // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_IA32 -- %s
 #if defined(TEST_32_ARCH_IA32)
@@ -17,10 +18,10 @@
 
 // arch: args are case-sensitive.
 // RUN: %clang_cl -m32 -arch:ia32 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=ia32 %s
-// ia32: argument unused during compilation
+// ia32: invalid /arch: argument 'ia32'; for 32-bit expected one of AVX, AVX2, AVX512, AVX512F, IA32, SSE, SSE2
 
 // RUN: %clang_cl -m64 -arch:IA32 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=IA3264 %s
-// IA3264: argument unused during compilation
+// IA3264: invalid /arch: argument 'IA32'; for 64-bit expected one of AVX, AVX2, AVX512, AVX512F
 
 // RUN: %clang_cl -m32 -arch:SSE --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_SSE -- %s
 #if defined(TEST_32_ARCH_SSE)
@@ -30,7 +31,7 @@
 #endif
 
 // RUN: %clang_cl -m32 -arch:sse --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=sse %s
-// sse: argument unused during compilation
+// sse: invalid /arch: argument
 
 // RUN: %clang_cl -m32 -arch:SSE2 --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_SSE2 -- %s
 #if defined(TEST_32_ARCH_SSE2)
@@ -40,13 +41,13 @@
 #endif
 
 // RUN: %clang_cl -m32 -arch:sse2 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=sse %s
-// sse2: argument unused during compilation
+// sse2: invalid /arch: argument
 
 // RUN: %clang_cl -m64 -arch:SSE --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=SSE64 %s
-// SSE64: argument unused during compilation
+// SSE64: invalid /arch: argument 'SSE'; for 64-bit expected one of AVX, AVX2, AVX512, AVX512F
 
 // RUN: %clang_cl -m64 -arch:SSE2 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=SSE264 %s
-// SSE264: argument unused during compilation
+// SSE264: invalid /arch: argument
 
 // RUN: %clang_cl -m32 -arch:AVX --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX -- %s
 #if defined(TEST_32_ARCH_AVX)
@@ -56,7 +57,7 @@
 #endif
 
 // RUN: %clang_cl -m32 -arch:avx --target=i386-pc-windows -### -- 2>&1 %s | 

[PATCH] D107589: [CMake] Support setting default fused FP contract via CMake

2021-09-01 Thread John McCall via Phabricator via cfe-commits
rjmccall closed this revision.
rjmccall added a comment.

I agree.  This isn't the right approach.   The patch in question is currently 
reverted; if you'd like to argue to not restore it, that conversation should be 
part of that review.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107589/new/

https://reviews.llvm.org/D107589

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106809: [clang-offload-bundler] Make Bundle Entry ID backward compatible

2021-09-01 Thread George Rokos via Phabricator via cfe-commits
grokos added a comment.

LG. One possible suggestion is that you leave the double dash (`--`) variant in 
some tests so that we can make sure both variants (e.g. both 
`openmp-amdgcn-amd-amdhsa--gfx906` and `openmp-amdgcn-amd-amdhsa-gfx906`) are 
correctly parsed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106809/new/

https://reviews.llvm.org/D106809

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Evandro Menezes via Phabricator via cfe-commits
evandro added a comment.

In D108886#2978169 , @apivovarov 
wrote:

> Add Cortex-A78C Support for Clang and LLVM 
> 
>  is similar to this patch.  As we can see `cortex-a78c` support was included 
> to the ReleaseNotes 12.x 
> .
>  From the other side adding `sifive-e76` and `sifive-u74` support has not 
> been mentioned in the Release Notes for version 12.0

Fair enough.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov added a comment.

Add Cortex-A78C Support for Clang and LLVM 

 is similar to this patch.  As we can see `cortex-a78c` support was included to 
the ReleaseNotes 12.x 
.
 From the other side adding `sifive-e76` and `sifive-u74` support has not been 
mentioned in the Release Notes for version 12.0


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield requested review of this revision.
JonChesterfield added a comment.

Sending back to review now that the test updates are included and LIBRARY_PATH 
removed from the test setup entirely




Comment at: clang/test/Driver/openmp-offload-gpu.c:151
 
 /// Check that the runtime bitcode library is part of the compile line. Create 
a bogus
+/// bitcode library and specify it with libomptarget-nvptx-bc-path

Tests didn't change much - replace env LIBRARY_PATH with 
--libomptarget-nvptx-bc-path. Dropped the one that only used LIBRARY_PATH and 
added one for the new runtime library using directory. Slightly reordered and 
updated comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108794: Fully qualify template template parameters when printing

2021-09-01 Thread David Blaikie via Phabricator via cfe-commits
dblaikie marked an inline comment as done.
dblaikie added a comment.

Ping

In D108794#2976063 , @rtrieu wrote:

> It looks like a strict improvement on printing and most callers using the 
> default args won't need to be updated.
>
> There's one more function call that should be updated:
> https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/DumpAST.cpp#L298
>
> Fixing that and the comment and this should be good to go in.

Ah, thanks for catching that (just running `check-clang` doesn't catch this, 
and it doesn't seem like there's a `check-clang-tools-extra` - any idea if 
there's something narrower than `check-all` that would run clang-tools-extra 
tests?). Updated that caller to preserve the existing unqualified behavior.




Comment at: clang/include/clang/AST/TemplateName.h:318-320
   /// \param SuppressNNS if true, don't print the
   /// nested-name-specifier that precedes the template name (if it has
   /// one).

rtrieu wrote:
> Update this comment to reflect the enum.
Oh, for sure, thanks for the pointer!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108794/new/

https://reviews.llvm.org/D108794

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 370087.
JonChesterfield added a comment.
Herald added subscribers: kerbowa, nhaehnle, jvesely.

- Update tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/Inputs/libomptarget/libomptarget-new-nvptx-test.bc
  clang/test/Driver/amdgpu-openmp-toolchain.c
  clang/test/Driver/openmp-offload-gpu.c
  openmp/libomptarget/test/lit.cfg

Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -89,9 +89,10 @@
 config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
 if config.cuda_libdir:
 config.test_flags += " -Wl,-rpath," + config.cuda_libdir
-append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
-append_dynamic_library_path('LIBRARY_PATH', \
-config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -149,33 +149,40 @@
 /// ###
 
 /// Check that the runtime bitcode library is part of the compile line. Create a bogus
-/// bitcode library and add it to the LIBRARY_PATH.
-// RUN:   env LIBRARY_PATH=%S/Inputs/libomptarget %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
-// RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB %s
-/// Check with the new runtime enabled
-// RUN:   env LIBRARY_PATH=%S/Inputs/libomptarget %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
-// RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -fopenmp-target-new-runtime -save-temps -no-canonical-prefixes %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-NEW %s
-/// The user can override default detection using --libomptarget-nvptx-bc-path=.
+/// bitcode library and specify it with libomptarget-nvptx-bc-path
 // RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
 // RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc \
 // RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
-/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   -fopenmp-relocatable-target -fopenmp-target-new-runtime -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB %s
+
+/// Specify the directory containing the bitcode lib, check clang picks the right one
 // RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
 // RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
 // RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-DIR %s
 
-// CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
-// CHK-BCLIB-NEW: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
-// CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-// CHK-BCLIB-USER-DIR: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_35.bc
+/// Check with the new runtime enabled
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -fopenmp-target-new-runtime \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-new-nvptx-test.bc \
+// RUN:   -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-NEW %s
+
+/// Check with new 

[PATCH] D108794: Fully qualify template template parameters when printing

2021-09-01 Thread David Blaikie via Phabricator via cfe-commits
dblaikie updated this revision to Diff 370086.
dblaikie added a comment.
Herald added subscribers: usaxena95, kadircet.
Herald added a project: clang-tools-extra.

Fix the clang-tools-extra caller, and update the TemplateName::print doc comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108794/new/

https://reviews.llvm.org/D108794

Files:
  clang-tools-extra/clangd/DumpAST.cpp
  clang/include/clang/AST/TemplateName.h
  clang/lib/AST/NestedNameSpecifier.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/AST/TemplateName.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CXX/drs/dr10xx.cpp
  clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
  clang/test/Index/print-type.cpp
  clang/test/Misc/diag-template.cpp
  clang/test/SemaTemplate/temp_arg_template.cpp

Index: clang/test/SemaTemplate/temp_arg_template.cpp
===
--- clang/test/SemaTemplate/temp_arg_template.cpp
+++ clang/test/SemaTemplate/temp_arg_template.cpp
@@ -59,7 +59,7 @@
 0 << a.const_ref(); // expected-error{{invalid operands to binary expression ('int' and 'X')}}
   }
 
-  void f0( Y y){ 1 << y; } // expected-note{{in instantiation of function template specialization 'N::operator<<' requested here}}
+  void f0( Y y){ 1 << y; } // expected-note{{in instantiation of function template specialization 'N::operator<<' requested here}}
 }
 
 // PR12179
Index: clang/test/Misc/diag-template.cpp
===
--- clang/test/Misc/diag-template.cpp
+++ clang/test/Misc/diag-template.cpp
@@ -34,8 +34,8 @@
 f(Q<>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
 f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
 f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
-f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
-f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
-f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
+f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
+f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
+f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
   }
 }
Index: clang/test/Index/print-type.cpp
===
--- clang/test/Index/print-type.cpp
+++ clang/test/Index/print-type.cpp
@@ -132,7 +132,7 @@
 // CHECK: TypedefDecl=OtherType:26:18 (Definition) [type=outer::inner::Bar::OtherType] [typekind=Typedef] [canonicaltype=double] [canonicaltypekind=Double] [isPOD=1]
 // CHECK: TypedefDecl=ArrayType:27:15 (Definition) [type=outer::inner::Bar::ArrayType] [typekind=Typedef] [canonicaltype=int [5]] [canonicaltypekind=ConstantArray] [isPOD=1]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: FieldDecl=baz:28:20 (Definition) [type=Baz] [typekind=Unexposed] [templateargs/3= [type=int] [typekind=Int]] [canonicaltype=outer::Baz] [canonicaltypekind=Record] [canonicaltemplateargs/3= [type=int] [typekind=Int]] [isPOD=1]
+// CHECK: FieldDecl=baz:28:20 (Definition) [type=Baz] [typekind=Unexposed] [templateargs/3= [type=int] [typekind=Int]] [canonicaltype=outer::Baz] [canonicaltypekind=Record] [canonicaltemplateargs/3= [type=int] [typekind=Int]] [isPOD=1]
 // CHECK: TemplateRef=Baz:9:8 [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
 // CHECK: TemplateRef=Foo:4:8 [type=] [typekind=Invalid] [isPOD=0]
Index: clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
===
--- clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
+++ clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
@@ -93,7 +93,7 @@
 }
 
 namespace DeduceWithDefaultArgs {
-  template class Container> void f(Container); // expected-note {{deduced type 'X<[...], (default) int>' of 1st parameter does not match adjusted type 'X<[...], double>' of argument [with Container = X]}}
+  template class Container> void f(Container); // expected-note {{deduced type 'X<[...], (default) int>' of 1st parameter does not match adjusted type 'X<[...], double>' of argument [with Container = DeduceWithDefaultArgs::X]}}
   template struct X {};
   void g() {
 // OK, use default argument for the second template parameter.
Index: clang/test/CXX/drs/dr10xx.cpp
===
--- clang/test/CXX/drs/dr10xx.cpp
+++ clang/test/CXX/drs/dr10xx.cpp
@@ -17,8 +17,8 @@
   template struct B1 {};
   template class> struct B2 {};
   template void f(); // expected-note {{[with X = dr1004::A]}}
-  template class X> void f(); // expected-note {{[with X = A]}}
-  template class X> void g(); 

[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Evandro Menezes via Phabricator via cfe-commits
evandro added a comment.

In D108886#2978038 , @apivovarov 
wrote:

> Evandro, similar notes have been made in the past for Release Notes 12.x and 
> 11.x for Arm and RISC-V processors:
> https://github.com/llvm/llvm-project/blob/release/12.x/clang/docs/ReleaseNotes.rst#modified-compiler-flags
> https://github.com/llvm/llvm-project/blob/release/11.x/clang/docs/ReleaseNotes.rst#modified-compiler-flags

Exactly, but they were not similar changes, but more significant ones, 
including the addition pipeline models.  But I don't feel strongly about it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107873: [clang-tidy] Add 'performance-const-parameter-value-or-ref' for checking const-qualified parameters

2021-09-01 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/performance/ConstParameterValueOrRef.h:40
+  static constexpr int DefaultSmallMaxSize = 16;
+  int SmallMaxSize = Options.get("SmallMaxSize", DefaultSmallMaxSize);
+

jmarrec wrote:
> https://reviews.llvm.org/D107900#inline-1029358
> 
> 
> On mine, I had another option `RestrictToBuiltInTypes` which I find an 
> interesting option. It has a ` builtinType()` matcher in the registerMatchers 
> function
Could you please elaborate on why you find this interesting? I don't see any 
benefit to ignoring `struct S { char c; }`.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/performance-const-parameter-value-or-ref.rst:44
+  // warning: 'const int' is a small, trivially copyable type: pass by value 
instead
+  // fix-it: void f6(const int i) {}
+

jmarrec wrote:
> https://reviews.llvm.org/D107900#inline-1029358
> 
> I am removing the `const` as well in addition to the `&`. I guess you may be 
> just relying on using it in conjunction with 
> `readability-avoid-const-params-in-decls` but I think that makes it harder to 
> use (you can't just do `-checks=-*,` you have to remember to add 
> the `readability-avoid-const-params-in-decls` too...).
> 
> Taht being said, perhaps that's how it's meant to be...
I don't know if our goals are aligned here. This patch intends to preserve 
constness in all cases. If a user defines a function as
```
void f(int const& x) { }
```
Then there's a good chance that they want the constness. Removing that 
constness changes the meaning of the program since `x` would then be 
modifiable. What's deferred to `readability-avoid-const-params-in-decls` is 
const-qualified value parameters in forward declarations, which isn't really in 
scope here, since forward declarations are used to overrule this check's 
analysis.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107873/new/

https://reviews.llvm.org/D107873

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov added a comment.

Evandro, similar notes have been made in the past for Release Notes 12.x and 
11.x for Arm and RISC-V processors:
https://github.com/llvm/llvm-project/blob/release/12.x/clang/docs/ReleaseNotes.rst#modified-compiler-flags
https://github.com/llvm/llvm-project/blob/release/11.x/clang/docs/ReleaseNotes.rst#modified-compiler-flags


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Evandro Menezes via Phabricator via cfe-commits
evandro added a comment.

I don't think that such a minor change makes sense to be added to the release 
notes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov updated this revision to Diff 370072.
apivovarov added a comment.

Added a note to Release Notes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

Files:
  clang/docs/ReleaseNotes.rst
  clang/test/Driver/riscv-cpus.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/RISCVTargetParser.def
  llvm/lib/Target/RISCV/RISCV.td


Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -254,6 +254,11 @@
  FeatureStdExtA,
  FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
Index: llvm/include/llvm/Support/RISCVTargetParser.def
===
--- llvm/include/llvm/Support/RISCVTargetParser.def
+++ llvm/include/llvm/Support/RISCVTargetParser.def
@@ -20,6 +20,7 @@
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_S51, {"sifive-s51"}, FK_64BIT, {"rv64imac"})
 PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"})
 PROC(SIFIVE_E76, {"sifive-e76"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_U74, {"sifive-u74"}, FK_64BIT, {"rv64gc"})
Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -196,7 +196,7 @@
 
 // RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix RISCV64
 // RISCV64: error: unknown target CPU 'not-a-cpu'
-// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-u54, sifive-u74
+// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74
 
 // RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
 // TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
@@ -204,4 +204,4 @@
 
 // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
 // TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
-// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-u54, sifive-u74, generic, rocket, sifive-7-series
+// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74, generic, rocket, 
sifive-7-series
Index: clang/test/Driver/riscv-cpus.c
===
--- clang/test/Driver/riscv-cpus.c
+++ clang/test/Driver/riscv-cpus.c
@@ -45,6 +45,13 @@
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mtune=sifive-7-series | 
FileCheck -check-prefix=MTUNE-SIFIVE7-SERIES-64 %s
 // MTUNE-SIFIVE7-SERIES-64: "-tune-cpu" "sifive-7-rv64"
 
+// mcpu with mabi option
+// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-s51 -mabi=lp64 | 
FileCheck -check-prefix=MCPU-ABI-SIFIVE-S51 %s
+// MCPU-ABI-SIFIVE-S51: "-nostdsysteminc" "-target-cpu" "sifive-s51"
+// MCPU-ABI-SIFIVE-S51: "-target-feature" "+m" "-target-feature" "+a"
+// MCPU-ABI-SIFIVE-S51: "-target-feature" "+c" "-target-feature" "+64bit"
+// MCPU-ABI-SIFIVE-S51: "-target-abi" "lp64"
+
 // mcpu with default march
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-u54 | FileCheck 
-check-prefix=MCPU-SIFIVE-U54 %s
 // MCPU-SIFIVE-U54: "-nostdsysteminc" "-target-cpu" "sifive-u54"
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -71,7 +71,9 @@
 Modified Compiler Flags
 ---
 
-- ...
+- Support has been added for the following processors (``-mcpu`` identifiers 
in parentheses):
+
+  - RISC-V SiFive S51 (``sifive-s51``).
 
 Removed Compiler Flags
 -


Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -254,6 +254,11 @@
  FeatureStdExtA,
  

[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a subscriber: Meinersbur.
jdoerfert added a comment.

In D109057#2977859 , @JonChesterfield 
wrote:

> Turns out {{.}} is also fine as far as Linux is concerned and unacceptable to 
> Windows. I can't run anything on Windows locally, and trial and error while 
> watching http://45.33.8.238/win has taken too many iterations already, so 
> I've dropped the test case in 06cdf48a0d94749a19b0b 
> .

@Meinersbur can you take a look?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.

In D108886#2977873 , @apivovarov 
wrote:

> In D108886#2977733 , @jrtc27 wrote:
>
>> You don't need to tag people as well as adding them as reviewers, it's just 
>> annoying. Also, it's only been four days; the developer policy is that for 
>> non-urgent patches you shouldn't ping more than once a week.
>
> Jessica, Contributing to LLVM says - To make sure the right people see your 
> patch, please select suitable reviewers and add them to your patch when 
> requesting a review. Suitable reviewers are the code owner (see 
> CODE_OWNERS.txt) and other people doing work in the area your patch touches.
>
> The people I added as reviewers have contributed to RISC-V target code in the 
> past.

Yeah, but that means adding them as reviewers, you don't also need to @ them in 
general.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Evandro Menezes via Phabricator via cfe-commits
evandro accepted this revision.
evandro added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov added a comment.

In D108886#2977733 , @jrtc27 wrote:

> You don't need to tag people as well as adding them as reviewers, it's just 
> annoying. Also, it's only been four days; the developer policy is that for 
> non-urgent patches you shouldn't ping more than once a week.

Jessica, Contributing to LLVM says - To make sure the right people see your 
patch, please select suitable reviewers and add them to your patch when 
requesting a review. Suitable reviewers are the code owner (see 
CODE_OWNERS.txt) and other people doing work in the area your patch touches.

The people I added as reviewers contributes to RISC-V target code in the past.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Turns out {{.}} is also fine as far as Linux is concerned and unacceptable to 
Windows. I can't run anything on Windows locally, and trial and error while 
watching http://45.33.8.238/win has taken too many iterations already, so I've 
dropped the test case in 06cdf48a0d94749a19b0b 
.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 06cdf48 - [openmp] Drop test from D109057, disproportionately difficult to run on windows

2021-09-01 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-09-01T21:51:51+01:00
New Revision: 06cdf48a0d94749a19b0b7075a8baf9d979bb409

URL: 
https://github.com/llvm/llvm-project/commit/06cdf48a0d94749a19b0b7075a8baf9d979bb409
DIFF: 
https://github.com/llvm/llvm-project/commit/06cdf48a0d94749a19b0b7075a8baf9d979bb409.diff

LOG: [openmp] Drop test from D109057, disproportionately difficult to run on 
windows

Added: 


Modified: 
clang/test/Driver/openmp-offload-gpu.c

Removed: 




diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index 1c7316851d15..d4e175716277 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -165,17 +165,11 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
-/// The user can also pass the path to the directory containing the bitcode lib
-// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
-// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
-// RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget{{.}}libomptarget-nvptx-sm_35.bc
+
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 370047.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  openmp/libomptarget/test/lit.cfg


Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -89,9 +89,10 @@
 config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
 if config.cuda_libdir:
 config.test_flags += " -Wl,-rpath," + config.cuda_libdir
-append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
-append_dynamic_library_path('LIBRARY_PATH', \
-config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + 
config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + 
config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,18 +1688,8 @@
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-  // Add user defined library paths from LIBRARY_PATH.
-  llvm::Optional LibPath =
-  llvm::sys::Process::GetEnv("LIBRARY_PATH");
-  if (LibPath) {
-SmallVector Frags;
-const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
-llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
-for (StringRef Path : Frags)
-  LibraryPaths.emplace_back(Path.trim());
-  }
-
-  // Add path to lib / lib64 folder.
+
+  // Add path to clang lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());


Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -89,9 +89,10 @@
 config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
 if config.cuda_libdir:
 config.test_flags += " -Wl,-rpath," + config.cuda_libdir
-append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
-append_dynamic_library_path('LIBRARY_PATH', \
-config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,18 +1688,8 @@
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-  // Add user defined library paths from LIBRARY_PATH.
-  llvm::Optional LibPath =
-  llvm::sys::Process::GetEnv("LIBRARY_PATH");
-  if (LibPath) {
-SmallVector Frags;
-const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
-llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
-for (StringRef Path : Frags)
-  LibraryPaths.emplace_back(Path.trim());
-  }
-
-  // Add path to lib / lib64 folder.
+
+  // Add path to clang lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109085: clang/win: Add __readfsdword to intrin.h

2021-09-01 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 370041.
thakis added a comment.

no-op rebase in the hope that the precommit bot doesn't run in a "git lockfile 
already held" error again


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109085/new/

https://reviews.llvm.org/D109085

Files:
  clang/lib/Headers/intrin.h
  clang/test/CodeGen/X86/ms-x86-intrinsics.c


Index: clang/test/CodeGen/X86/ms-x86-intrinsics.c
===
--- clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
+#include 
+
 #if defined(__i386__)
 char test__readfsbyte(unsigned long Offset) {
   return __readfsbyte(++Offset);
Index: clang/lib/Headers/intrin.h
===
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -97,8 +97,9 @@
 unsigned int __readdr(unsigned int);
 #ifdef __i386__
 unsigned char __readfsbyte(unsigned long);
-unsigned __int64 __readfsqword(unsigned long);
 unsigned short __readfsword(unsigned long);
+unsigned long __readfsdword(unsigned long);
+unsigned __int64 __readfsqword(unsigned long);
 #endif
 unsigned __int64 __readmsr(unsigned long);
 unsigned __int64 __readpmc(unsigned long);


Index: clang/test/CodeGen/X86/ms-x86-intrinsics.c
===
--- clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
+#include 
+
 #if defined(__i386__)
 char test__readfsbyte(unsigned long Offset) {
   return __readfsbyte(++Offset);
Index: clang/lib/Headers/intrin.h
===
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -97,8 +97,9 @@
 unsigned int __readdr(unsigned int);
 #ifdef __i386__
 unsigned char __readfsbyte(unsigned long);
-unsigned __int64 __readfsqword(unsigned long);
 unsigned short __readfsword(unsigned long);
+unsigned long __readfsdword(unsigned long);
+unsigned __int64 __readfsqword(unsigned long);
 #endif
 unsigned __int64 __readmsr(unsigned long);
 unsigned __int64 __readpmc(unsigned long);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108917: [AIX][PowerPC] Define __powerpc and __PPC macros

2021-09-01 Thread Chris Bowler via Phabricator via cfe-commits
cebowleratibm accepted this revision.
cebowleratibm added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108917/new/

https://reviews.llvm.org/D108917

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc7cbf1a03ea6: [openmp] Accept directory for 
libomptarget-bc-path (authored by JonChesterfield).

Changed prior to commit:
  https://reviews.llvm.org/D109057?vs=370006=370040#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/openmp-offload-gpu.c


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,11 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget{{.}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1709,22 +1709,26 @@
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
 
   StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx";
+  std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc";
+
   // First check whether user specifies bc library
   if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {
-std::string LibOmpTargetName(A->getValue());
-if (llvm::sys::fs::exists(LibOmpTargetName)) {
+SmallString<128> LibOmpTargetFile(A->getValue());
+if (llvm::sys::fs::exists(LibOmpTargetFile) &&
+llvm::sys::fs::is_directory(LibOmpTargetFile)) {
+  llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
+}
+
+if (llvm::sys::fs::exists(LibOmpTargetFile)) {
   CC1Args.push_back("-mlink-builtin-bitcode");
-  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetName));
+  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
 } else {
   D.Diag(diag::err_drv_omp_offload_target_bcruntime_not_found)
-  << LibOmpTargetName;
+  << LibOmpTargetFile;
 }
   } else {
 bool FoundBCLibrary = false;
 
-std::string LibOmpTargetName =
-"libomptarget-" + BitcodeSuffix.str() + ".bc";
-
 for (StringRef LibraryPath : LibraryPaths) {
   SmallString<128> LibOmpTargetFile(LibraryPath);
   llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,11 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-
+// 

[clang] c7cbf1a - [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-09-01T21:22:35+01:00
New Revision: c7cbf1a03ea6f624be54370ea7b571842bc67dda

URL: 
https://github.com/llvm/llvm-project/commit/c7cbf1a03ea6f624be54370ea7b571842bc67dda
DIFF: 
https://github.com/llvm/llvm-project/commit/c7cbf1a03ea6f624be54370ea7b571842bc67dda.diff

LOG: [openmp] Accept directory for libomptarget-bc-path

The commandline flag to specify a particular openmp devicertl library
currently errors like:
```
fatal error: cannot open file
  './runtimes/runtimes-bins/openmp/libomptarget':
  Is a directory
```
CommonArgs successfully appends the directory to the commandline args then
mlink-builtin-bitcode rejects it.

This patch is a point fix to that. If --libomptarget-amdgcn-bc-path=directory
then append the expected name for the current architecture and go on as before.
This is useful for test runners that don't hardcode the architecture.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D109057

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/openmp-offload-gpu.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 343a5d5f4cf78..7c7f4d63eca0d 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1709,22 +1709,26 @@ void tools::addOpenMPDeviceRTL(const Driver ,
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
 
   StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx";
+  std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc";
+
   // First check whether user specifies bc library
   if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {
-std::string LibOmpTargetName(A->getValue());
-if (llvm::sys::fs::exists(LibOmpTargetName)) {
+SmallString<128> LibOmpTargetFile(A->getValue());
+if (llvm::sys::fs::exists(LibOmpTargetFile) &&
+llvm::sys::fs::is_directory(LibOmpTargetFile)) {
+  llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
+}
+
+if (llvm::sys::fs::exists(LibOmpTargetFile)) {
   CC1Args.push_back("-mlink-builtin-bitcode");
-  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetName));
+  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
 } else {
   D.Diag(diag::err_drv_omp_offload_target_bcruntime_not_found)
-  << LibOmpTargetName;
+  << LibOmpTargetFile;
 }
   } else {
 bool FoundBCLibrary = false;
 
-std::string LibOmpTargetName =
-"libomptarget-" + BitcodeSuffix.str() + ".bc";
-
 for (StringRef LibraryPath : LibraryPaths) {
   SmallString<128> LibOmpTargetFile(LibraryPath);
   llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);

diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index d4e1757162771..1c7316851d153 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -165,11 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget{{.}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109085: clang/win: Add __readfsdword to intrin.h

2021-09-01 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
Herald added a subscriber: pengfei.
thakis requested review of this revision.

When using __readfsdword(), clang used to warn that one has
to include  -- no matter if that was already included
or not.

Now it only warns if it's not yet included.

To verify that this was the only intrin with this problem, I ran:

  $ for f in $(grep intrin.h clang/include/clang/Basic/BuiltinsX86* |
   egrep -o '\([^,]+,' | egrep -o '[^(,]*'); do
  if ! grep -q $f clang/lib/Headers/intrin.h; then echo $f; fi;
done

This printed 9 more functions, but those are all in emmintrin.h,
xsaveintrin.h (which are included by intrin.h based on /arch: flags).
So this is indeed the only built-in that was missing in intrin.h.

Fixes PR51188.


https://reviews.llvm.org/D109085

Files:
  clang/lib/Headers/intrin.h
  clang/test/CodeGen/X86/ms-x86-intrinsics.c


Index: clang/test/CodeGen/X86/ms-x86-intrinsics.c
===
--- clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
+#include 
+
 #if defined(__i386__)
 char test__readfsbyte(unsigned long Offset) {
   return __readfsbyte(++Offset);
Index: clang/lib/Headers/intrin.h
===
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -97,8 +97,9 @@
 unsigned int __readdr(unsigned int);
 #ifdef __i386__
 unsigned char __readfsbyte(unsigned long);
-unsigned __int64 __readfsqword(unsigned long);
 unsigned short __readfsword(unsigned long);
+unsigned long __readfsdword(unsigned long);
+unsigned __int64 __readfsqword(unsigned long);
 #endif
 unsigned __int64 __readmsr(unsigned long);
 unsigned __int64 __readpmc(unsigned long);


Index: clang/test/CodeGen/X86/ms-x86-intrinsics.c
===
--- clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
+#include 
+
 #if defined(__i386__)
 char test__readfsbyte(unsigned long Offset) {
   return __readfsbyte(++Offset);
Index: clang/lib/Headers/intrin.h
===
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -97,8 +97,9 @@
 unsigned int __readdr(unsigned int);
 #ifdef __i386__
 unsigned char __readfsbyte(unsigned long);
-unsigned __int64 __readfsqword(unsigned long);
 unsigned short __readfsword(unsigned long);
+unsigned long __readfsdword(unsigned long);
+unsigned __int64 __readfsqword(unsigned long);
 #endif
 unsigned __int64 __readmsr(unsigned long);
 unsigned __int64 __readpmc(unsigned long);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Looks reasonable. You can add a bullet point to clang/docs/ReleaseNotes.rst


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

That helps disambiguate. You aren't concerned that this change will break the 
in tree tests, rather that people who currently rely on LIBRARY_PATH to choose 
a bitcode library to use with a clang located somewhere else in the filesystem 
will now need to pass --libomptarget-nvptx-bc-path instead, or put a symlink 
relative to clang.

That is a huge win for anyone who has LIBRARY_PATH pointing to one toolchain 
and who wants to be able to use clang from another as it replaces 
(non-diagnosed) runtime misbehaviour with a compile time error about being 
unable to find the devicertl. E.g. if they've had to set LIBRARY_PATH to find 
something their application uses that is unrelated to that clang, perhaps a 
vendor toolchain.

It's also a moderate win in that it hopefully dissuades people from assuming 
that any clang can be used with any openmp offloading library, which is very 
much not true.

It breaks the use case of people who have an exactly matching clang and openmp, 
that they installed in unrelated places, and use LIBRARY_PATH to stitch back 
together because they don't have to use it for anything else. They get to use 
the commandline arguments instead.

I think that's great all around. It makes it much less likely that people will 
mismatch clang and devicertl, which is good for UX and for our bug handling. If 
we need to preserve the environment plumbing then let's have a new variable 
named for the purpose, so that it doesn't collide with LIBRARY_PATH, and still 
wire tests together with the commandline argument as it lets people copy & 
paste the failing line into a new terminal to debug it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D102449: [WIP][Clang][OpenMP] Add the support for compare clause in atomic directive

2021-09-01 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 370036.
tianshilei1992 added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102449/new/

https://reviews.llvm.org/D102449

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtOpenMP.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/atomic_compare_codegen.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

Index: llvm/include/llvm/Frontend/OpenMP/OMP.td
===
--- llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -160,6 +160,7 @@
 def OMPC_Write : Clause<"write"> { let clangClass = "OMPWriteClause"; }
 def OMPC_Update : Clause<"update"> { let clangClass = "OMPUpdateClause"; }
 def OMPC_Capture : Clause<"capture"> { let clangClass = "OMPCaptureClause"; }
+def OMPC_Compare : Clause<"compare"> { let clangClass = "OMPCompareClause"; }
 def OMPC_SeqCst : Clause<"seq_cst"> { let clangClass = "OMPSeqCstClause"; }
 def OMPC_AcqRel : Clause<"acq_rel"> { let clangClass = "OMPAcqRelClause"; }
 def OMPC_Acquire : Clause<"acquire"> { let clangClass = "OMPAcquireClause"; }
@@ -500,6 +501,7 @@
 VersionedClause,
 VersionedClause,
 VersionedClause,
+VersionedClause
   ];
   let allowedOnceClauses = [
 VersionedClause,
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2271,6 +2271,8 @@
 
 void OMPClauseEnqueue::VisitOMPCaptureClause(const OMPCaptureClause *) {}
 
+void OMPClauseEnqueue::VisitOMPCompareClause(const OMPCompareClause *) {}
+
 void OMPClauseEnqueue::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
 
 void OMPClauseEnqueue::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
Index: clang/test/OpenMP/atomic_compare_codegen.cpp
===
--- /dev/null
+++ clang/test/OpenMP/atomic_compare_codegen.cpp
@@ -0,0 +1,374 @@
+
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -target-cpu core2 -fopenmp -fopenmp-version=51 -x c -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c -triple x86_64-apple-darwin10 -target-cpu core2 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c -triple x86_64-apple-darwin10 -target-cpu core2 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -target-cpu core2 -fopenmp-simd -fopenmp-version=51 -x c -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c -triple x86_64-apple-darwin10 -target-cpu core2 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c -triple x86_64-apple-darwin10 -target-cpu core2 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
+// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
+// expected-no-diagnostics
+
+// Integral types
+char cx, ce, cd;
+unsigned char ucx, uce, ucd;
+short sx, se, sd;
+unsigned short usx, use, usd;
+int ix, ie, id;
+unsigned int uix, uie, uid;
+long lx, le, ld;
+unsigned long ulx, ule, uld;
+long long llx, lle, lld;
+unsigned long long ullx, ulle, ulld;
+
+void foo() {
+// char
+// {
+
+#pragma omp atomic compare
+  cx = ce > cx ? ce : cx;
+
+#pragma omp atomic compare
+  cx = ce < cx ? ce : cx;
+
+#pragma omp atomic compare
+  cx = cx > ce ? ce : cx;
+
+#pragma omp atomic compare
+  cx = cx < ce ? ce : cx;
+
+#pragma omp atomic compare
+  cx = cx == ce ? cd : cx;
+
+#pragma omp atomic compare
+  if (ce > cx) { cx = ce; }
+
+#pragma omp atomic compare
+  if (ce < cx) { cx = ce; }
+
+#pragma omp atomic compare
+  if (cx > ce) { cx = ce; }
+
+#pragma omp atomic compare
+  if (cx < ce) { cx = ce; }
+
+#pragma omp atomic compare
+  if (cx == ce) { cx = cd; }
+
+// }
+
+// unsigned char
+// {
+
+#pragma omp atomic compare
+  ucx = uce > ucx ? uce : ucx;
+
+#pragma omp atomic compare
+  ucx = uce < ucx ? uce : ucx;
+
+#pragma omp atomic compare
+  ucx = ucx > uce ? uce : ucx;
+
+#pragma omp atomic compare
+  ucx = ucx < uce ? uce : ucx;
+
+#pragma omp atomic compare
+  ucx = ucx == uce ? ucd : ucx;
+
+#pragma omp atomic compare
+  if (uce > ucx) { ucx = uce; }
+
+#pragma omp atomic compare
+  if (uce < ucx) { ucx = uce; }
+
+#pragma omp atomic compare
+  if (ucx > uce) { ucx = uce; }
+
+#pragma omp atomic 

[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.

In D108886#2977730 , @apivovarov 
wrote:

> @evandro @kito-cheng @kito.cheng @khchen @MaskRay Could you review this 
> patch? Thank you

You don't need to tag people as well as adding them as reviewers, it's just 
annoying. Also, it's only been four days; the developer policy is that for 
non-urgent patches you shouldn't ping more than once a week.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-01 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov added a subscriber: kito.cheng.
apivovarov added a comment.

@evandro @kito-cheng @kito.cheng @khchen @MaskRay Could you review this patch? 
Thank you


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108886/new/

https://reviews.llvm.org/D108886

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8976a1e - VFS: Document goals of 'use-external-name' and related logic, NFC

2021-09-01 Thread Duncan P . N . Exon Smith via cfe-commits

Author: Duncan P. N. Exon Smith
Date: 2021-09-01T15:55:33-04:00
New Revision: 8976a1e111393aab7b4965196364ad734a17f2d5

URL: 
https://github.com/llvm/llvm-project/commit/8976a1e111393aab7b4965196364ad734a17f2d5
DIFF: 
https://github.com/llvm/llvm-project/commit/8976a1e111393aab7b4965196364ad734a17f2d5.diff

LOG: VFS: Document goals of 'use-external-name' and related logic, NFC

Document 'use-external-name' and the various bits of logic that make it
work, to avoid others having to repeat the archival work (given that I
added getFileRefReturnsCorrectNameForDifferentStatPath to
FileManagerTest, seems possible I understood this once before!).

- b59cf679e81483cbb3a9252056b7528f4c49586c added 'use-external-name' to
  RedirectingFileSystem. This causes `stat`s to return the external
  name for a redirected file instead of the name it was accessed by,
  leaking it through the VFS.
- d066d4c849be06a01c0d17e8dc206913f4e7bfe3 propagated the external name
  further through clang::FileManager.
- 4dc5573acc0d2e7c59d8bac2543eb25cb4b32984, which added
  clang::FileEntryRef to clang::FileManager, has complicated concession
  to account for this as well (since refactored a bit).

The goal of 'use-external-name' is to enable Clang to report "real" file
paths to users (via diagnostics) and to external tools (such as
debuggers reading debug info and build systems reading `.d` files).

I've added FIXMEs to look at other channels for communicating the
external names, since the current implementation adds complexity to
FileManager and exposes an inconsistent interface to clients.

Besides that, the FileManager logic appears to be kicking in outside of
'use-external-name'. Seems that *some* vfs::FileSystem implementations
canonicalize some paths returned by `stat` in *some* cases (the bug
isn't fully understood yet). Volodymyr Sapsai is investigating, this at
least better documents what *is* understood.

Added: 


Modified: 
clang/lib/Basic/FileManager.cpp
clang/unittests/Basic/FileManagerTest.cpp
llvm/include/llvm/Support/VirtualFileSystem.h

Removed: 




diff  --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 74cd2f295be60..c4eae6acd7b04 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -276,6 +276,18 @@ FileManager::getFileRef(StringRef Filename, bool openFile, 
bool CacheFailure) {
   } else {
 // Name mismatch. We need a redirect. First grab the actual entry we want
 // to return.
+//
+// This redirection logic intentionally leaks the external name of a
+// redirected file that uses 'use-external-name' in \a
+// vfs::RedirectionFileSystem. This allows clang to report the external
+// name to users (in diagnostics) and to tools that don't have access to
+// the VFS (in debug info and dependency '.d' files).
+//
+// FIXME: This is pretty complicated. It's also inconsistent with how
+// "real" filesystems behave and confuses parts of clang expect to see the
+// name-as-accessed on the \a FileEntryRef. Maybe the returned \a
+// FileEntryRef::getName() could return the accessed name unmodified, but
+// make the external name available via a separate API.
 auto  =
 *SeenFileEntries
  .insert({Status.getName(), FileEntryRef::MapValue(UFE, DirInfo)})

diff  --git a/clang/unittests/Basic/FileManagerTest.cpp 
b/clang/unittests/Basic/FileManagerTest.cpp
index 0a1f58f3bb90d..b40ba01121f8f 100644
--- a/clang/unittests/Basic/FileManagerTest.cpp
+++ b/clang/unittests/Basic/FileManagerTest.cpp
@@ -276,9 +276,9 @@ TEST_F(FileManagerTest, 
getFileReturnsSameFileEntryForAliasedRealFiles) {
 
 TEST_F(FileManagerTest, getFileRefReturnsCorrectNameForDifferentStatPath) {
   // Inject files with the same inode, but where some files have a stat that
-  // gives a 
diff erent name. This is adding coverage for weird stat behaviour
-  // triggered by the RedirectingFileSystem that FileManager::getFileRef has
-  // special logic for.
+  // gives a 
diff erent name. This is adding coverage for stat behaviour
+  // triggered by the RedirectingFileSystem for 'use-external-name' that
+  // FileManager::getFileRef has special logic for.
   auto StatCache = std::make_unique();
   StatCache->InjectDirectory("dir", 40);
   StatCache->InjectFile("dir/f1.cpp", 41);

diff  --git a/llvm/include/llvm/Support/VirtualFileSystem.h 
b/llvm/include/llvm/Support/VirtualFileSystem.h
index 323e6719645d9..e43da9c94f355 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -596,6 +596,17 @@ class RedirectingFileSystemParser;
 /// contain multiple path components (e.g. /path/to/file). However, any
 /// directory in such a path that contains more than one child must be uniquely
 /// represented by a 'directory' entry.
+///
+/// When the 'use-external-name' field is set, 

[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

In D109061#2977714 , @JonChesterfield 
wrote:

> Using LIBRARY_PATH to find the bitcode is a reasonable interpretation of 
> LIBRARY_PATH but it's a disaster in terms of using clang on a system that has 
> LIBRARY_PATH pointing at some other version of clang. Rpath will be ignored 
> by the bitcode lib handling.
>
> How does this break under standalone? It uses the same config.variable that 
> is used for LIBRARY_PATH at the moment, so it looks in exactly the same place 
> as before this patch

OpenMP libraries don't always sit next to `clang`'s default library path. For 
standalone build, the installation path of OpenMP can be different from that of 
LLVM. Before this patch, `clang` can find the library as long as `openmp/lib` 
is in `LIBRARY_PATH`. Now it can never find it except we pass the path 
explicitly to the compilation command line. I understand your argument that 
`clang` might find a wrong one, but it's user's responsibility to make sure the 
expected version should be on the top of `LIBRARY_PATH`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106343: [OpenCL] Support cl_ext_float_atomics

2021-09-01 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D106343#2974055 , @haonanya wrote:

> Hi, svenvh and Anastasia. If you approve the patch, could you please submit 
> it?
> I don't have permission to do it.

Sure, I can commit it on your behalf, `atomic_half` can be added separately. 
Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106343/new/

https://reviews.llvm.org/D106343

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Using LIBRARY_PATH to find the bitcode is a reasonable interpretation of 
LIBRARY_PATH but it's a disaster in terms of using clang on a system that has 
LIBRARY_PATH pointing at some other version of clang. Rpath will be ignored by 
the bitcode lib handling.

How does this break under standalone? It uses the same config.variable that is 
used for LIBRARY_PATH at the moment, so it looks in exactly the same place as 
before this patch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D102449: [WIP][Clang][OpenMP] Add the support for compare clause in atomic directive

2021-09-01 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

Another thing is how we deal with a corner case. Say the OpenMP code is written 
in the following way:

  #pragma omp atomic compare
x = e < x ? e : x;

That's how OpenMP spec defines the atomic operation. `x` is always in "else 
statement" of a conditional statement.

Now we need to lower it to LLVM IR, which is `atomicrmw` operation. Based on 
the LLVM IR reference, it only supports the atomic operations that `x` is in 
the "then statement". For example: `x = x > e ? x : e`. See the `x` here is 
before `:`. In order to lower the OpenMP statement, we have to do a 
transformation. In order to swap `e` and `x`, we need to transform it to `x = e 
>= x : x : e`, a.k.a. `x = x <= e : x : e`. However, we don't have an atomic 
operation for `<=`. We only have `<`. So if `x != e`, the result is good.

The incorrectness happens if `x == e`. Recall at the OpenMP statement, when `x 
== e`, the result should be `x = x`. But if we look at our lowered LLVM IR, `x 
= x < e : x : e`, when `x == e`, it becomes `x = e`, which doesn't conform with 
OpenMP spec.

What should we do here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102449/new/

https://reviews.llvm.org/D102449

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

From my perspective, using `LIBRARY_PATH` to find bitcode library conforms with 
convention because the library is linked in a linkage during compilation time, 
where `LIBRARY_PATH` is used by the linker. If we don't want to mess up test 
results, the patch to force `rpath` should do the right thing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Bad times. Changing that to accept the / was a shotgun fix for the problem but 
it collides with one of the nearby regex, reverting while I work out what is 
going on


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6b0636c - Revert "[openmp] Accept directory for libomptarget-bc-path"

2021-09-01 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-09-01T20:45:41+01:00
New Revision: 6b0636ce535efb8649e7cd01ccd03825fd63f8a2

URL: 
https://github.com/llvm/llvm-project/commit/6b0636ce535efb8649e7cd01ccd03825fd63f8a2
DIFF: 
https://github.com/llvm/llvm-project/commit/6b0636ce535efb8649e7cd01ccd03825fd63f8a2.diff

LOG: Revert "[openmp] Accept directory for libomptarget-bc-path"

Windows separator problem. Fixing that broke another regex.
This reverts commit 0173e024fd9e779a94503040a532bcf125277f86.

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/openmp-offload-gpu.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 7c7f4d63eca0d..343a5d5f4cf78 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1709,26 +1709,22 @@ void tools::addOpenMPDeviceRTL(const Driver ,
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
 
   StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx";
-  std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc";
-
   // First check whether user specifies bc library
   if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {
-SmallString<128> LibOmpTargetFile(A->getValue());
-if (llvm::sys::fs::exists(LibOmpTargetFile) &&
-llvm::sys::fs::is_directory(LibOmpTargetFile)) {
-  llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
-}
-
-if (llvm::sys::fs::exists(LibOmpTargetFile)) {
+std::string LibOmpTargetName(A->getValue());
+if (llvm::sys::fs::exists(LibOmpTargetName)) {
   CC1Args.push_back("-mlink-builtin-bitcode");
-  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
+  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetName));
 } else {
   D.Diag(diag::err_drv_omp_offload_target_bcruntime_not_found)
-  << LibOmpTargetFile;
+  << LibOmpTargetName;
 }
   } else {
 bool FoundBCLibrary = false;
 
+std::string LibOmpTargetName =
+"libomptarget-" + BitcodeSuffix.str() + ".bc";
+
 for (StringRef LibraryPath : LibraryPaths) {
   SmallString<128> LibOmpTargetFile(LibraryPath);
   llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);

diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index 9f596a230d0ba..d4e1757162771 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -165,17 +165,11 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
-/// The user can also pass the path to the directory containing the bitcode lib
-// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
-// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
-// RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
+
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

In D109061#2977690 , @JonChesterfield 
wrote:

> Nope, works the same as it used to - looks relative to clang. However I think 
> it's broken some CI machines

Well, it also breaks when OpenMP is built standalone.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] cef1199 - Revert "[openmp] No longer use LIBRARY_PATH to find devicertl"

2021-09-01 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-09-01T20:44:12+01:00
New Revision: cef1199686475c0c63ba63ddb56f46bc7866fa3e

URL: 
https://github.com/llvm/llvm-project/commit/cef1199686475c0c63ba63ddb56f46bc7866fa3e
DIFF: 
https://github.com/llvm/llvm-project/commit/cef1199686475c0c63ba63ddb56f46bc7866fa3e.diff

LOG: Revert "[openmp] No longer use LIBRARY_PATH to find devicertl"

This reverts commit 7a228f872fbbefa6a6eba1d51da192761879fcca.
Failing test case under CI

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.cpp
openmp/libomptarget/test/lit.cfg

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index fb1aea20acc33..7c7f4d63eca0d 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,8 +1688,18 @@ void tools::addOpenMPDeviceRTL(const Driver ,
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-
-  // Add path to clang lib / lib64 folder.
+  // Add user defined library paths from LIBRARY_PATH.
+  llvm::Optional LibPath =
+  llvm::sys::Process::GetEnv("LIBRARY_PATH");
+  if (LibPath) {
+SmallVector Frags;
+const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
+llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
+for (StringRef Path : Frags)
+  LibraryPaths.emplace_back(Path.trim());
+  }
+
+  // Add path to lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());

diff  --git a/openmp/libomptarget/test/lit.cfg 
b/openmp/libomptarget/test/lit.cfg
index b47e16c4be918..d4f63dd6c6de2 100644
--- a/openmp/libomptarget/test/lit.cfg
+++ b/openmp/libomptarget/test/lit.cfg
@@ -92,10 +92,6 @@ else: # Unices
 append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
-if config.libomptarget_current_target.startswith('amdgcn'):
-config.test_flags += " --libomptarget-amdgcn-bc-path=" + 
config.library_dir
-if config.libomptarget_current_target.startswith('nvptx'):
-config.test_flags += " --libomptarget-nvptx-bc-path=" + 
config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Nope, works the same as it used to - looks relative to clang. However I think 
it's broken some CI machines


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 88511f6 - [libomptarget] Drop path separator from test to fix windows build

2021-09-01 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-09-01T20:34:58+01:00
New Revision: 88511f6bc56792b47fb6e003f5357eff3b94717a

URL: 
https://github.com/llvm/llvm-project/commit/88511f6bc56792b47fb6e003f5357eff3b94717a
DIFF: 
https://github.com/llvm/llvm-project/commit/88511f6bc56792b47fb6e003f5357eff3b94717a.diff

LOG: [libomptarget] Drop path separator from test to fix windows build

Added: 


Modified: 
clang/test/Driver/openmp-offload-gpu.c

Removed: 




diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index d30ba2595f57..9f596a230d0b 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -175,7 +175,7 @@
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_35.bc
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

In D109057#2977632 , @thakis wrote:

> This breaks tests on windows: http://45.33.8.238/win/44930/step_7.txt
>
> Please take a look and revert if it takes a while to fix. Probably just need 
> to optionally accept win slashiness in the test.

Ah, that explains the {{.*}} patterns. Will fix by dropping the 'libomptarget/' 
string as the important part is that it found the sm_35.bc in that directory


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7a228f8 - [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-09-01T20:24:34+01:00
New Revision: 7a228f872fbbefa6a6eba1d51da192761879fcca

URL: 
https://github.com/llvm/llvm-project/commit/7a228f872fbbefa6a6eba1d51da192761879fcca
DIFF: 
https://github.com/llvm/llvm-project/commit/7a228f872fbbefa6a6eba1d51da192761879fcca.diff

LOG: [openmp] No longer use LIBRARY_PATH to find devicertl

Given D109057, change test runner to use the libomptarget-x-bc-path
argument instead of the LIBRARY_PATH environment variable to find the device
library.

Also drop the use of LIBRARY_PATH environment variable as it is far
too easy to pull in the device library from an unrelated toolchain by accident
with the current setup. No loss in flexibility to developers as the clang
commandline used here is still available.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D109061

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.cpp
openmp/libomptarget/test/lit.cfg

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 7c7f4d63eca0d..fb1aea20acc33 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,18 +1688,8 @@ void tools::addOpenMPDeviceRTL(const Driver ,
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-  // Add user defined library paths from LIBRARY_PATH.
-  llvm::Optional LibPath =
-  llvm::sys::Process::GetEnv("LIBRARY_PATH");
-  if (LibPath) {
-SmallVector Frags;
-const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
-llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
-for (StringRef Path : Frags)
-  LibraryPaths.emplace_back(Path.trim());
-  }
-
-  // Add path to lib / lib64 folder.
+
+  // Add path to clang lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());

diff  --git a/openmp/libomptarget/test/lit.cfg 
b/openmp/libomptarget/test/lit.cfg
index d4f63dd6c6de2..b47e16c4be918 100644
--- a/openmp/libomptarget/test/lit.cfg
+++ b/openmp/libomptarget/test/lit.cfg
@@ -92,6 +92,10 @@ else: # Unices
 append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + 
config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + 
config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7a228f872fbb: [openmp] No longer use LIBRARY_PATH to find 
devicertl (authored by JonChesterfield).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  openmp/libomptarget/test/lit.cfg


Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -92,6 +92,10 @@
 append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + 
config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + 
config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,18 +1688,8 @@
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-  // Add user defined library paths from LIBRARY_PATH.
-  llvm::Optional LibPath =
-  llvm::sys::Process::GetEnv("LIBRARY_PATH");
-  if (LibPath) {
-SmallVector Frags;
-const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
-llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
-for (StringRef Path : Frags)
-  LibraryPaths.emplace_back(Path.trim());
-  }
-
-  // Add path to lib / lib64 folder.
+
+  // Add path to clang lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());


Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -92,6 +92,10 @@
 append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,18 +1688,8 @@
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-  // Add user defined library paths from LIBRARY_PATH.
-  llvm::Optional LibPath =
-  llvm::sys::Process::GetEnv("LIBRARY_PATH");
-  if (LibPath) {
-SmallVector Frags;
-const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
-llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
-for (StringRef Path : Frags)
-  LibraryPaths.emplace_back(Path.trim());
-  }
-
-  // Add path to lib / lib64 folder.
+
+  // Add path to clang lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

I suppose it require users to add a command line argument every time they want 
to build a program?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109061: [openmp] No longer use LIBRARY_PATH to find devicertl

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 370024.
JonChesterfield added a comment.

- rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109061/new/

https://reviews.llvm.org/D109061

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  openmp/libomptarget/test/lit.cfg


Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -92,6 +92,10 @@
 append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + 
config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + 
config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,18 +1688,8 @@
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-  // Add user defined library paths from LIBRARY_PATH.
-  llvm::Optional LibPath =
-  llvm::sys::Process::GetEnv("LIBRARY_PATH");
-  if (LibPath) {
-SmallVector Frags;
-const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
-llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
-for (StringRef Path : Frags)
-  LibraryPaths.emplace_back(Path.trim());
-  }
-
-  // Add path to lib / lib64 folder.
+
+  // Add path to clang lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());


Index: openmp/libomptarget/test/lit.cfg
===
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -92,6 +92,10 @@
 append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":")
 append_dynamic_library_path('LIBRARY_PATH', \
 config.omp_host_rtl_directory, ":")
+if config.libomptarget_current_target.startswith('amdgcn'):
+config.test_flags += " --libomptarget-amdgcn-bc-path=" + config.library_dir
+if config.libomptarget_current_target.startswith('nvptx'):
+config.test_flags += " --libomptarget-nvptx-bc-path=" + config.library_dir
 
 # substitutions
 # - for targets that exist in the system create the actual command.
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1688,18 +1688,8 @@
StringRef BitcodeSuffix,
const llvm::Triple ) {
   SmallVector LibraryPaths;
-  // Add user defined library paths from LIBRARY_PATH.
-  llvm::Optional LibPath =
-  llvm::sys::Process::GetEnv("LIBRARY_PATH");
-  if (LibPath) {
-SmallVector Frags;
-const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
-llvm::SplitString(*LibPath, Frags, EnvPathSeparatorStr);
-for (StringRef Path : Frags)
-  LibraryPaths.emplace_back(Path.trim());
-  }
-
-  // Add path to lib / lib64 folder.
+
+  // Add path to clang lib / lib64 folder.
   SmallString<256> DefaultLibPath = llvm::sys::path::parent_path(D.Dir);
   llvm::sys::path::append(DefaultLibPath, Twine("lib") + CLANG_LIBDIR_SUFFIX);
   LibraryPaths.emplace_back(DefaultLibPath.c_str());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

This breaks tests on windows: http://45.33.8.238/win/44930/step_7.txt

Please take a look and revert if it takes a while to fix. Probably just need to 
optionally accept win slashiness in the test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108818: [clang] Add a -canonical-prefixes option

2021-09-01 Thread Nico Weber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3d157cfcc4ef: [clang] Add a -canonical-prefixes option 
(authored by thakis).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108818/new/

https://reviews.llvm.org/D108818

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/no-canonical-prefixes.c
  clang/tools/driver/driver.cpp


Index: clang/tools/driver/driver.cpp
===
--- clang/tools/driver/driver.cpp
+++ clang/tools/driver/driver.cpp
@@ -416,10 +416,10 @@
 // Skip end-of-line response file markers
 if (Args[i] == nullptr)
   continue;
-if (StringRef(Args[i]) == "-no-canonical-prefixes") {
+if (StringRef(Args[i]) == "-canonical-prefixes")
+  CanonicalPrefixes = true;
+else if (StringRef(Args[i]) == "-no-canonical-prefixes")
   CanonicalPrefixes = false;
-  break;
-}
   }
 
   // Handle CL and _CL_ which permits additional command line options to be
Index: clang/test/Driver/no-canonical-prefixes.c
===
--- clang/test/Driver/no-canonical-prefixes.c
+++ clang/test/Driver/no-canonical-prefixes.c
@@ -10,8 +10,20 @@
 // RUN: rm -f %t.fake
 // RUN: ln -sf %t.real %t.fake
 // RUN: cd %t.fake
-// RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
-// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck 
--check-prefix=NON-CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: -no-canonical-prefixes \
+// RUN: | FileCheck --check-prefix=NON-CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: -no-canonical-prefixes \
+// RUN: -canonical-prefixes \
+// RUN: | FileCheck --check-prefix=CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: -no-canonical-prefixes \
+// RUN: -canonical-prefixes \
+// RUN: -no-canonical-prefixes \
+// RUN: | FileCheck --check-prefix=NON-CANONICAL %s
 //
 // FIXME: This should really be '.real'.
 // CANONICAL: InstalledDir: {{.*}}.fake
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1091,7 +1091,8 @@
   // Silence driver warnings if requested
   Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w));
 
-  // -no-canonical-prefixes is used very early in main.
+  // -canonical-prefixes, -no-canonical-prefixes are used very early in main.
+  Args.ClaimAllArgs(options::OPT_canonical_prefixes);
   Args.ClaimAllArgs(options::OPT_no_canonical_prefixes);
 
   // f(no-)integated-cc1 is also used very early in main.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -3677,8 +3677,10 @@
 def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
 def multiply__defined : Separate<["-"], "multiply_defined">;
 def mwarn_nonportable_cfstrings : Flag<["-"], "mwarn-nonportable-cfstrings">, 
Group;
+def canonical_prefixes : Flag<["-"], "canonical-prefixes">, Flags<[HelpHidden, 
CoreOption]>,
+  HelpText<"Use absolute paths for invoking subcommands (default)">;
 def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, 
Flags<[HelpHidden, CoreOption]>,
-  HelpText<"Use relative instead of canonical paths">;
+  HelpText<"Use relative paths for invoking subcommands">;
 def no_cpp_precomp : Flag<["-"], "no-cpp-precomp">, 
Group;
 def no_integrated_cpp : Flag<["-", "--"], "no-integrated-cpp">, 
Flags<[NoXarchOption]>;
 def no_pedantic : Flag<["-", "--"], "no-pedantic">, Group;


Index: clang/tools/driver/driver.cpp
===
--- clang/tools/driver/driver.cpp
+++ clang/tools/driver/driver.cpp
@@ -416,10 +416,10 @@
 // Skip end-of-line response file markers
 if (Args[i] == nullptr)
   continue;
-if (StringRef(Args[i]) == "-no-canonical-prefixes") {
+if (StringRef(Args[i]) == "-canonical-prefixes")
+  CanonicalPrefixes = true;
+else if (StringRef(Args[i]) == "-no-canonical-prefixes")
   CanonicalPrefixes = false;
-  break;
-}
   }
 
   // Handle CL and _CL_ which permits additional command line options to be
Index: clang/test/Driver/no-canonical-prefixes.c
===
--- clang/test/Driver/no-canonical-prefixes.c
+++ clang/test/Driver/no-canonical-prefixes.c
@@ -10,8 +10,20 @@
 // RUN: rm -f %t.fake
 // RUN: ln -sf %t.real %t.fake
 // RUN: cd %t.fake
-// RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
-// RUN: ./test-clang -v -S %s 

[clang] 3d157cf - [clang] Add a -canonical-prefixes option

2021-09-01 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-09-01T14:51:06-04:00
New Revision: 3d157cfcc4ef2b4e09a36d3249c960d0a4099ca7

URL: 
https://github.com/llvm/llvm-project/commit/3d157cfcc4ef2b4e09a36d3249c960d0a4099ca7
DIFF: 
https://github.com/llvm/llvm-project/commit/3d157cfcc4ef2b4e09a36d3249c960d0a4099ca7.diff

LOG: [clang] Add a -canonical-prefixes option

In https://reviews.llvm.org/D47480 I complained that there's no positive
form of this flag, so let's add one :)

https://gcc.gnu.org/PR29931 also has a pending patch to add the positive
form to gcc (but there's admittedly not a lot of movement on that bug).

This doesn't change any defaults.

Differential Revision: https://reviews.llvm.org/D108818

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp
clang/test/Driver/no-canonical-prefixes.c
clang/tools/driver/driver.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 100e07b649c87..fa94c08c74e22 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3677,8 +3677,10 @@ def multi__module : Flag<["-"], "multi_module">;
 def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
 def multiply__defined : Separate<["-"], "multiply_defined">;
 def mwarn_nonportable_cfstrings : Flag<["-"], "mwarn-nonportable-cfstrings">, 
Group;
+def canonical_prefixes : Flag<["-"], "canonical-prefixes">, Flags<[HelpHidden, 
CoreOption]>,
+  HelpText<"Use absolute paths for invoking subcommands (default)">;
 def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, 
Flags<[HelpHidden, CoreOption]>,
-  HelpText<"Use relative instead of canonical paths">;
+  HelpText<"Use relative paths for invoking subcommands">;
 def no_cpp_precomp : Flag<["-"], "no-cpp-precomp">, 
Group;
 def no_integrated_cpp : Flag<["-", "--"], "no-integrated-cpp">, 
Flags<[NoXarchOption]>;
 def no_pedantic : Flag<["-", "--"], "no-pedantic">, Group;

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 9dab045b1c9f1..82eacf27dcd7b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1091,7 +1091,8 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   // Silence driver warnings if requested
   Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w));
 
-  // -no-canonical-prefixes is used very early in main.
+  // -canonical-prefixes, -no-canonical-prefixes are used very early in main.
+  Args.ClaimAllArgs(options::OPT_canonical_prefixes);
   Args.ClaimAllArgs(options::OPT_no_canonical_prefixes);
 
   // f(no-)integated-cc1 is also used very early in main.

diff  --git a/clang/test/Driver/no-canonical-prefixes.c 
b/clang/test/Driver/no-canonical-prefixes.c
index c222dd4aa6cc7..fb54f85f959ae 100644
--- a/clang/test/Driver/no-canonical-prefixes.c
+++ b/clang/test/Driver/no-canonical-prefixes.c
@@ -10,8 +10,20 @@
 // RUN: rm -f %t.fake
 // RUN: ln -sf %t.real %t.fake
 // RUN: cd %t.fake
-// RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
-// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck 
--check-prefix=NON-CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: -no-canonical-prefixes \
+// RUN: | FileCheck --check-prefix=NON-CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: -no-canonical-prefixes \
+// RUN: -canonical-prefixes \
+// RUN: | FileCheck --check-prefix=CANONICAL %s
+// RUN: ./test-clang -v -S %s 2>&1 \
+// RUN: -no-canonical-prefixes \
+// RUN: -canonical-prefixes \
+// RUN: -no-canonical-prefixes \
+// RUN: | FileCheck --check-prefix=NON-CANONICAL %s
 //
 // FIXME: This should really be '.real'.
 // CANONICAL: InstalledDir: {{.*}}.fake

diff  --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 5a453429e79bf..2113c3d9cbaf7 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -416,10 +416,10 @@ int main(int Argc, const char **Argv) {
 // Skip end-of-line response file markers
 if (Args[i] == nullptr)
   continue;
-if (StringRef(Args[i]) == "-no-canonical-prefixes") {
+if (StringRef(Args[i]) == "-canonical-prefixes")
+  CanonicalPrefixes = true;
+else if (StringRef(Args[i]) == "-no-canonical-prefixes")
   CanonicalPrefixes = false;
-  break;
-}
   }
 
   // Handle CL and _CL_ which permits additional command line options to be



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0173e024fd9e: [openmp] Accept directory for 
libomptarget-bc-path (authored by JonChesterfield).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/openmp-offload-gpu.c


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1709,22 +1709,26 @@
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
 
   StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx";
+  std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc";
+
   // First check whether user specifies bc library
   if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {
-std::string LibOmpTargetName(A->getValue());
-if (llvm::sys::fs::exists(LibOmpTargetName)) {
+SmallString<128> LibOmpTargetFile(A->getValue());
+if (llvm::sys::fs::exists(LibOmpTargetFile) &&
+llvm::sys::fs::is_directory(LibOmpTargetFile)) {
+  llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
+}
+
+if (llvm::sys::fs::exists(LibOmpTargetFile)) {
   CC1Args.push_back("-mlink-builtin-bitcode");
-  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetName));
+  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
 } else {
   D.Diag(diag::err_drv_omp_offload_target_bcruntime_not_found)
-  << LibOmpTargetName;
+  << LibOmpTargetFile;
 }
   } else {
 bool FoundBCLibrary = false;
 
-std::string LibOmpTargetName =
-"libomptarget-" + BitcodeSuffix.str() + ".bc";
-
 for (StringRef LibraryPath : LibraryPaths) {
   SmallString<128> LibOmpTargetFile(LibraryPath);
   llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: 

[clang] 0173e02 - [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-09-01T19:46:21+01:00
New Revision: 0173e024fd9e779a94503040a532bcf125277f86

URL: 
https://github.com/llvm/llvm-project/commit/0173e024fd9e779a94503040a532bcf125277f86
DIFF: 
https://github.com/llvm/llvm-project/commit/0173e024fd9e779a94503040a532bcf125277f86.diff

LOG: [openmp] Accept directory for libomptarget-bc-path

The commandline flag to specify a particular openmp devicertl library
currently errors like:
```
fatal error: cannot open file
  './runtimes/runtimes-bins/openmp/libomptarget':
  Is a directory
```
CommonArgs successfully appends the directory to the commandline args then
mlink-builtin-bitcode rejects it.

This patch is a point fix to that. If --libomptarget-amdgcn-bc-path=directory
then append the expected name for the current architecture and go on as before.
This is useful for test runners that don't hardcode the architecture.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D109057

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/openmp-offload-gpu.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 343a5d5f4cf78..7c7f4d63eca0d 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1709,22 +1709,26 @@ void tools::addOpenMPDeviceRTL(const Driver ,
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
 
   StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx";
+  std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc";
+
   // First check whether user specifies bc library
   if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {
-std::string LibOmpTargetName(A->getValue());
-if (llvm::sys::fs::exists(LibOmpTargetName)) {
+SmallString<128> LibOmpTargetFile(A->getValue());
+if (llvm::sys::fs::exists(LibOmpTargetFile) &&
+llvm::sys::fs::is_directory(LibOmpTargetFile)) {
+  llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
+}
+
+if (llvm::sys::fs::exists(LibOmpTargetFile)) {
   CC1Args.push_back("-mlink-builtin-bitcode");
-  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetName));
+  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
 } else {
   D.Diag(diag::err_drv_omp_offload_target_bcruntime_not_found)
-  << LibOmpTargetName;
+  << LibOmpTargetFile;
 }
   } else {
 bool FoundBCLibrary = false;
 
-std::string LibOmpTargetName =
-"libomptarget-" + BitcodeSuffix.str() + ".bc";
-
 for (StringRef LibraryPath : LibraryPaths) {
   SmallString<128> LibOmpTargetFile(LibraryPath);
   llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);

diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index dafedfe70e069..d30ba2595f573 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107882: BPF: Enable frontend constant folding for VLA size

2021-09-01 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

@efriedma Thanks for suggestion! Let me look at 
CodeGenFunction::EmitAutoVarAlloca() call instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107882/new/

https://reviews.llvm.org/D107882

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107882: BPF: Enable frontend constant folding for VLA size

2021-09-01 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

I'd prefer not to mess with the AST if we don't need to; more differences 
between targets make it harder to understand any issues that come up.  
BPF-flavored C already has enough weird differences without adding unnecessary 
changes.

If all you need is to avoid unnecessary llvm.stacksave calls, can you try 
messing with CodeGenFunction::EmitAutoVarAlloca?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107882/new/

https://reviews.llvm.org/D107882

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108360: [clang][NFC] Remove dead code

2021-09-01 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108360/new/

https://reviews.llvm.org/D108360

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108360: [clang][NFC] Remove dead code

2021-09-01 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D108360#2962010 , @wingo wrote:

> @Anastasia is this good to go for you or does this need closer attention?

Yeah I agree that this code seems like a left-over from some refactoring as it 
seems to have no effect.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108360/new/

https://reviews.llvm.org/D108360

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109078: [clang][driver][AIX] Add system libc++ header paths to driver

2021-09-01 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, stevewan, ZarkoCA.
daltenty requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This change adds the system libc++ header location to the driver. As well we 
define
the __LIBC_NO_CPP_MATH_OVERLOADS__ when using those headers, in order to 
suppress
conflicting C++ overloads in the system libc headers that were used by XL C++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109078

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-ld.c
  clang/test/Driver/aix-toolchain-include.cpp

Index: clang/test/Driver/aix-toolchain-include.cpp
===
--- clang/test/Driver/aix-toolchain-include.cpp
+++ clang/test/Driver/aix-toolchain-include.cpp
@@ -5,13 +5,13 @@
 // RUN:		-target powerpc-ibm-aix \
 // RUN:		-resource-dir=%S/Inputs/resource_dir \
 // RUN:		--sysroot=%S/Inputs/basic_aix_tree \
-// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+// RUN:   | FileCheck -check-prefixes=CHECK-INTERNAL-INCLUDE,CHECK-INTERNAL-INCLUDE-CXX %s
 
 // RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
 // RUN:		-target powerpc64-ibm-aix \
 // RUN:		-resource-dir=%S/Inputs/resource_dir \
 // RUN:		--sysroot=%S/Inputs/basic_aix_tree \
-// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+// RUN:   | FileCheck -check-prefixes=CHECK-INTERNAL-INCLUDE,CHECK-INTERNAL-INCLUDE-CXX %s
 
 // RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
 // RUN:		-target powerpc-ibm-aix \
@@ -25,11 +25,13 @@
 // RUN:		--sysroot=%S/Inputs/basic_aix_tree \
 // RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
 
-// CHECK-INTERNAL-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
-// CHECK-INTERNAL-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK-INTERNAL-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
-// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
-// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[SYSROOT]]/usr/include"
+// CHECK-INTERNAL-INCLUDE:  {{.*}}clang{{.*}}" "-cc1"
+// CHECK-INTERNAL-INCLUDE:  "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:  "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE-CXX:  "-internal-isystem" "[[SYSROOT]]/opt/IBM/openxlCSDK/include/c++/v1"
+// CHECK-INTERNAL-INCLUDE-CXX:  "-D__LIBC_NO_CPP_MATH_OVERLOADS__"
+// CHECK-INTERNAL-INCLUDE:  "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-INTERNAL-INCLUDE:  "-internal-isystem" "[[SYSROOT]]/usr/include"
 
 // Check powerpc-ibm-aix, 32-bit/64-bit. -nostdinc option.
 // RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
@@ -98,6 +100,8 @@
 // CHECK-NOSTDLIBINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-NOSTDLIBINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-NOSTDLIBINC-INCLUDE:	"-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-NOSTDLIBINC-INCLUDE-NOT:  "-internal-isystem" "[[SYSROOT]]/opt/IBM/openxlCSDK/include/c++/v1"
+// CHECK-NOSTDLIBINC-INCLUDE-NOT:  "-D__LIBC_NO_CPP_MATH_OVERLOADS__"
 // CHECK-NOSTDLIBINC-INCLUDE-NOT:	"-internal-isystem" "[[SYSROOT]]/usr/include"
 
 // Check powerpc-ibm-aix, 32-bit/64-bit. -nobuiltininc option.
@@ -106,14 +110,14 @@
 // RUN:		-resource-dir=%S/Inputs/resource_dir \
 // RUN:		--sysroot=%S/Inputs/basic_aix_tree \
 // RUN:		-nobuiltininc \
-// RUN:   | FileCheck -check-prefix=CHECK-NOBUILTININC-INCLUDE %s
+// RUN:   | FileCheck -check-prefixes=CHECK-NOBUILTININC-INCLUDE,CHECK-NOBUILTININC-INCLUDE-CXX %s
 
 // RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
 // RUN:		-target powerpc64-ibm-aix \
 // RUN:		-resource-dir=%S/Inputs/resource_dir \
 // RUN:		--sysroot=%S/Inputs/basic_aix_tree \
 // RUN:		-nobuiltininc \
-// RUN:   | FileCheck -check-prefix=CHECK-NOBUILTININC-INCLUDE %s
+// RUN:   | FileCheck -check-prefixes=CHECK-NOBUILTININC-INCLUDE,CHECK-NOBUILTININC-INCLUDE-CXX  %s
 
 // RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
 // RUN:		-target powerpc-ibm-aix \
@@ -133,4 +137,45 @@
 // CHECK-NOBUILTININC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-NOBUILTININC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-NOBUILTININC-INCLUDE-NOT:	"-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-NOBUILTININC-INCLUDE-CXX:  "-internal-isystem" "[[SYSROOT]]/opt/IBM/openxlCSDK/include/c++/v1"
+// CHECK-NOBUILTININC-INCLUDE-CXX:  "-D__LIBC_NO_CPP_MATH_OVERLOADS__"
 // CHECK-NOBUILTININC-INCLUDE:	"-internal-isystem" "[[SYSROOT]]/usr/include"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdinc++ option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:  -target powerpc-ibm-aix \
+// RUN:  -resource-dir=%S/Inputs/resource_dir \
+// RUN:  --sysroot=%S/Inputs/basic_aix_tree \
+// RUN:  -nostdinc++ \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINCXX-INCLUDE %s
+

[PATCH] D108470: [OpenCL] Fix as_type3 invalid store creation

2021-09-01 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108470/new/

https://reviews.llvm.org/D108470

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108761: [OpenCL] Remove decls for scalar vloada_half and vstorea_half* fns

2021-09-01 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108761/new/

https://reviews.llvm.org/D108761

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108917: [AIX][PowerPC] Define __powerpc and __PPC macros

2021-09-01 Thread Jake Egan via Phabricator via cfe-commits
Jake-Egan updated this revision to Diff 369992.
Jake-Egan added a comment.

Add negative test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108917/new/

https://reviews.llvm.org/D108917

Files:
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/Preprocessor/init-ppc.c


Index: clang/test/Preprocessor/init-ppc.c
===
--- clang/test/Preprocessor/init-ppc.c
+++ clang/test/Preprocessor/init-ppc.c
@@ -320,6 +320,7 @@
 // PPC:#define __NATURAL_ALIGNMENT__ 1
 // PPC:#define __POINTER_WIDTH__ 32
 // PPC:#define __POWERPC__ 1
+// PPC-NOT:#define __PPC 1
 // PPC:#define __PPC__ 1
 // PPC:#define __PTRDIFF_TYPE__ long int
 // PPC:#define __PTRDIFF_WIDTH__ 32
@@ -384,6 +385,7 @@
 // PPC:#define __WCHAR_WIDTH__ 32
 // PPC:#define __WINT_TYPE__ int
 // PPC:#define __WINT_WIDTH__ 32
+// PPC-NOT:#define __powerpc 1
 // PPC:#define __ppc__ 1
 
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 
-fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix 
PPC-AIX %s
@@ -517,6 +519,7 @@
 // PPC-AIX-NOT:#define __NATURAL_ALIGNMENT__ 1
 // PPC-AIX:#define __POINTER_WIDTH__ 32
 // PPC-AIX:#define __POWERPC__ 1
+// PPC-AIX:#define __PPC 1
 // PPC-AIX:#define __PPC__ 1
 // PPC-AIX:#define __PTRDIFF_TYPE__ long int
 // PPC-AIX:#define __PTRDIFF_WIDTH__ 32
@@ -584,6 +587,7 @@
 // PPC-AIX:#define __WCHAR_WIDTH__ 16
 // PPC-AIX:#define __WINT_TYPE__ int
 // PPC-AIX:#define __WINT_WIDTH__ 32
+// PPC-AIX:#define __powerpc 1
 // PPC-AIX:#define __powerpc__ 1
 // PPC-AIX:#define __ppc__ 1
 
Index: clang/lib/Basic/Targets/PPC.cpp
===
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -264,6 +264,9 @@
   }
   if (getTriple().isOSAIX()) {
 Builder.defineMacro("__THW_PPC__");
+// Define __PPC and __powerpc for AIX XL C/C++ compatibility
+Builder.defineMacro("__PPC");
+Builder.defineMacro("__powerpc");
   }
 
   // Target properties.


Index: clang/test/Preprocessor/init-ppc.c
===
--- clang/test/Preprocessor/init-ppc.c
+++ clang/test/Preprocessor/init-ppc.c
@@ -320,6 +320,7 @@
 // PPC:#define __NATURAL_ALIGNMENT__ 1
 // PPC:#define __POINTER_WIDTH__ 32
 // PPC:#define __POWERPC__ 1
+// PPC-NOT:#define __PPC 1
 // PPC:#define __PPC__ 1
 // PPC:#define __PTRDIFF_TYPE__ long int
 // PPC:#define __PTRDIFF_WIDTH__ 32
@@ -384,6 +385,7 @@
 // PPC:#define __WCHAR_WIDTH__ 32
 // PPC:#define __WINT_TYPE__ int
 // PPC:#define __WINT_WIDTH__ 32
+// PPC-NOT:#define __powerpc 1
 // PPC:#define __ppc__ 1
 
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX %s
@@ -517,6 +519,7 @@
 // PPC-AIX-NOT:#define __NATURAL_ALIGNMENT__ 1
 // PPC-AIX:#define __POINTER_WIDTH__ 32
 // PPC-AIX:#define __POWERPC__ 1
+// PPC-AIX:#define __PPC 1
 // PPC-AIX:#define __PPC__ 1
 // PPC-AIX:#define __PTRDIFF_TYPE__ long int
 // PPC-AIX:#define __PTRDIFF_WIDTH__ 32
@@ -584,6 +587,7 @@
 // PPC-AIX:#define __WCHAR_WIDTH__ 16
 // PPC-AIX:#define __WINT_TYPE__ int
 // PPC-AIX:#define __WINT_WIDTH__ 32
+// PPC-AIX:#define __powerpc 1
 // PPC-AIX:#define __powerpc__ 1
 // PPC-AIX:#define __ppc__ 1
 
Index: clang/lib/Basic/Targets/PPC.cpp
===
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -264,6 +264,9 @@
   }
   if (getTriple().isOSAIX()) {
 Builder.defineMacro("__THW_PPC__");
+// Define __PPC and __powerpc for AIX XL C/C++ compatibility
+Builder.defineMacro("__PPC");
+Builder.defineMacro("__powerpc");
   }
 
   // Target properties.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D102531: PR45881: Properly use CXXThisOverride for templated lambda

2021-09-01 Thread Gulfem Savrun Yeniceri via Phabricator via cfe-commits
gulfem added a comment.

@aaron.ballman would it be possible for you to review this patch, so we can fix 
our broken builds?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102531/new/

https://reviews.llvm.org/D102531

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D102531: PR45881: Properly use CXXThisOverride for templated lambda

2021-09-01 Thread Gulfem Savrun Yeniceri via Phabricator via cfe-commits
gulfem added a comment.

We recently enabled assertions in our Fuchsia builds, and our builds started to 
fail:

  FAILED: obj/src/lib/storage/vfs/cpp/libcpp.fuchsia_vfs.cc.o
  ../../../recipe_cleanup/clangLhcV7J/bin/clang++ -MD -MF 
obj/src/lib/storage/vfs/cpp/libcpp.fuchsia_vfs.cc.o.d 
-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS 
-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -…
  clang++: clang/lib/Sema/SemaExprCXX.cpp:1144: clang::QualType 
adjustCVQualifiersForCXXThisWithinLambda(ArrayRef, clang::QualType, clang::DeclContext *, clang::ASTC…
  clang++: error: clang frontend command failed with exit code 134 (use -v to 
see invocation)

https://luci-milo.appspot.com/ui/p/fuchsia/builders/ci/clang_toolchain.core.x64-debug/b8837288282633988801/overview

This patch seems to be fixing the issue that we are running.
Is there a way to speed up the process in this review, so our broken builds can 
be fixed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102531/new/

https://reviews.llvm.org/D102531

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D104386: [PowerPC][Builtins] Added a number of builtins for compatibility with XL.

2021-09-01 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment.

The idea with putting all of these in a separate function was to:

1. Make it easy to limit it to specific targets as I suggested above
2. Have them all in one place to easily identify which ones are added for this 
compatibility so we can eventually pull this support once they are no longer 
needed
3. Just kind of isolate this to keep it out of the way

I really think the best way forward might be to limit this to Linux and AIX. I 
don't think IBM provided XLC/C++ on FreeBSD.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104386/new/

https://reviews.llvm.org/D104386

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108461: [OpenCL] Supports optional generic address space sematics in C++ for OpenCL 2021

2021-09-01 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks




Comment at: clang/lib/Basic/TargetInfo.cpp:413
   OpenCLFeaturesMap, "__opencl_c_generic_address_space");
-  Opts.OpenCLPipes =
-  hasFeatureEnabled(OpenCLFeaturesMap, "__opencl_c_pipes");
+  if (Opts.OpenCLVersion == 300)
+Opts.OpenCLPipes =

Ok, I am guessing this will be changed back to one check later on?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108461/new/

https://reviews.llvm.org/D108461

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109002: [OpenCL] Supports optional image types in C++ for OpenCL 2021

2021-09-01 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: clang/lib/Sema/SemaType.cpp:1729
 bool IsOpenCLC30 = (S.getLangOpts().OpenCLVersion == 300);
+bool IsOpenCLC30Comp = S.getLangOpts().getOpenCLCompatibleVersion() == 300;
 // OpenCL C v3.0 s6.3.3 - OpenCL image types require __opencl_c_images

Topotuna wrote:
> Anastasia wrote:
> > I think we should just replace `IsOpenCLC30` as it is when only used in the 
> > diagnostic that we should report the same as for OpenCL 3.0.
> > 
> > 
> > Also I would suggest changing name to `IsOpenCLC30Compatible` to make it 
> > clearer. 
> That diagnostic is responsible for `__opencl_c_3d_image_writes` feature while 
> current commit addresses `__opencl_c_images`. I wanted to keep commits 
> separate and was planning to finish transitioning from `IsOpenCLC30` to 
> `IsOpenCLC30Compatible` in a future commit.
> 
> I agree that `IsOpenCLC30Compatible` would be clearer. Thank you.
Ok, let's just only rename it for now and add a FIXME comment explaining that 
the variables should be unified later on.

I suspect your subsequent commits would include the unification?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109002/new/

https://reviews.llvm.org/D109002

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

OK, test added, same code as originally, checked that the test fails on trunk. 
Because it's driver only we don't get a far as the fatal error, but you can see 
the driver passing the directory through to builtin-bitcode. Will land when the 
premerge checks catch up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 369972.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/openmp-offload-gpu.c


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1709,22 +1709,26 @@
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
 
   StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx";
+  std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc";
+
   // First check whether user specifies bc library
   if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {
-std::string LibOmpTargetName(A->getValue());
-if (llvm::sys::fs::exists(LibOmpTargetName)) {
+SmallString<128> LibOmpTargetFile(A->getValue());
+if (llvm::sys::fs::exists(LibOmpTargetFile) &&
+llvm::sys::fs::is_directory(LibOmpTargetFile)) {
+  llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
+}
+
+if (llvm::sys::fs::exists(LibOmpTargetFile)) {
   CC1Args.push_back("-mlink-builtin-bitcode");
-  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetName));
+  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
 } else {
   D.Diag(diag::err_drv_omp_offload_target_bcruntime_not_found)
-  << LibOmpTargetName;
+  << LibOmpTargetFile;
 }
   } else {
 bool FoundBCLibrary = false;
 
-std::string LibOmpTargetName =
-"libomptarget-" + BitcodeSuffix.str() + ".bc";
-
 for (StringRef LibraryPath : LibraryPaths) {
   SmallString<128> LibOmpTargetFile(LibraryPath);
   llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// 

[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 369971.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/openmp-offload-gpu.c


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_50 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_50.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1709,22 +1709,26 @@
 : options::OPT_libomptarget_nvptx_bc_path_EQ;
 
   StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx";
+  std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc";
+
   // First check whether user specifies bc library
   if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {
-std::string LibOmpTargetName(A->getValue());
-if (llvm::sys::fs::exists(LibOmpTargetName)) {
+SmallString<128> LibOmpTargetFile(A->getValue());
+if (llvm::sys::fs::exists(LibOmpTargetFile) &&
+llvm::sys::fs::is_directory(LibOmpTargetFile)) {
+  llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
+}
+
+if (llvm::sys::fs::exists(LibOmpTargetFile)) {
   CC1Args.push_back("-mlink-builtin-bitcode");
-  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetName));
+  CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
 } else {
   D.Diag(diag::err_drv_omp_offload_target_bcruntime_not_found)
-  << LibOmpTargetName;
+  << LibOmpTargetFile;
 }
   } else {
 bool FoundBCLibrary = false;
 
-std::string LibOmpTargetName =
-"libomptarget-" + BitcodeSuffix.str() + ".bc";
-
 for (StringRef LibraryPath : LibraryPaths) {
   SmallString<128> LibOmpTargetFile(LibraryPath);
   llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_50 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_50.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// 

[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Well, that's not helpful. Managed to add a test through the webui as arcanist 
was misbehaving but it has worked by deleting the functional change. Will try 
again


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 369969.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

Files:
  clang/test/Driver/openmp-offload-gpu.c


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_50 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: 
clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_50.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -165,10 +165,17 @@
 // RUN:   -Xopenmp-target -march=sm_35 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
+/// The user can also pass the path to the directory containing the bitcode lib
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget \
+// RUN:   -Xopenmp-target -march=sm_50 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER-DIR %s
 
 // CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_35.bc
 // CHK-BCLIB-NEW: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-new-nvptx-sm_35.bc
 // CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-USER-DIR: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget/libomptarget-nvptx-sm_50.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108421: Mark openmp internal global dso_local

2021-09-01 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay requested changes to this revision.
MaskRay added a comment.
This revision now requires changes to proceed.

In D108421#2977107 , @kamleshbhalui 
wrote:

> In D108421#2958848 , @MaskRay wrote:
>
>> If you read the comment in TargetMachine::shouldAssumeDSOLocal: this is the 
>> wrong direction. dso_local is assumed to be marked by the frontend.
>>
>> Direct accesses and GOT accesses are trade-offs. Direct accesses are not 
>> always preferred. The MachO special case is an unfortunate case for their 
>> xnu kernel, not a good example here.
>
> @MaskRay I would like to know more about these trade-offs details, any 
> supporting documents will do.
> Considering below testcase, can you shed some light how code generated by 
> llc-12 is better than llc-11 for given testcase?
> https://godbolt.org/z/x9xojWb58

This is a very minor issue. First, global variable access is rarely a 
performance bottleneck.
Second, if the symbol turns out to be non-preemptible (which implies that it is 
defined in the component), the R_X86_64_REX_GOTPCRELX GOT indirection can be 
optimized out.
The only minor issue is slightly longer code sequence.

> And FYI this testcase does not work when build as Linux Kernel Module. LKM 
> loader throw error("Unknown rela relocation: 42")?

This is a kernel issue. Please mention the justification (is it related to 
OpenMP?) in the first place.
The kernel can be compiled in -fpie mode. In this mode, taking the address of a 
default-visibility undefined symbol uses R_X86_64_REX_GOTPCRELX.
So the kernel should support R_X86_64_REX_GOTPCRELX anyway.

---

If we think the optimization is meaningful:

Depending on the property of `.gomp_critical_user_.atomic_reduction.var` 
different DSOLocal strategies should be used.
If it is TU-local, make it local linkage. If it is linked image local, make it 
hidden visibility.
If it may be defined in a shared object and shared with other shared objects or 
the main executable, (not so sure because such symbol interposition does not 
work in other binary formats), use dso_preemptable as is.

I believe the current forced dso_local is definitely incorrect because it may 
break `-fpic -shared` links.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108421/new/

https://reviews.llvm.org/D108421

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106809: [clang-offload-bundler] Make Bundle Entry ID backward compatible

2021-09-01 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam added a comment.

Ping.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106809/new/

https://reviews.llvm.org/D106809

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

In D109057#2977084 , @jdoerfert wrote:

> LG, but please add a test for this.

D109061  sends everything in check-openmp 
down this code path, but we should indeed have a check for the file and for the 
dir version. Will take a look


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108421: Mark openmp internal global dso_local

2021-09-01 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui added a comment.

In D108421#2958848 , @MaskRay wrote:

> If you read the comment in TargetMachine::shouldAssumeDSOLocal: this is the 
> wrong direction. dso_local is assumed to be marked by the frontend.
>
> Direct accesses and GOT accesses are trade-offs. Direct accesses are not 
> always preferred. The MachO special case is an unfortunate case for their xnu 
> kernel, not a good example here.

@MaskRay I would like to know more about these trade-offs details, any 
supporting documents will do.
Considering below testcase, can you shed some light how code generated by 
llc-12 is better than llc-11 for given testcase?
https://godbolt.org/z/x9xojWb58
And FYI this testcase does not work when build as Linux Kernel Module. LKM 
loader throw error("Unknown rela relocation: 42")?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108421/new/

https://reviews.llvm.org/D108421

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108917: [AIX][PowerPC] Define __powerpc and __PPC macros

2021-09-01 Thread Chris Bowler via Phabricator via cfe-commits
cebowleratibm requested changes to this revision.
cebowleratibm added inline comments.
This revision now requires changes to proceed.



Comment at: clang/test/Preprocessor/init-ppc.c:520
 // PPC-AIX:#define __POWERPC__ 1
+// PPC-AIX:#define __PPC 1
 // PPC-AIX:#define __PPC__ 1

I suggest adding the negative test for the non AIX target for both __PPC 
and__powerpc


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108917/new/

https://reviews.llvm.org/D108917

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109057: [openmp] Accept directory for libomptarget-bc-path

2021-09-01 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LG, but please add a test for this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109057/new/

https://reviews.llvm.org/D109057

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >