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

2021-03-12 Thread Jonathan Wakely via Phabricator via cfe-commits
jwakely added inline comments.



Comment at: clang/lib/Parse/ParseExprCXX.cpp:2245
+  case tok::kw___ibm128:
+DS.SetTypeSpecType(DeclSpec::TST_ibm128, Loc, PrevSpec, DiagID, Policy);
+break;

hubert.reinterpretcast wrote:
> qiucf wrote:
> > hubert.reinterpretcast wrote:
> > > qiucf wrote:
> > > > hubert.reinterpretcast wrote:
> > > > > Not sure what the best method is to implement this, but `long double` 
> > > > > and `__ibm128` are the same type for GCC when `-mabi=ibmlongdouble` 
> > > > > is in effect.
> > > > Seems clang is also different from GCC under `-mabi=ieeelongdouble`? I 
> > > > saw `__float128` and `long double` are the same for GCC but not for 
> > > > clang.
> > > Have you checked whether the new libstdc++ for which this support is 
> > > being added needs the GCC behaviour to work properly?
> > > 
> > > The GCC behaviour allows the following to be compiled without introducing 
> > > novel overload resolution tiebreakers:
> > > ```
> > > void f(__float128);
> > > void f(__ibm128);
> > > void f(int);
> > > 
> > > long double ld;
> > > 
> > > int main() { f(ld); }
> > > ```
> > As I saw both GCC and clang have error for ambiguous `operator<<` for:
> > 
> > ```
> > std::cout << "long double:\n";
> > std::cout << std::numeric_limits::max() << std::endl;
> > std::cout << std::numeric_limits::min() << std::endl;
> > 
> > std::cout << "__float128:\n";
> > std::cout << std::numeric_limits<__float128>::max() << std::endl;
> > std::cout << std::numeric_limits<__float128>::min() << std::endl;
> > 
> > std::cout << "__ibm128:\n";
> > std::cout << std::numeric_limits<__ibm128>::max() << std::endl;
> > std::cout << std::numeric_limits<__ibm128>::min() << std::endl;
> > ```
> @jwakely, are the overload resolution errors expected? @qiucf, are you sure 
> you have a sufficiently new libstdc++?
> @jwakely, are the overload resolution errors expected? 

Yes. Iostreams support `long double` but not `__float128`, unless that happens 
to be the same type as `long double` (due to a `-mabi=ieeelongdouble` option).


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


LLVM build master will be restarted soon

2021-03-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be restarted in the nearest hour.

Thanks

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


[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-03-12 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment.

@NoQ, sorry for the absurdly dumb mistake. Not entirely sure what I was 
thinking.
Can you please have a look at it now?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97183

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


[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-03-12 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 330422.
RedDocMD added a comment.

Removed an embarassingly dumb mistake


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97183

Files:
  clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp


Index: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
@@ -464,7 +464,7 @@
 if (() != smartptr::getNullDereferenceBugType() ||
 !BR.isInteresting(ThisRegion))
   return;
-if (!State->assume(InnerPointerVal.castAs(), true))
+if (!BR.isInteresting(InnerPointerVal) || 
!BR.isInteresting(InnerPointerVal.getAsSymbol()))
   return;
 if (ThisRegion->canPrintPretty()) {
   OS << "Obtained null inner pointer from";
Index: clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp
@@ -87,6 +87,8 @@
   auto R = std::make_unique(NullDereferenceBugType,
 OS.str(), ErrNode);
   R->markInteresting(DerefRegion);
+  const Expr *BugExpr = Call.getOriginExpr();
+  bugreporter::trackExpressionValue(ErrNode, BugExpr, *R);
   C.emitReport(std::move(R));
 }
 


Index: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
@@ -464,7 +464,7 @@
 if (() != smartptr::getNullDereferenceBugType() ||
 !BR.isInteresting(ThisRegion))
   return;
-if (!State->assume(InnerPointerVal.castAs(), true))
+if (!BR.isInteresting(InnerPointerVal) || !BR.isInteresting(InnerPointerVal.getAsSymbol()))
   return;
 if (ThisRegion->canPrintPretty()) {
   OS << "Obtained null inner pointer from";
Index: clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp
@@ -87,6 +87,8 @@
   auto R = std::make_unique(NullDereferenceBugType,
 OS.str(), ErrNode);
   R->markInteresting(DerefRegion);
+  const Expr *BugExpr = Call.getOriginExpr();
+  bugreporter::trackExpressionValue(ErrNode, BugExpr, *R);
   C.emitReport(std::move(R));
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98504: [clang][Checkers] Fix PthreadLockChecker state cleanup at dead symbol.

2021-03-12 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Hmm this probably even deserves a warning? Like, the mutex goes out of scope 
but we don't know whether we've successfully destroyed it? Even if we perform 
the check later, we can't do anything about it anymore? (not sure how bad it is 
in practice)




Comment at: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:290-304
   // Existence in DestroyRetVal ensures existence in LockMap.
   // Existence in Destroyed also ensures that the lock state for lockR is 
either
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
   assert(lstate->isUntouchedAndPossiblyDestroyed() ||
  lstate->isUnlockedAndPossiblyDestroyed());
 
   ConstraintManager  = state->getConstraintManager();

ASDenysPetrov wrote:
> I'm just wondering, did you think about such way of fixing?
This involves keeping dead regions in the program state. I'd be pretty worried 
about it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98504

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


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

2021-03-12 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/lib/Parse/ParseExprCXX.cpp:2245
+  case tok::kw___ibm128:
+DS.SetTypeSpecType(DeclSpec::TST_ibm128, Loc, PrevSpec, DiagID, Policy);
+break;

qiucf wrote:
> hubert.reinterpretcast wrote:
> > qiucf wrote:
> > > hubert.reinterpretcast wrote:
> > > > Not sure what the best method is to implement this, but `long double` 
> > > > and `__ibm128` are the same type for GCC when `-mabi=ibmlongdouble` is 
> > > > in effect.
> > > Seems clang is also different from GCC under `-mabi=ieeelongdouble`? I 
> > > saw `__float128` and `long double` are the same for GCC but not for clang.
> > Have you checked whether the new libstdc++ for which this support is being 
> > added needs the GCC behaviour to work properly?
> > 
> > The GCC behaviour allows the following to be compiled without introducing 
> > novel overload resolution tiebreakers:
> > ```
> > void f(__float128);
> > void f(__ibm128);
> > void f(int);
> > 
> > long double ld;
> > 
> > int main() { f(ld); }
> > ```
> As I saw both GCC and clang have error for ambiguous `operator<<` for:
> 
> ```
> std::cout << "long double:\n";
> std::cout << std::numeric_limits::max() << std::endl;
> std::cout << std::numeric_limits::min() << std::endl;
> 
> std::cout << "__float128:\n";
> std::cout << std::numeric_limits<__float128>::max() << std::endl;
> std::cout << std::numeric_limits<__float128>::min() << std::endl;
> 
> std::cout << "__ibm128:\n";
> std::cout << std::numeric_limits<__ibm128>::max() << std::endl;
> std::cout << std::numeric_limits<__ibm128>::min() << std::endl;
> ```
@jwakely, are the overload resolution errors expected? @qiucf, are you sure you 
have a sufficiently new libstdc++?


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] D98554: Save strings for CC_PRINT env vars

2021-03-12 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/include/clang/Driver/Driver.h:160
   /// The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled.
-  const char *CCPrintStatReportFilename;
+  std::string CCPrintStatReportFilename;
 

I'm seeing code left unchanged like:
```
TheDriver.CCPrintOptionsFilename = ::getenv("CC_PRINT_OPTIONS_FILE");
```

Assigning to a `std::string` from a null `char *` is known to cause things like
```
Segmentation fault
```




Comment at: clang/lib/Driver/Compilation.cpp:173
 // output stream.
-if (getDriver().CCPrintOptions && getDriver().CCPrintOptionsFilename) {
+if (getDriver().CCPrintOptions && 
!getDriver().CCPrintOptionsFilename.empty()) {
   std::error_code EC;

Please update for the clang-format suggestions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98554

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread 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 rG0bf2da53c12b: [NFC] Adjust SmallVector.h header to 
workaround XL build compiler issue (authored by xling-Liao 
xiangling.l...@ibm.com).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

Files:
  clang/include/clang/Basic/LLVM.h
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -663,7 +663,7 @@
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector GeneratedArgs1;
+  SmallVector GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector GeneratedArgs2;
+  SmallVector GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1913,7 +1913,7 @@
 emitCapturedStmtCall(CodeGenFunction , EmittedClosureTy Cap,
  llvm::ArrayRef Args) {
   // Append the closure context to the argument.
-  llvm::SmallVector EffectiveArgs;
+  SmallVector EffectiveArgs;
   EffectiveArgs.reserve(Args.size() + 1);
   llvm::append_range(EffectiveArgs, Args);
   EffectiveArgs.push_back(Cap.second);
Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,9 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to prevent `too few template arguments for
+// class template 'SmallVector'` building error with build compilers like XL.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.


Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -663,7 +663,7 @@
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector GeneratedArgs1;
+  SmallVector GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector GeneratedArgs2;
+  SmallVector GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1913,7 +1913,7 @@
 emitCapturedStmtCall(CodeGenFunction , EmittedClosureTy Cap,
  llvm::ArrayRef Args) {
   // Append the closure context to the argument.
-  llvm::SmallVector EffectiveArgs;
+  SmallVector EffectiveArgs;
   EffectiveArgs.reserve(Args.size() + 1);
   llvm::append_range(EffectiveArgs, Args);
   EffectiveArgs.push_back(Cap.second);
Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,9 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to prevent `too few template arguments for
+// class template 'SmallVector'` building error with build compilers like XL.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 0bf2da5 - [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread via cfe-commits

Author: xling-Liao
Date: 2021-03-12T21:41:36-06:00
New Revision: 0bf2da53c12b3d2bf213f667af74059280a0d661

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

LOG: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

In order to prevent further building issues related to the usage of SmallVector
in other compilation unit, this patch adjusts the llvm.h header as a workaround
instead.

Besides, this patch reverts previous workarounds:

1. Revert "[NFC] Use llvm::SmallVector to workaround XL compiler problem on AIX"
This reverts commit 561fb7f60ab631e712c3fb6bbeb47061222c6818.

2.Revert "[clang][cli] Fix build failure in CompilerInvocation"
This reverts commit 8dc70bdcd0fe4efb65876dce0144d9c3386a2f07.

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

Added: 


Modified: 
clang/include/clang/Basic/LLVM.h
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/LLVM.h 
b/clang/include/clang/Basic/LLVM.h
index 02e422051071..4ac2d744af3c 100644
--- a/clang/include/clang/Basic/LLVM.h
+++ b/clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,9 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to prevent `too few template arguments for
+// class template 'SmallVector'` building error with build compilers like XL.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.

diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 575d1143caab..2eaa481cd911 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1913,7 +1913,7 @@ static llvm::CallInst *
 emitCapturedStmtCall(CodeGenFunction , EmittedClosureTy Cap,
  llvm::ArrayRef Args) {
   // Append the closure context to the argument.
-  llvm::SmallVector EffectiveArgs;
+  SmallVector EffectiveArgs;
   EffectiveArgs.reserve(Args.size() + 1);
   llvm::append_range(EffectiveArgs, Args);
   EffectiveArgs.push_back(Cap.second);

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 2606e9f1b185..5ddd54cf2bc6 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -663,7 +663,7 @@ static bool RoundTrip(ParseFn Parse, GenerateFn Generate,
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector GeneratedArgs1;
+  SmallVector GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@ static bool RoundTrip(ParseFn Parse, GenerateFn Generate,
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector GeneratedArgs2;
+  SmallVector GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.



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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.

Retained `using` declarations look fine. LGTM.


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

https://reviews.llvm.org/D98552

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


[PATCH] D98061: [InstrProfiling] Generate runtime hook for ELF platforms

2021-03-12 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

> There are also going to be binaries in our system build that don't use foo.h 
> and ideally shouldn't have any overhead since nothing inside them is 
> instrumented (they should behave as if -fprofile-instr-generate wasn't set 
> for them at all). That's not the case today because if you set 
> -fprofile-instr-generate, driver passes -u__llvm_profile_runtime to the 
> linker which "pulls in" the profile runtime introducing some extra bloat and 
> startup overhead I described earlier.

The overhead is just `__llvm_profile_write_file`, right? It just writes a 100+ 
bytes file which has very little overhead.

Some sanitizers can be used in a link-only manner without instrumentation, e.g. 
`-fsanitize=leak` does not need instrumentation. The source code just loses 
`__has_feature(leak_sanitizer)` detection. 
Link-only `-fsanitize=address` can catch double free and mismatching new/delete.

Do we expect that libclang_rt.profile- can provide other features which may be 
useful even if there is nothing to instrument according to `-fprofile-list`?
If yes, making the library conditionally not linked can lose such features.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98061

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 330415.
Xiangling_L added a comment.

Bring back two forward declarations to avoid changing pervasive `SmallVector` 
to `llvm::SmallVector`


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

https://reviews.llvm.org/D98552

Files:
  clang/include/clang/Basic/LLVM.h
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -663,7 +663,7 @@
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector GeneratedArgs1;
+  SmallVector GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector GeneratedArgs2;
+  SmallVector GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1913,7 +1913,7 @@
 emitCapturedStmtCall(CodeGenFunction , EmittedClosureTy Cap,
  llvm::ArrayRef Args) {
   // Append the closure context to the argument.
-  llvm::SmallVector EffectiveArgs;
+  SmallVector EffectiveArgs;
   EffectiveArgs.reserve(Args.size() + 1);
   llvm::append_range(EffectiveArgs, Args);
   EffectiveArgs.push_back(Cap.second);
Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,9 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to prevent `too few template arguments for
+// class template 'SmallVector'` building error with build compilers like XL.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.


Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -663,7 +663,7 @@
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector GeneratedArgs1;
+  SmallVector GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector GeneratedArgs2;
+  SmallVector GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1913,7 +1913,7 @@
 emitCapturedStmtCall(CodeGenFunction , EmittedClosureTy Cap,
  llvm::ArrayRef Args) {
   // Append the closure context to the argument.
-  llvm::SmallVector EffectiveArgs;
+  SmallVector EffectiveArgs;
   EffectiveArgs.reserve(Args.size() + 1);
   llvm::append_range(EffectiveArgs, Args);
   EffectiveArgs.push_back(Cap.second);
Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,9 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to prevent `too few template arguments for
+// class template 'SmallVector'` building error with build compilers like XL.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98134: [RFC][POC] Introduce callback argument encoding mode into callback metadata

2021-03-12 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added inline comments.



Comment at: llvm/lib/IR/AbstractCallSite.cpp:209
+
+if (!GEP || !GEP->hasOneUse())
+  return nullptr;

If we don't use have a size, `GEP` will be `nullptr` here, and we can just 
return it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98134

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


[PATCH] D98134: [RFC][POC] Introduce callback argument encoding mode into callback metadata

2021-03-12 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

We probably don't need the index for `size_t size`. If the `ArgNo` is out of 
range, we simply return `nullptr`. Besides, CUDA function `cudaLaunchKernel` 
doesn't have an argument for size as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98134

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


[PATCH] D98134: [RFC] Introduce callback argument encoding mode into callback metadata

2021-03-12 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 330414.
tianshilei1992 added a comment.

add the support for stacked mode in `AbstractCallSite::getCallArgOperand`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98134

Files:
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/attr-callback.c
  clang/test/CodeGen/callback_annotated.c
  clang/test/CodeGen/callback_openmp.c
  clang/test/CodeGenCXX/attr-callback.cpp
  clang/test/OpenMP/parallel_codegen.cpp
  clang/test/Sema/attr-callback-broken.c
  clang/test/Sema/attr-callback.c
  clang/test/SemaCXX/attr-callback.cpp
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/AbstractCallSite.h
  llvm/include/llvm/IR/MDBuilder.h
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/lib/IR/AbstractCallSite.cpp
  llvm/lib/IR/MDBuilder.cpp
  llvm/test/Analysis/CallGraph/callback-calls.ll
  llvm/test/Analysis/CallGraph/ignore-callback-uses.ll
  llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll
  llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll
  llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
  llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll
  llvm/test/Transforms/Attributor/callbacks.ll
  llvm/test/Transforms/Attributor/noundef.ll
  llvm/test/Transforms/OpenMP/parallel_deletion.ll
  llvm/test/Transforms/OpenMP/parallel_deletion_cg_update.ll
  llvm/test/Transforms/OpenMP/parallel_deletion_remarks.ll
  llvm/test/Transforms/OpenMP/parallel_region_merging.ll
  llvm/unittests/IR/AbstractCallSiteTest.cpp
  llvm/unittests/IR/LegacyPassManagerTest.cpp

Index: llvm/unittests/IR/LegacyPassManagerTest.cpp
===
--- llvm/unittests/IR/LegacyPassManagerTest.cpp
+++ llvm/unittests/IR/LegacyPassManagerTest.cpp
@@ -768,7 +768,7 @@
"}\n"
"\n"
"!0 = !{!1}\n"
-   "!1 = !{i64 0, i64 1, i1 false}";
+   "!1 = !{i64 0, i64 0, i64 1, i1 false}";
 
   SMDiagnostic Err;
   std::unique_ptr M = parseAssemblyString(IR, Err, Context);
Index: llvm/unittests/IR/AbstractCallSiteTest.cpp
===
--- llvm/unittests/IR/AbstractCallSiteTest.cpp
+++ llvm/unittests/IR/AbstractCallSiteTest.cpp
@@ -23,7 +23,7 @@
   return Mod;
 }
 
-TEST(AbstractCallSite, CallbackCall) {
+TEST(AbstractCallSite, FlatCallbackCall) {
   LLVMContext C;
 
   const char *IR =
@@ -36,7 +36,7 @@
   "}\n"
   "declare !callback !0 void @broker(i32, void (i8*, ...)*, ...)\n"
   "!0 = !{!1}\n"
-  "!1 = !{i64 1, i64 -1, i1 true}";
+  "!1 = !{i64 0, i64 1, i64 -1, i1 true}";
 
   std::unique_ptr M = parseIR(C, IR);
   ASSERT_TRUE(M);
@@ -53,3 +53,112 @@
   EXPECT_TRUE(ACS.isCallee(CallbackUse));
   EXPECT_EQ(ACS.getCalledFunction(), Callback);
 }
+
+TEST(AbstractCallSite, StackedCallbackCallOpenMP) {
+  LLVMContext C;
+
+  const char *IR =
+"define dso_local void @callback(i64, i64) {\n"
+"  ret void\n"
+"}\n"
+"define dso_local void @broker() {\n"
+"entry:\n"
+"  %a = alloca i32, align 4\n"
+"  %b = alloca float, align 4\n"
+"  %c = alloca double, align 8\n"
+"  %a.casted = alloca i64, align 8\n"
+"  %b.casted = alloca i64, align 8\n"
+"  %c.casted = alloca i64, align 8\n"
+"  %args = alloca [3 x i8*], align 8\n"
+"  %0 = load i32, i32* %a, align 4\n"
+"  %conv = bitcast i64* %a.casted to i32*\n"
+"  store i32 %0, i32* %conv, align 4\n"
+"  %1 = load i64, i64* %a.casted, align 8\n"
+"  %2 = load float, float* %b, align 4\n"
+"  %conv1 = bitcast i64* %b.casted to float*\n"
+"  store float %2, float* %conv1, align 4\n"
+"  %3 = load i64, i64* %b.casted, align 8\n"
+"  %4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %args, i32 0, i32 0\n"
+"  %5 = bitcast i8** %4 to i64*\n"
+"  store i64 %1, i64* %5, align 8\n"
+"  %6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %args, i32 0, i32 1\n"
+"  %7 = bitcast i8** %6 to i64*\n"
+"  store i64 %3, i64* %7, align 8\n"
+"  %8 = getelementptr inbounds [3 x i8*], [3 x i8*]* %args, i32 0, i32 0\n"
+"  call i32 @__tgt_target(i64 -1, i8* bitcast (void (i64, i64)* @callback to i8*), i32 2, i8** null, i8** %8, i64* null, i64* null)\n"
+"  ret void\n"
+"}\n"
+"declare !callback !1 i32 @__tgt_target(i64, i8*, i32, i8**, i8**, i64*, i64*)\n"
+"!1 = !{!2}\n"
+"!2 = !{i64 1, i64 1, i64 4, i64 2, i1 false}\n";
+
+  std::unique_ptr M = parseIR(C, IR);
+  ASSERT_TRUE(M);
+
+  Function *Callback = M->getFunction("callback");
+  ASSERT_NE(Callback, nullptr);
+
+  const Use *CallbackUse = Callback->getSingleUndroppableUse();
+  ASSERT_NE(CallbackUse, nullptr);

[PATCH] D98572: [Fuchsia] Add check-polly to CLANG_BOOTSTRAP_TARGETS

2021-03-12 Thread Petr Hosek 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 rG75cdeff43b2b: [Fuchsia] Add check-polly to 
CLANG_BOOTSTRAP_TARGETS (authored by phosek).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98572

Files:
  clang/cmake/caches/Fuchsia.cmake


Index: clang/cmake/caches/Fuchsia.cmake
===
--- clang/cmake/caches/Fuchsia.cmake
+++ clang/cmake/caches/Fuchsia.cmake
@@ -116,15 +116,16 @@
 
 set(CLANG_BOOTSTRAP_TARGETS
   check-all
-  check-llvm
   check-clang
   check-lld
+  check-llvm
+  check-polly
   llvm-config
-  test-suite
-  test-depends
-  llvm-test-depends
   clang-test-depends
   lld-test-depends
+  llvm-test-depends
+  test-suite
+  test-depends
   distribution
   install-distribution
   install-distribution-stripped


Index: clang/cmake/caches/Fuchsia.cmake
===
--- clang/cmake/caches/Fuchsia.cmake
+++ clang/cmake/caches/Fuchsia.cmake
@@ -116,15 +116,16 @@
 
 set(CLANG_BOOTSTRAP_TARGETS
   check-all
-  check-llvm
   check-clang
   check-lld
+  check-llvm
+  check-polly
   llvm-config
-  test-suite
-  test-depends
-  llvm-test-depends
   clang-test-depends
   lld-test-depends
+  llvm-test-depends
+  test-suite
+  test-depends
   distribution
   install-distribution
   install-distribution-stripped
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 75cdeff - [Fuchsia] Add check-polly to CLANG_BOOTSTRAP_TARGETS

2021-03-12 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2021-03-12T18:31:20-08:00
New Revision: 75cdeff43b2b83baf643ccfd318f6669844fe370

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

LOG: [Fuchsia] Add check-polly to CLANG_BOOTSTRAP_TARGETS

This is necessary so we can run Polly tests in 2 stage build.

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

Added: 


Modified: 
clang/cmake/caches/Fuchsia.cmake

Removed: 




diff  --git a/clang/cmake/caches/Fuchsia.cmake 
b/clang/cmake/caches/Fuchsia.cmake
index 2809f0192cdb..d61b5e6f04e4 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -116,15 +116,16 @@ endif()
 
 set(CLANG_BOOTSTRAP_TARGETS
   check-all
-  check-llvm
   check-clang
   check-lld
+  check-llvm
+  check-polly
   llvm-config
-  test-suite
-  test-depends
-  llvm-test-depends
   clang-test-depends
   lld-test-depends
+  llvm-test-depends
+  test-suite
+  test-depends
   distribution
   install-distribution
   install-distribution-stripped



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


[PATCH] D98572: [Fuchsia] Add check-polly to CLANG_BOOTSTRAP_TARGETS

2021-03-12 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr accepted this revision.
mcgrathr 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/D98572/new/

https://reviews.llvm.org/D98572

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


[PATCH] D98572: [Fuchsia] Add check-polly to CLANG_BOOTSTRAP_TARGETS

2021-03-12 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: leonardchan.
Herald added a subscriber: mgorny.
Herald added a reviewer: bollu.
phosek requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is necessary so we can run Polly tests in 2 stage build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98572

Files:
  clang/cmake/caches/Fuchsia.cmake


Index: clang/cmake/caches/Fuchsia.cmake
===
--- clang/cmake/caches/Fuchsia.cmake
+++ clang/cmake/caches/Fuchsia.cmake
@@ -116,15 +116,16 @@
 
 set(CLANG_BOOTSTRAP_TARGETS
   check-all
-  check-llvm
   check-clang
   check-lld
+  check-llvm
+  check-polly
   llvm-config
-  test-suite
-  test-depends
-  llvm-test-depends
   clang-test-depends
   lld-test-depends
+  llvm-test-depends
+  test-suite
+  test-depends
   distribution
   install-distribution
   install-distribution-stripped


Index: clang/cmake/caches/Fuchsia.cmake
===
--- clang/cmake/caches/Fuchsia.cmake
+++ clang/cmake/caches/Fuchsia.cmake
@@ -116,15 +116,16 @@
 
 set(CLANG_BOOTSTRAP_TARGETS
   check-all
-  check-llvm
   check-clang
   check-lld
+  check-llvm
+  check-polly
   llvm-config
-  test-suite
-  test-depends
-  llvm-test-depends
   clang-test-depends
   lld-test-depends
+  llvm-test-depends
+  test-suite
+  test-depends
   distribution
   install-distribution
   install-distribution-stripped
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94355: [Passes] Add relative lookup table converter pass

2021-03-12 Thread Gulfem Savrun Yeniceri via Phabricator via cfe-commits
gulfem marked 7 inline comments as done.
gulfem added inline comments.



Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:384
 
+  bool shouldBuildRelLookupTables() {
+const TargetMachine  = getTLI()->getTargetMachine();

leonardchan wrote:
> Sorry, I think you might have explained this offline, but what was the reason 
> for needing this in TTI? I would've though this information could be found in 
> the `Module` (PIC/no PIC, 64-bit or not, code model). If it turns out all of 
> this is available in `Module`, then we could greatly simplify some logic here 
> by just checking this at the start of the pass run.
> 
> If TTI is needed, then perhaps it may be better to just inline all these 
> checks in `convertToRelativeLookupTables` since this is the only place this 
> is called. I think we would only want to keep this here as a virtual method 
> if we plan to have multiple TTI-impls overriding this.
Code model or PIC/noPIC is only set in the module if the user explicitly 
specifies them.
TTI hook is necessary to access target machine information like the default 
code model.
TTI is basically the interface to communicate between IR transformations and 
codegen. 

I think the checks cannot be moved into the pass because it uses the 
TargetMachine which is only available/visible in the TTI implementation itself.
That's why I added a function into TTI to do target machine specific checks.
Similar approach is used during lookup table generation 
(`shouldBuildLookupTables`) to check codegen info.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94355

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


[PATCH] D89909: [SYCL] Implement SYCL address space attributes handling

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D89909#2623250 , @aaron.ballman 
wrote:

> In D89909#2623211 , @Anastasia wrote:
>
>> In D89909#2617194 , @bader wrote:
>>
>>> @Anastasia, do you suggest we copy 
>>> https://github.com/intel/llvm/blob/sycl/sycl/doc/CompilerAndRuntimeDesign.md
>>>  document to clang/docs within this patch?
>>
>> For the purpose of this specific topic, you could indeed move "Address 
>> spaces handling" section into the clang documentation. I would suggest 
>> creating a dedicated page where you could gather SYCL specific internals for 
>> the clang community. You could also link the github page to it for more 
>> comprehensive details.
>>
>> I would recommend extending the documentation slightly to focus on what 
>> behavior is expected to be implemented rather than how you propose to 
>> implement it in clang too. This is a general guideline for the clang 
>> contributions that suggest that the documentation should be detailed such 
>> that it would be possible to implement it in other frontend/compiler. You 
>> could for example include some more information on expected language 
>> semantic i.e. what you inherit from embedded C and what you inherent from 
>> OpenCL or any other available language features with relevant spec/doc 
>> references including SYCL spec. This should facilitate anyone who needs to 
>> understand the implementation to find further details.
>>
>> It would probably make sense to create a separate review to avoid adding too 
>> much noise here. Once you create a review we can link it here and also 
>> refine any necessary details as we go along.
>
> These all seem like good suggestions, from my limited perspective, so thank 
> you for them! I'm not opposed to the documentation requests, however, I think 
> that is work that is separable from the proposed changes in this review and 
> could be done with post-commit follow-ups, unless you think the current 
> documentation is wrong as it relates to this patch. I worry that 
> back-and-forth on documentation clarity (while certainly important) is going 
> to hold this patch up for several more months, which is a burden.

Just to be clear I am not suggesting a nice-to-have documentation. I would like 
to see the documentation that explains what behavior is expected from the 
compiler. I think this is normally a good starting point and it has been a 
common practice for many contributions I believe too. I guess we could first 
commit the implementation and then work out what we want it to be doing but 
that implies a bigger risks to the community. Also I am also not entirely happy 
with some directions taken deviating the original design in this patch. But it 
is hard to assess whether there are better practical alternatives and suggest 
anything without understanding what is being implemented.

Address spaces are used by many stakeholders in clang so having a clear 
understanding of various use cases publicly accessible would benefit the 
community and reduce the risks of disruptions and negative impact of each 
other's work.

Regarding the timing I believe it could take less than several months 
considering that there are some parts already available but it depends on 
various factors including everyone's availability. However, the fact that some 
areas would require collaborative exploration of design alternatives from 
stakeholders was to my memory highlighted on the original proposal to 
contribute SYCL support to clang quite a while ago. So the requirement here 
should not appear as unexpected.

This has been my suggestion to address the ping-ponging discussion issues and 
latencies/time incurred by them as I think it would be good for us to get the 
terminology sorted. But I am happy if there are other suggestions addressing 
the concerns.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89909

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


[clang] 1ce846b - Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis via cfe-commits

Author: Giorgis Georgakoudis
Date: 2021-03-12T17:37:09-08:00
New Revision: 1ce846be04f8ce7f899e37424772c0bef1851f76

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

LOG: Replace func name with regex for update test scripts

The patch adds an argument to update test scripts, such as 
update_cc_test_checks, for replacing a function name matching a regex. This 
functionality is needed to match generated function signatures that include 
file hashes. Example:

The function signature for the following function:

`__omp_offloading_50_b84c41e__Z9ftemplateIiET_i_l30_worker`

with `--replace-function-regex "__omp_offloading_[0-9]+_[a-z0-9]+_(.*)"` will 
become:

`CHECK-LABEL: 
@{{__omp_offloading_[0-9]+_[a-z0-9]+__Z9ftemplateIiET_i_l30_worker}}(`

Reviewed By: jdoerfert

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

Added: 
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c

clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
clang/test/utils/update_cc_test_checks/generated-funcs-regex.test

Modified: 
llvm/utils/UpdateTestChecks/common.py
llvm/utils/update_llc_test_checks.py

Removed: 




diff  --git 
a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
new file mode 100644
index ..3d51d48568ef
--- /dev/null
+++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o 
- | FileCheck %s
+
+void __test_offloading_42_abcdef_bar_l123();
+void use(int);
+
+void foo(int a)
+{
+#pragma omp target
+use(a);
+
+__test_offloading_42_abcdef_bar_l123();
+}

diff  --git 
a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
new file mode 100644
index ..838db8d8e606
--- /dev/null
+++ 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --include-generated-funcs --replace-function-regex 
"__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+"
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o 
- | FileCheck %s
+
+void __test_offloading_42_abcdef_bar_l123();
+void use(int);
+
+void foo(int a)
+{
+#pragma omp target
+use(a);
+
+__test_offloading_42_abcdef_bar_l123();
+}
+// CHECK-LABEL: @foo(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:[[A_CASTED:%.*]] = alloca i64, align 8
+// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load i32, i32* [[A_ADDR]], align 4
+// CHECK-NEXT:[[CONV:%.*]] = bitcast i64* [[A_CASTED]] to i32*
+// CHECK-NEXT:store i32 [[TMP0]], i32* [[CONV]], align 4
+// CHECK-NEXT:[[TMP1:%.*]] = load i64, i64* [[A_CASTED]], align 8
+// CHECK-NEXT:call void 
@{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(i64 [[TMP1]]) 
#[[ATTR3:[0-9]+]]
+// CHECK-NEXT:call void (...) 
@{{__test_offloading_[a-z0-9]+_[a-z0-9]+_bar_l[0-9]+}}()
+// CHECK-NEXT:ret void
+//
+//
+// CHECK-LABEL: @{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i64, align 8
+// CHECK-NEXT:store i64 [[A:%.*]], i64* [[A_ADDR]], align 8
+// CHECK-NEXT:[[CONV:%.*]] = bitcast i64* [[A_ADDR]] to i32*
+// CHECK-NEXT:[[TMP0:%.*]] = load i32, i32* [[CONV]], align 8
+// CHECK-NEXT:call void @use(i32 [[TMP0]])
+// CHECK-NEXT:ret void
+//

diff  --git a/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test 
b/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
new file mode 100644
index ..4051d0a5181f
--- /dev/null
+++ b/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && 
%update_cc_test_checks --include-generated-funcs --replace-function-regex 
"__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- 
%t-generated-funcs-regex.c
+# RUN: 
diff  -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: 
diff  -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c

diff  --git a/llvm/utils/UpdateTestChecks/common.py 

[PATCH] D97107: Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis 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 rG1ce846be04f8: Replace func name with regex for update test 
scripts (authored by ggeorgakoudis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -275,6 +277,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -348,6 +352,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -794,6 +822,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: 

[PATCH] D97107: Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 330407.
ggeorgakoudis added a comment.

Fix for upstreaming


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -275,6 +277,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -348,6 +352,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -794,6 +822,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
Index: 

[PATCH] D94355: [Passes] Add relative lookup table converter pass

2021-03-12 Thread Gulfem Savrun Yeniceri via Phabricator via cfe-commits
gulfem updated this revision to Diff 330405.
gulfem added a comment.

1. Used IsConstantOffsetFromGlobal() function
2. Added this pass to the end of legacy pass manager pipeline
3. Moved all the tests under a new test directory


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94355

Files:
  llvm/docs/Passes.rst
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Utils/RelLookupTableConverter.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Utils/CMakeLists.txt
  llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp
  llvm/lib/Transforms/Utils/Utils.cpp
  llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/RelLookupTableConverter/relative_lookup_table.ll
  llvm/test/Transforms/RelLookupTableConverter/switch_relative_lookup_table.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn
@@ -61,6 +61,7 @@
 "NameAnonGlobals.cpp",
 "PredicateInfo.cpp",
 "PromoteMemoryToRegister.cpp",
+"RelLookupTableConverter.cpp"
 "SSAUpdater.cpp",
 "SSAUpdaterBulk.cpp",
 "SampleProfileLoaderBaseUtil.cpp",
Index: llvm/test/Transforms/RelLookupTableConverter/switch_relative_lookup_table.ll
===
--- /dev/null
+++ llvm/test/Transforms/RelLookupTableConverter/switch_relative_lookup_table.ll
@@ -0,0 +1,73 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -rel-lookup-table-converter -S | FileCheck %s --check-prefix=FNOPIC
+; RUN: opt < %s -rel-lookup-table-converter -relocation-model=pic -S | FileCheck %s --check-prefix=FPIC
+
+; RUN: opt < %s -passes=rel-lookup-table-converter -S | FileCheck %s --check-prefix=FNOPIC
+; RUN: opt < %s -passes=rel-lookup-table-converter -relocation-model=pic -S | FileCheck %s --check-prefix=FPIC
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@.str = private unnamed_addr constant [5 x i8] c"zero\00", align 1
+@.str.1 = private unnamed_addr constant [4 x i8] c"one\00", align 1
+@.str.2 = private unnamed_addr constant [4 x i8] c"two\00", align 1
+@.str.3 = private unnamed_addr constant [8 x i8] c"default\00", align 1
+
+@switch.table.string_table = private unnamed_addr constant [3 x i8*]
+ [
+  i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0),
+  i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0),
+  i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
+ ], align 8
+
+; Switch lookup table
+; FNOPIC: @switch.table.string_table = private unnamed_addr constant [3 x i8*]
+; FNOPIC-SAME: [
+; FNOPIC-SAME: i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0),
+; FNOPIC-SAME: i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0),
+; FNOPIC-SAME: i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
+; FNOPIC-SAME: ], align 8
+
+; Relative switch lookup table
+; FPIC: @reltable.string_table = private unnamed_addr constant [3 x i32]
+; FPIC-SAME: [
+; FPIC-SAME: i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.string_table to i64)) to i32),
+; FPIC-SAME: i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.string_table to i64)) to i32),
+; FPIC-SAME: i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.string_table to i64)) to i32)
+; FPIC-SAME: ], align 4
+
+; ; Relative switch lookup table for strings
+define i8* @string_table(i32 %cond) {
+  ; FNOPIC-LABEL: @string_table(
+  ; FNOPIC-NEXT:  entry:
+  ; FNOPIC-NEXT:[[TMP0:%.*]] = icmp ult i32 

[clang] 9f9a4df - Revert "Replace func name with regex for update test scripts"

2021-03-12 Thread Giorgis Georgakoudis via cfe-commits

Author: Giorgis Georgakoudis
Date: 2021-03-12T17:20:00-08:00
New Revision: 9f9a4dfda7348eddbc840ae558e7082677c3bab6

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

LOG: Revert "Replace func name with regex for update test scripts"

This reverts commit 5eaf70afb5f8ae6789587e60d51c60f56caf18b0.

Added: 


Modified: 
llvm/utils/UpdateTestChecks/common.py
llvm/utils/update_llc_test_checks.py

Removed: 
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c

clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
clang/test/utils/update_cc_test_checks/generated-funcs-regex.test



diff  --git 
a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
deleted file mode 100644
index 3d51d48568ef..
--- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o 
- | FileCheck %s
-
-void __test_offloading_42_abcdef_bar_l123();
-void use(int);
-
-void foo(int a)
-{
-#pragma omp target
-use(a);
-
-__test_offloading_42_abcdef_bar_l123();
-}

diff  --git 
a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
deleted file mode 100644
index 49e041b93621..
--- 
a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
+++ /dev/null
@@ -1,36 +0,0 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --include-generated-funcs --replace-function-regex 
"__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+"
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o 
- | FileCheck %s
-
-void __test_offloading_42_abcdef_bar_l123();
-void use(int);
-
-void foo(int a)
-{
-#pragma omp target
-use(a);
-
-__test_offloading_42_abcdef_bar_l123();
-}
-// CHECK-LABEL: @foo(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
-// CHECK-NEXT:[[A_CASTED:%.*]] = alloca i64, align 8
-// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
-// CHECK-NEXT:[[TMP0:%.*]] = load i32, i32* [[A_ADDR]], align 4
-// CHECK-NEXT:[[CONV:%.*]] = bitcast i64* [[A_CASTED]] to i32*
-// CHECK-NEXT:store i32 [[TMP0]], i32* [[CONV]], align 4
-// CHECK-NEXT:[[TMP1:%.*]] = load i64, i64* [[A_CASTED]], align 8
-// CHECK-NEXT:call void 
@{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(i64 [[TMP1]]) 
[[ATTR3:#.*]]
-// CHECK-NEXT:call void (...) 
@{{__test_offloading_[a-z0-9]+_[a-z0-9]+_bar_l[0-9]+}}()
-// CHECK-NEXT:ret void
-//
-//
-// CHECK-LABEL: @{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i64, align 8
-// CHECK-NEXT:store i64 [[A:%.*]], i64* [[A_ADDR]], align 8
-// CHECK-NEXT:[[CONV:%.*]] = bitcast i64* [[A_ADDR]] to i32*
-// CHECK-NEXT:[[TMP0:%.*]] = load i32, i32* [[CONV]], align 8
-// CHECK-NEXT:call void @use(i32 [[TMP0]])
-// CHECK-NEXT:ret void
-//

diff  --git a/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test 
b/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
deleted file mode 100644
index 4051d0a5181f..
--- a/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
+++ /dev/null
@@ -1,9 +0,0 @@
-## Test that CHECK lines are generated for clang-generated functions replaced
-## by regex
-
-## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && 
%update_cc_test_checks --include-generated-funcs --replace-function-regex 
"__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- 
%t-generated-funcs-regex.c
-# RUN: 
diff  -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
-
-## Check that re-running update_cc_test_checks doesn't change the output
-# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
-# RUN: 
diff  -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c

diff  --git a/llvm/utils/UpdateTestChecks/common.py 
b/llvm/utils/UpdateTestChecks/common.py
index b3ca33f07428..5cf509013f94 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -30,8 +30,6 @@ def parse_commandline_args(parser):
help='Activate CHECK line generation from this point 
forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point 
forward')
-  parser.add_argument('--replace-function-regex', 

[PATCH] D97107: Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis 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 rG5eaf70afb5f8: Replace func name with regex for update test 
scripts (authored by ggeorgakoudis).

Changed prior to commit:
  https://reviews.llvm.org/D97107?vs=330399=330402#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -275,6 +277,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 self._global_var_dict = {}
@@ -348,6 +352,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -794,6 +822,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## 

[clang] 5eaf70a - Replace func name with regex for update test scripts

2021-03-12 Thread Giorgis Georgakoudis via cfe-commits

Author: Giorgis Georgakoudis
Date: 2021-03-12T17:00:42-08:00
New Revision: 5eaf70afb5f8ae6789587e60d51c60f56caf18b0

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

LOG: Replace func name with regex for update test scripts

The patch adds an argument to update test scripts, such as 
update_cc_test_checks, for replacing a function name matching a regex. This 
functionality is needed to match generated function signatures that include 
file hashes. Example:

The function signature for the following function:

`__omp_offloading_50_b84c41e__Z9ftemplateIiET_i_l30_worker`

with `--replace-function-regex "__omp_offloading_[0-9]+_[a-z0-9]+_(.*)"` will 
become:

`CHECK-LABEL: 
@{{__omp_offloading_[0-9]+_[a-z0-9]+__Z9ftemplateIiET_i_l30_worker}}(`

Reviewed By: jdoerfert

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

Added: 
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c

clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
clang/test/utils/update_cc_test_checks/generated-funcs-regex.test

Modified: 
llvm/utils/UpdateTestChecks/common.py
llvm/utils/update_llc_test_checks.py

Removed: 




diff  --git 
a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
new file mode 100644
index ..3d51d48568ef
--- /dev/null
+++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o 
- | FileCheck %s
+
+void __test_offloading_42_abcdef_bar_l123();
+void use(int);
+
+void foo(int a)
+{
+#pragma omp target
+use(a);
+
+__test_offloading_42_abcdef_bar_l123();
+}

diff  --git 
a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
new file mode 100644
index ..49e041b93621
--- /dev/null
+++ 
b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
@@ -0,0 +1,36 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --include-generated-funcs --replace-function-regex 
"__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+"
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o 
- | FileCheck %s
+
+void __test_offloading_42_abcdef_bar_l123();
+void use(int);
+
+void foo(int a)
+{
+#pragma omp target
+use(a);
+
+__test_offloading_42_abcdef_bar_l123();
+}
+// CHECK-LABEL: @foo(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:[[A_CASTED:%.*]] = alloca i64, align 8
+// CHECK-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load i32, i32* [[A_ADDR]], align 4
+// CHECK-NEXT:[[CONV:%.*]] = bitcast i64* [[A_CASTED]] to i32*
+// CHECK-NEXT:store i32 [[TMP0]], i32* [[CONV]], align 4
+// CHECK-NEXT:[[TMP1:%.*]] = load i64, i64* [[A_CASTED]], align 8
+// CHECK-NEXT:call void 
@{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(i64 [[TMP1]]) 
[[ATTR3:#.*]]
+// CHECK-NEXT:call void (...) 
@{{__test_offloading_[a-z0-9]+_[a-z0-9]+_bar_l[0-9]+}}()
+// CHECK-NEXT:ret void
+//
+//
+// CHECK-LABEL: @{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i64, align 8
+// CHECK-NEXT:store i64 [[A:%.*]], i64* [[A_ADDR]], align 8
+// CHECK-NEXT:[[CONV:%.*]] = bitcast i64* [[A_ADDR]] to i32*
+// CHECK-NEXT:[[TMP0:%.*]] = load i32, i32* [[CONV]], align 8
+// CHECK-NEXT:call void @use(i32 [[TMP0]])
+// CHECK-NEXT:ret void
+//

diff  --git a/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test 
b/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
new file mode 100644
index ..4051d0a5181f
--- /dev/null
+++ b/clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && 
%update_cc_test_checks --include-generated-funcs --replace-function-regex 
"__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- 
%t-generated-funcs-regex.c
+# RUN: 
diff  -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: 
diff  -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c

diff  --git a/llvm/utils/UpdateTestChecks/common.py 

[PATCH] D97107: Replace func name with regex in update_cc_test_checks

2021-03-12 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 330399.
ggeorgakoudis added a comment.

NFC change in update_llc_test_checks for compatibility


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97107

Files:
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_llc_test_checks.py

Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -109,7 +109,8 @@
 flags=type('', (object,), {
 'verbose': ti.args.verbose,
 'function_signature': False,
-'check_attributes': False}),
+'check_attributes': False,
+'replace_function_regex': []}),
 scrubber_args=[ti.args])
 
 for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,6 +30,8 @@
help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
   help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--replace-function-regex', nargs='+', default=[],
+  help='List of regular expressions to replace matching function names')
   args = parser.parse_args()
   global _verbose
   _verbose = args.verbose
@@ -264,6 +266,8 @@
 self._record_args = flags.function_signature
 self._check_attributes = flags.check_attributes
 self._scrubber_args = scrubber_args
+# Strip double-quotes if input was read by UTC_ARGS
+self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
 self._func_dict = {}
 self._func_order = {}
 for tuple in run_list:
@@ -331,6 +335,30 @@
   self._func_dict[prefix][func] = None
   continue
 
+# Replace function names matching the regex.
+for regex in self._replace_function_regex:
+  # Pattern that matches capture groups in the regex in leftmost order.
+  group_regex = re.compile('\(.*?\)')
+  # Replace function name with regex.
+  match = re.match(regex, func)
+  if match:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+  func_repl = group_regex.sub(g, func_repl, count=1)
+func = '{{' + func_repl + '}}'
+
+  # Replace all calls to regex matching functions.
+  matches = re.finditer(regex, scrubbed_body)
+  for match in matches:
+func_repl = regex
+# Replace any capture groups with their matched strings.
+for g in match.groups():
+func_repl = group_regex.sub(g, func_repl, count=1)
+# Substitute function call names that match the regex with the same
+# capture groups set.
+scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
+
 self._func_dict[prefix][func] = function_body(
 scrubbed_body, scrubbed_extra, args_and_sig, attrs)
 self._func_order[prefix].append(func)
@@ -633,6 +661,8 @@
   continue  # Don't add default values
 autogenerated_note_args += action.option_strings[0] + ' '
 if action.const is None:  # action takes a parameter
+  if action.nargs == '+':
+value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
   autogenerated_note_args += '%s ' % value
   if autogenerated_note_args:
 autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])
Index: clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
===
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/generated-funcs-regex.test
@@ -0,0 +1,9 @@
+## Test that CHECK lines are generated for clang-generated functions replaced
+## by regex
+
+## RUN: cp %S/Inputs/generated-funcs-regex.c %t-generated-funcs-regex.c && %update_cc_test_checks --include-generated-funcs --replace-function-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" -- %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected %t-generated-funcs-regex.c
+
+## Check that re-running update_cc_test_checks doesn't change the output
+# RUN: %update_cc_test_checks %t-generated-funcs-regex.c
+# RUN: diff -u %S/Inputs/generated-funcs-regex.c.expected 

[PATCH] D98095: [clang] Fix ICE on invalid type parameters for concepts

2021-03-12 Thread Matheus Izvekov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd4a8c7359b57: [clang] Fix ICE on invalid type parameters for 
concepts (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98095

Files:
  clang/lib/Sema/SemaType.cpp
  clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp

Index: clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
===
--- clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
+++ clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
@@ -68,3 +68,11 @@
   True decltype(auto) h = (b);
   static_assert(is_same_v);
 }
+
+namespace PR48593 {
+  template  concept a = true;
+  a auto c = 0; // expected-error{{use of undeclared identifier 'B'}}
+
+  template concept d = true;
+  d<,> auto e = 0; // expected-error{{expected expression}}
+}
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -1256,25 +1256,6 @@
   return OpenCLAccessAttr::Keyword_read_only;
 }
 
-static QualType ConvertConstrainedAutoDeclSpecToType(Sema , DeclSpec ,
- AutoTypeKeyword AutoKW) {
-  assert(DS.isConstrainedAuto());
-  TemplateIdAnnotation *TemplateId = DS.getRepAsTemplateId();
-  TemplateArgumentListInfo TemplateArgsInfo;
-  TemplateArgsInfo.setLAngleLoc(TemplateId->LAngleLoc);
-  TemplateArgsInfo.setRAngleLoc(TemplateId->RAngleLoc);
-  ASTTemplateArgsPtr TemplateArgsPtr(TemplateId->getTemplateArgs(),
- TemplateId->NumArgs);
-  S.translateTemplateArguments(TemplateArgsPtr, TemplateArgsInfo);
-  llvm::SmallVector TemplateArgs;
-  for (auto  : TemplateArgsInfo.arguments())
-TemplateArgs.push_back(ArgLoc.getArgument());
-  return S.Context.getAutoType(
-  QualType(), AutoKW, false, /*IsPack=*/false,
-  cast(TemplateId->Template.get().getAsTemplateDecl()),
-  TemplateArgs);
-}
-
 /// Convert the specified declspec to the appropriate type
 /// object.
 /// \param state Specifies the declarator containing the declaration specifier
@@ -1655,29 +1636,39 @@
 break;
 
   case DeclSpec::TST_auto:
+  case DeclSpec::TST_decltype_auto: {
+auto AutoKW = DS.getTypeSpecType() == DeclSpec::TST_decltype_auto
+  ? AutoTypeKeyword::DecltypeAuto
+  : AutoTypeKeyword::Auto;
+
+ConceptDecl *TypeConstraintConcept = nullptr;
+llvm::SmallVector TemplateArgs;
 if (DS.isConstrainedAuto()) {
-  Result = ConvertConstrainedAutoDeclSpecToType(S, DS,
-AutoTypeKeyword::Auto);
-  break;
+  if (TemplateIdAnnotation *TemplateId = DS.getRepAsTemplateId()) {
+TypeConstraintConcept =
+cast(TemplateId->Template.get().getAsTemplateDecl());
+TemplateArgumentListInfo TemplateArgsInfo;
+TemplateArgsInfo.setLAngleLoc(TemplateId->LAngleLoc);
+TemplateArgsInfo.setRAngleLoc(TemplateId->RAngleLoc);
+ASTTemplateArgsPtr TemplateArgsPtr(TemplateId->getTemplateArgs(),
+   TemplateId->NumArgs);
+S.translateTemplateArguments(TemplateArgsPtr, TemplateArgsInfo);
+for (const auto  : TemplateArgsInfo.arguments())
+  TemplateArgs.push_back(ArgLoc.getArgument());
+  } else {
+declarator.setInvalidType(true);
+  }
 }
-Result = Context.getAutoType(QualType(), AutoTypeKeyword::Auto, false);
+Result = S.Context.getAutoType(QualType(), AutoKW,
+   /*IsDependent*/ false, /*IsPack=*/false,
+   TypeConstraintConcept, TemplateArgs);
 break;
+  }
 
   case DeclSpec::TST_auto_type:
 Result = Context.getAutoType(QualType(), AutoTypeKeyword::GNUAutoType, false);
 break;
 
-  case DeclSpec::TST_decltype_auto:
-if (DS.isConstrainedAuto()) {
-  Result =
-  ConvertConstrainedAutoDeclSpecToType(S, DS,
-   AutoTypeKeyword::DecltypeAuto);
-  break;
-}
-Result = Context.getAutoType(QualType(), AutoTypeKeyword::DecltypeAuto,
- /*IsDependent*/ false);
-break;
-
   case DeclSpec::TST_unknown_anytype:
 Result = Context.UnknownAnyTy;
 break;
@@ -5962,6 +5953,8 @@
   if (!DS.isConstrainedAuto())
 return;
   TemplateIdAnnotation *TemplateId = DS.getRepAsTemplateId();
+  if (!TemplateId)
+return;
   if (DS.getTypeSpecScope().isNotEmpty())
 TL.setNestedNameSpecifierLoc(
 DS.getTypeSpecScope().getWithLocInContext(Context));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[clang] d4a8c73 - [clang] Fix ICE on invalid type parameters for concepts

2021-03-12 Thread Matheus Izvekov via cfe-commits

Author: Matheus Izvekov
Date: 2021-03-13T01:23:02+01:00
New Revision: d4a8c7359b57bafc7bfa2a9dea30017fb0153c1a

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

LOG: [clang] Fix ICE on invalid type parameters for concepts

See PR48593.

Constraints with invalid type parameters were causing a null pointer
dereference.

Signed-off-by: Matheus Izvekov 

Reviewed By: rsmith

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

Added: 


Modified: 
clang/lib/Sema/SemaType.cpp
clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 5f5b0361eab5..ffd431608b82 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1256,25 +1256,6 @@ getImageAccess(const ParsedAttributesView ) {
   return OpenCLAccessAttr::Keyword_read_only;
 }
 
-static QualType ConvertConstrainedAutoDeclSpecToType(Sema , DeclSpec ,
- AutoTypeKeyword AutoKW) {
-  assert(DS.isConstrainedAuto());
-  TemplateIdAnnotation *TemplateId = DS.getRepAsTemplateId();
-  TemplateArgumentListInfo TemplateArgsInfo;
-  TemplateArgsInfo.setLAngleLoc(TemplateId->LAngleLoc);
-  TemplateArgsInfo.setRAngleLoc(TemplateId->RAngleLoc);
-  ASTTemplateArgsPtr TemplateArgsPtr(TemplateId->getTemplateArgs(),
- TemplateId->NumArgs);
-  S.translateTemplateArguments(TemplateArgsPtr, TemplateArgsInfo);
-  llvm::SmallVector TemplateArgs;
-  for (auto  : TemplateArgsInfo.arguments())
-TemplateArgs.push_back(ArgLoc.getArgument());
-  return S.Context.getAutoType(
-  QualType(), AutoKW, false, /*IsPack=*/false,
-  cast(TemplateId->Template.get().getAsTemplateDecl()),
-  TemplateArgs);
-}
-
 /// Convert the specified declspec to the appropriate type
 /// object.
 /// \param state Specifies the declarator containing the declaration specifier
@@ -1655,29 +1636,39 @@ static QualType 
ConvertDeclSpecToType(TypeProcessingState ) {
 break;
 
   case DeclSpec::TST_auto:
+  case DeclSpec::TST_decltype_auto: {
+auto AutoKW = DS.getTypeSpecType() == DeclSpec::TST_decltype_auto
+  ? AutoTypeKeyword::DecltypeAuto
+  : AutoTypeKeyword::Auto;
+
+ConceptDecl *TypeConstraintConcept = nullptr;
+llvm::SmallVector TemplateArgs;
 if (DS.isConstrainedAuto()) {
-  Result = ConvertConstrainedAutoDeclSpecToType(S, DS,
-AutoTypeKeyword::Auto);
-  break;
+  if (TemplateIdAnnotation *TemplateId = DS.getRepAsTemplateId()) {
+TypeConstraintConcept =
+cast(TemplateId->Template.get().getAsTemplateDecl());
+TemplateArgumentListInfo TemplateArgsInfo;
+TemplateArgsInfo.setLAngleLoc(TemplateId->LAngleLoc);
+TemplateArgsInfo.setRAngleLoc(TemplateId->RAngleLoc);
+ASTTemplateArgsPtr TemplateArgsPtr(TemplateId->getTemplateArgs(),
+   TemplateId->NumArgs);
+S.translateTemplateArguments(TemplateArgsPtr, TemplateArgsInfo);
+for (const auto  : TemplateArgsInfo.arguments())
+  TemplateArgs.push_back(ArgLoc.getArgument());
+  } else {
+declarator.setInvalidType(true);
+  }
 }
-Result = Context.getAutoType(QualType(), AutoTypeKeyword::Auto, false);
+Result = S.Context.getAutoType(QualType(), AutoKW,
+   /*IsDependent*/ false, /*IsPack=*/false,
+   TypeConstraintConcept, TemplateArgs);
 break;
+  }
 
   case DeclSpec::TST_auto_type:
 Result = Context.getAutoType(QualType(), AutoTypeKeyword::GNUAutoType, 
false);
 break;
 
-  case DeclSpec::TST_decltype_auto:
-if (DS.isConstrainedAuto()) {
-  Result =
-  ConvertConstrainedAutoDeclSpecToType(S, DS,
-   AutoTypeKeyword::DecltypeAuto);
-  break;
-}
-Result = Context.getAutoType(QualType(), AutoTypeKeyword::DecltypeAuto,
- /*IsDependent*/ false);
-break;
-
   case DeclSpec::TST_unknown_anytype:
 Result = Context.UnknownAnyTy;
 break;
@@ -5962,6 +5953,8 @@ namespace {
   if (!DS.isConstrainedAuto())
 return;
   TemplateIdAnnotation *TemplateId = DS.getRepAsTemplateId();
+  if (!TemplateId)
+return;
   if (DS.getTypeSpecScope().isNotEmpty())
 TL.setNestedNameSpecifierLoc(
 DS.getTypeSpecScope().getWithLocInContext(Context));

diff  --git a/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp 
b/clang/test/CXX/dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
index 44539bd125ff..7830d1f43526 100644
--- 

[PATCH] D98546: [PowerPC] Add __PCREL__ when PC Relative is enabled.

2021-03-12 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment.

LGTM. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98546

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


[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-12 Thread Matheus Izvekov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc9fd92d57398: [clang] Improve diagnostics on implicitly 
deleted defaulted comparisons (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97990

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
  clang/test/CXX/class/class.compare/class.eq/p2.cpp
  clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
  clang/test/CXX/class/class.compare/class.spaceship/p2.cpp

Index: clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
===
--- clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
+++ clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
@@ -52,7 +52,7 @@
 bool operator<(const A&) const;
   };
   struct B {
-A a; // expected-note {{no viable comparison function for member 'a'}}
+A a; // expected-note {{no viable three-way comparison function for member 'a'}}
 auto operator<=>(const B&) const = default; // expected-warning {{implicitly deleted}}
   };
 }
@@ -159,16 +159,16 @@
 namespace PR48856 {
   struct A {
 auto operator<=>(const A &) const = default; // expected-warning {{implicitly deleted}}
-void (*x)(); // expected-note {{because there is no viable comparison function for member 'x'}}
+void (*x)(); // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 
   struct B {
 auto operator<=>(const B &) const = default; // expected-warning {{implicitly deleted}}
-void (B::*x)();  // expected-note {{because there is no viable comparison function for member 'x'}}
+void (B::*x)();  // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 
   struct C {
 auto operator<=>(const C &) const = default; // expected-warning {{implicitly deleted}}
-int C::*x;   // expected-note {{because there is no viable comparison function for member 'x'}}
+int C::*x;   // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 }
Index: clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
===
--- clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
+++ clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
@@ -78,9 +78,9 @@
   };
 
   // expected-note@#base {{deleted comparison function for base class 'C'}}
-  // expected-note@#base {{no viable comparison function for base class 'D1'}}
+  // expected-note@#base {{no viable three-way comparison function for base class 'D1'}}
   // expected-note@#base {{three-way comparison cannot be synthesized because there is no viable function for '<' comparison}}
-  // expected-note@#base {{no viable comparison function for base class 'D2'}}
+  // expected-note@#base {{no viable three-way comparison function for base class 'D2'}}
   // expected-note@#base {{three-way comparison cannot be synthesized because there is no viable function for '==' comparison}}
   // expected-note@#base {{deleted comparison function for base class 'E'}}
   // expected-note@#base {{implied comparison for base class 'F' is ambiguous}}
@@ -110,9 +110,9 @@
   }
 
   // expected-note@#arr {{deleted comparison function for member 'arr'}}
-  // expected-note@#arr {{no viable comparison function for member 'arr'}}
+  // expected-note@#arr {{no viable three-way comparison function for member 'arr'}}
   // expected-note@#arr {{three-way comparison cannot be synthesized because there is no viable function for '<' comparison}}
-  // expected-note@#arr {{no viable comparison function for member 'arr'}}
+  // expected-note@#arr {{no viable three-way comparison function for member 'arr'}}
   // expected-note@#arr {{three-way comparison cannot be synthesized because there is no viable function for '==' comparison}}
   // expected-note@#arr {{deleted comparison function for member 'arr'}}
   // expected-note@#arr {{implied comparison for member 'arr' is ambiguous}}
Index: clang/test/CXX/class/class.compare/class.eq/p2.cpp
===
--- clang/test/CXX/class/class.compare/class.eq/p2.cpp
+++ clang/test/CXX/class/class.compare/class.eq/p2.cpp
@@ -18,26 +18,26 @@
 struct H1 {
   bool operator==(const H1 &) const = default;
   bool operator<(const H1 &) const = default; // expected-warning {{implicitly deleted}}
-  // expected-note@-1 

[clang] c9fd92d - [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-12 Thread Matheus Izvekov via cfe-commits

Author: Matheus Izvekov
Date: 2021-03-13T01:13:52+01:00
New Revision: c9fd92d573988c59b7a613f07909596cdad36095

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

LOG: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

This patch just makes the error message clearer by reinforcing the cause
was a lack of viable **three-way** comparison function for the
**complete object**.

Signed-off-by: Matheus Izvekov 

Reviewed By: rsmith

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

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
clang/test/CXX/class/class.compare/class.eq/p2.cpp
clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
clang/test/CXX/class/class.compare/class.spaceship/p2.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index d4578c5263a0..8e037260288f 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -8979,8 +8979,8 @@ def note_defaulted_comparison_calls_deleted : Note<
   "defaulted %0 is implicitly deleted because it would invoke a deleted "
   "comparison function%select{| for member %2| for base class %2}1">;
 def note_defaulted_comparison_no_viable_function : Note<
-  "defaulted %0 is implicitly deleted because there is no viable comparison "
-  "function%select{| for member %2| for base class %2}1">;
+  "defaulted %0 is implicitly deleted because there is no viable three-way "
+  "comparison function for%select{| member| base class}1 %2">;
 def note_defaulted_comparison_no_viable_function_synthesized : Note<
   "three-way comparison cannot be synthesized because there is no viable "
   "function for %select{'=='|'<'}0 comparison">;

diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 940ef796ce5e..0365d77cfc4e 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -7632,7 +7632,7 @@ class DefaultedComparisonAnalyzer
 
 private:
   Subobject getCompleteObject() {
-return Subobject{Subobject::CompleteObject, nullptr, FD->getLocation()};
+return Subobject{Subobject::CompleteObject, RD, FD->getLocation()};
   }
 
   Subobject getBase(CXXBaseSpecifier *Base) {

diff  --git a/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp 
b/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
index 1a0ccc91741b..dd622988d458 100644
--- a/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
+++ b/clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
@@ -127,7 +127,7 @@ namespace P1946 {
 friend bool operator==(A &, A &); // expected-note {{would lose const 
qualifier}}
   };
   struct B {
-A a; // expected-note {{no viable comparison}}
+A a; // expected-note {{no viable three-way comparison}}
 friend bool operator==(B, B) = default; // ok
 friend bool operator==(const B&, const B&) = default; // expected-warning 
{{deleted}}
   };

diff  --git a/clang/test/CXX/class/class.compare/class.compare.default/p2.cpp 
b/clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
index 226245ce8a44..a1653d85abbf 100644
--- a/clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
+++ b/clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
@@ -44,7 +44,7 @@ struct A3 {
 
   bool operator==(const A3 &) const = default; // expected-warning 
{{implicitly deleted}}
   bool operator<(const A3 &) const = default;  // expected-warning 
{{implicitly deleted}}
-  // expected-note@-1 {{because there is no viable comparison function}}
+  // expected-note@-1 {{because there is no viable three-way comparison 
function for 'A3'}}
 };
 
 struct B1 {

diff  --git a/clang/test/CXX/class/class.compare/class.compare.default/p4.cpp 
b/clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
index 8c303c63d899..02adf3d51ded 100644
--- a/clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
+++ b/clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
@@ -99,7 +99,7 @@ namespace DeleteAfterFirstDecl {
   struct Q {
 struct X {
   friend std::strong_ordering operator<=>(const X&, const X&);
-} x; // expected-note {{no viable comparison}}
+} x; // expected-note {{no viable three-way comparison}}
 // expected-error@+1 {{defaulting the corresponding implicit 'operator==' 
for this defaulted 'operator<=>' would delete it after its first declaration}}
 friend 

[PATCH] D96033: [clang-repl] Land initial infrastructure for incremental parsing

2021-03-12 Thread Stefan Gränitz via Phabricator via cfe-commits
sgraenitz accepted this revision.
sgraenitz added a comment.

Thanks. From my side this looks good now.


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

https://reviews.llvm.org/D96033

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


[PATCH] D98438: Clang: Allow selecting the hash algorithm for file checksums in debug info.

2021-03-12 Thread Arlo Siemsen via Phabricator via cfe-commits
arlosi updated this revision to Diff 330386.
arlosi marked an inline comment as done.
arlosi added a comment.

Use automatic marshaling for command line arguments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98438

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/Driver/ToolChains/Clang.cpp

Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -7107,6 +7107,19 @@
   D.Diag(diag::err_drv_invalid_value) << A->getSpelling() << GuardArgs;
 }
   }
+
+  if (Arg *A = Args.getLastArg(options::OPT__SLASH_ZH)) {
+StringRef Val = A->getValue();
+if (Val.equals("MD5")) {
+  CmdArgs.push_back("-gsrc-hash-algorithm=md5");
+} else if (Val.equals("SHA1")) {
+  CmdArgs.push_back("-gsrc-hash-algorithm=sha1");
+} else if (Val.equals("SHA_256")) {
+  CmdArgs.push_back("-gsrc-hash-algorithm=sha256");
+} else {
+  D.Diag(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
+}
+  }
 }
 
 const char *Clang::getBaseInputName(const ArgList ,
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -572,8 +572,9 @@
   void CreateCompileUnit();
 
   /// Compute the file checksum debug info for input file ID.
-  Optional
-  computeChecksum(FileID FID, SmallString<32> ) const;
+  /// Storage of the checksum string is owned by the caller.
+  Optional>
+  computeChecksum(FileID FID, SmallString<64> ) const;
 
   /// Get the source of the given file ID.
   Optional getSource(const SourceManager , FileID FID);
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -44,9 +44,13 @@
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Format.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/SHA1.h"
+#include "llvm/Support/SHA256.h"
 #include "llvm/Support/TimeProfiler.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace clang;
 using namespace clang::CodeGen;
 
@@ -361,10 +365,12 @@
   return StringRef();
 }
 
-Optional
-CGDebugInfo::computeChecksum(FileID FID, SmallString<32> ) const {
+Optional>
+CGDebugInfo::computeChecksum(FileID FID, SmallString<64> ) const {
   Checksum.clear();
 
+  llvm::DIFile::ChecksumKind CSKind;
+  Optional> CSInfo;
   if (!CGM.getCodeGenOpts().EmitCodeView &&
   CGM.getCodeGenOpts().DwarfVersion < 5)
 return None;
@@ -374,14 +380,40 @@
   if (!MemBuffer)
 return None;
 
-  llvm::MD5 Hash;
-  llvm::MD5::MD5Result Result;
-
-  Hash.update(MemBuffer->getBuffer());
-  Hash.final(Result);
+  switch (CGM.getCodeGenOpts().getDebugSrcHashAlgorithm()) {
+  case clang::CodeGenOptions::CSK_MD5: {
+CSKind = llvm::DIFile::CSK_MD5;
+llvm::MD5 Hash;
+llvm::MD5::MD5Result Result;
+Hash.update(MemBuffer->getBuffer());
+Hash.final(Result);
+Checksum = Result.digest();
+break;
+  }
+  case clang::CodeGenOptions::CSK_SHA1: {
+CSKind = llvm::DIFile::CSK_SHA1;
+llvm::SHA1 Hash;
+Hash.update(MemBuffer->getBuffer());
+StringRef Result = Hash.final();
+llvm::raw_svector_ostream Res(Checksum);
+for (int i = 0; i < 20; ++i)
+  Res << llvm::format("%.2x", static_cast(Result[i]));
+break;
+  }
+  case clang::CodeGenOptions::CSK_SHA256: {
+CSKind = llvm::DIFile::CSK_SHA256;
+llvm::SHA256 Hash;
+Hash.update(MemBuffer->getBuffer());
+StringRef Result = Hash.final();
+llvm::raw_svector_ostream Res(Checksum);
+for (int i = 0; i < 32; ++i)
+  Res << llvm::format("%.2x", static_cast(Result[i]));
+break;
+  }
+  }
 
-  Hash.stringifyResult(Result, Checksum);
-  return llvm::DIFile::CSK_MD5;
+  CSInfo.emplace(CSKind, Checksum);
+  return CSInfo;
 }
 
 Optional CGDebugInfo::getSource(const SourceManager ,
@@ -428,12 +460,10 @@
   return cast(V);
   }
 
-  SmallString<32> Checksum;
+  SmallString<64> Checksum;
+  Optional> CSInfo =
+  computeChecksum(FID, Checksum);
 
-  Optional CSKind = computeChecksum(FID, Checksum);
-  Optional> CSInfo;
-  if (CSKind)
-CSInfo.emplace(*CSKind, Checksum);
   return createFile(FileName, CSInfo, getSource(SM, SM.getFileID(Loc)));
 }
 
@@ -519,8 +549,7 @@
 }
 
 void CGDebugInfo::CreateCompileUnit() {
-  SmallString<32> Checksum;
-  Optional CSKind;
+  SmallString<64> Checksum;
   Optional> CSInfo;
 
   // Should we be asking the SourceManager for the main file name, instead of
@@ 

[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-12 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8968-8970
 def note_defaulted_comparison_calls_deleted : Note<
   "defaulted %0 is implicitly deleted because it would invoke a deleted "
   "comparison function%select{| for member %2| for base class %2}1">;

rsmith wrote:
> Would it be useful to apply the same diagnostic improvement to this 
> diagnostic too? (Genuine question: I *think* we'll attach a note pointing to 
> the deleted function in this case, which would probably make the "for T" part 
> just be noise, but I've not checked.)
Yeah I thought about checking other errors for similar improvements. It's on my 
list to check that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97990

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added inline comments.



Comment at: clang/include/clang/Basic/LLVM.h:71
   using llvm::SmallString;
-  using llvm::SmallVector;
-  using llvm::SmallVectorImpl;

It's my bad to not wait for a build finished before updating the patch, I saw a 
lot of build failures as the following that seems related to the deletion here:
```
/data/xling/wyvern/master-external/llvm-project/clang/include/clang/Basic/Module.h:222:3:
 error: no template named 'SmallVector'; did you mean 'llvm::SmallVector'?
  SmallVector UnresolvedHeaders;
  ^~~
  llvm::SmallVector
/data/xling/wyvern/master-external/llvm-project/clang/include/clang/Basic/LLVM.h:38:42:
 note: 'llvm::SmallVector' declared here
  template class SmallVector;
 ^
```
I will update the patch accordingly after I have a successful build and run the 
test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

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


[PATCH] D96033: [clang-repl] Land initial infrastructure for incremental parsing

2021-03-12 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments.



Comment at: clang/lib/Interpreter/Interpreter.cpp:93
+   "Initialization failed. "
+   "Unable to create diagnostics engine");
+

sgraenitz wrote:
> It looks like `clang-repl` always dumps errors to stdout currently. This is 
> fine for the interactive use case, but it will be impractical for 
> input/output tests. As a result unit tests e.g. dump:
> ```
> Note: Google Test filter = InterpreterTest.Errors
> [==] Running 1 test from 1 test case.
> [--] Global test environment set-up.
> [--] 1 test from InterpreterTest
> [ RUN  ] InterpreterTest.Errors
> In file included from :0:
> input_line_0:1:1: error: unknown type name 'intentional_error'
> intentional_error v1 = 42; 
> ^
> [   OK ] InterpreterTest.Errors (9024 ms)
> [--] 1 test from InterpreterTest (9024 ms total)
> 
> [--] Global test environment tear-down
> [==] 1 test from 1 test case ran. (9025 ms total)
> [  PASSED  ] 1 test.
> ```
> 
> It would be useful to have an option for streaming diagnostics to an 
> in-memory buffer (and maybe append them to returned llvm::Error instances in 
> the future). Instead of `createDiagnostics()` you could pass a 
> TextDiagnosticPrinter via `setDiagnostics()` here to accomplish it.
> 
> Not insisting on having it in this review, but it would be a good follow-up 
> task at least.
I should have addressed it now I get:

```
[==] Running 5 tests from 2 test cases.
[--] Global test environment set-up.
[--] 1 test from IncrementalProcessing
[ RUN  ] IncrementalProcessing.EmitCXXGlobalInitFunc
[   OK ] IncrementalProcessing.EmitCXXGlobalInitFunc (17 ms)
[--] 1 test from IncrementalProcessing (17 ms total)

[--] 4 tests from InterpreterTest
[ RUN  ] InterpreterTest.Sanity
[   OK ] InterpreterTest.Sanity (8 ms)
[ RUN  ] InterpreterTest.IncrementalInputTopLevelDecls
[   OK ] InterpreterTest.IncrementalInputTopLevelDecls (9 ms)
[ RUN  ] InterpreterTest.Errors
[   OK ] InterpreterTest.Errors (91 ms)
[ RUN  ] InterpreterTest.DeclsAndStatements
[   OK ] InterpreterTest.DeclsAndStatements (8 ms)
[--] 4 tests from InterpreterTest (116 ms total)

[--] Global test environment tear-down
[==] 5 tests from 2 test cases ran. (133 ms total)
[  PASSED  ] 5 tests.
```



Comment at: clang/test/Interpreter/execute.c:9
+
+struct S { float f = 1.0; S *m = nullptr;} s;
+auto r2 = printf("S[f=%f, m=%p]\n", s.f, s.m);

sgraenitz wrote:
> *nit* this should be a cpp file right? Otherwise, you should write `struct S 
> *m = nullptr;` here. Also, C doesn't understand the `extern "C"` above :)
Thanks! It is C++ indeed and I have changed the file extension.


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

https://reviews.llvm.org/D96033

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


[PATCH] D96033: [clang-repl] Land initial infrastructure for incremental parsing

2021-03-12 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 330381.
v.g.vassilev marked 2 inline comments as done.
v.g.vassilev added a comment.

Address comments -- rename test file; add a logging diagnostic consumer.


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

https://reviews.llvm.org/D96033

Files:
  clang/include/clang/CodeGen/CodeGenAction.h
  clang/include/clang/Frontend/FrontendAction.h
  clang/include/clang/Interpreter/Interpreter.h
  clang/include/clang/Interpreter/Transaction.h
  clang/lib/CMakeLists.txt
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Interpreter/CMakeLists.txt
  clang/lib/Interpreter/IncrementalExecutor.cpp
  clang/lib/Interpreter/IncrementalExecutor.h
  clang/lib/Interpreter/IncrementalParser.cpp
  clang/lib/Interpreter/IncrementalParser.h
  clang/lib/Interpreter/Interpreter.cpp
  clang/test/CMakeLists.txt
  clang/test/Interpreter/execute.cpp
  clang/test/Interpreter/sanity.c
  clang/test/lit.cfg.py
  clang/tools/CMakeLists.txt
  clang/tools/clang-repl/CMakeLists.txt
  clang/tools/clang-repl/ClangRepl.cpp
  clang/unittests/CMakeLists.txt
  clang/unittests/CodeGen/CMakeLists.txt
  clang/unittests/CodeGen/IncrementalProcessingTest.cpp
  clang/unittests/Interpreter/CMakeLists.txt
  clang/unittests/Interpreter/IncrementalProcessingTest.cpp
  clang/unittests/Interpreter/InterpreterTest.cpp

Index: clang/unittests/Interpreter/InterpreterTest.cpp
===
--- /dev/null
+++ clang/unittests/Interpreter/InterpreterTest.cpp
@@ -0,0 +1,120 @@
+//===- unittests/Interpreter/InterpreterTest.cpp --- Interpreter tests ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// Unit tests for Clang's Interpreter library.
+//
+//===--===//
+
+#include "clang/Interpreter/Interpreter.h"
+
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclGroup.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/TextDiagnosticPrinter.h"
+
+#include "llvm/ADT/ArrayRef.h"
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using namespace clang;
+
+namespace {
+using Args = std::vector;
+static std::unique_ptr
+createInterpreter(const Args  = {},
+  DiagnosticConsumer* Client = nullptr) {
+  Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
+  ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
+  auto CI = cantFail(clang::IncrementalCompilerBuilder::create(ClangArgs));
+  if (Client)
+CI->getDiagnostics().setClient(Client, /*ShouldOwnClient=*/false);
+  return cantFail(clang::Interpreter::create(std::move(CI)));
+}
+
+TEST(InterpreterTest, Sanity) {
+  std::unique_ptr Interp = createInterpreter();
+  Transaction (cantFail(Interp->Parse("void g(); void g() {}")));
+  EXPECT_EQ(2U, R1.Decls.size());
+
+  Transaction (cantFail(Interp->Parse("int i;")));
+  EXPECT_EQ(1U, R2.Decls.size());
+}
+
+static std::string DeclToString(DeclGroupRef DGR) {
+  return llvm::cast(DGR.getSingleDecl())->getQualifiedNameAsString();
+}
+
+TEST(InterpreterTest, IncrementalInputTopLevelDecls) {
+  std::unique_ptr Interp = createInterpreter();
+  auto R1OrErr = Interp->Parse("int var1 = 42; int f() { return var1; }");
+  // gtest doesn't expand into explicit bool conversions.
+  EXPECT_TRUE(!!R1OrErr);
+  auto R1 = R1OrErr->Decls;
+  EXPECT_EQ(2U, R1.size());
+  EXPECT_EQ("var1", DeclToString(R1[0]));
+  EXPECT_EQ("f", DeclToString(R1[1]));
+
+  auto R2OrErr = Interp->Parse("int var2 = f();");
+  EXPECT_TRUE(!!R2OrErr);
+  auto R2 = R2OrErr->Decls;
+  EXPECT_EQ(1U, R2.size());
+  EXPECT_EQ("var2", DeclToString(R2[0]));
+}
+
+TEST(InterpreterTest, Errors) {
+  Args ExtraArgs = {"-Xclang", "-diagnostic-log-file", "-Xclang", "-" };
+
+  // Create the diagnostic engine with unowned consumer.
+  std::string DiagnosticOutput;
+  llvm::raw_string_ostream DiagnosticsOS(DiagnosticOutput);
+  auto DiagPrinter = std::make_unique(
+  DiagnosticsOS, new DiagnosticOptions());
+
+  auto Interp = createInterpreter(ExtraArgs, DiagPrinter.get());
+  auto Err = Interp->Parse("intentional_error v1 = 42; ").takeError();
+  using ::testing::HasSubstr;
+  EXPECT_THAT(DiagnosticsOS.str(),
+  HasSubstr("error: unknown type name 'intentional_error'"));
+  EXPECT_EQ("Parsing failed.", llvm::toString(std::move(Err)));
+
+  EXPECT_DEATH((void)Interp->Parse("int var1 = 42;"), "");
+}
+
+// Here we test whether the user can mix declarations and statements. The
+// interpreter should be smart enough to recognize the declarations from the
+// statements and wrap the latter into a declaration, producing valid code.
+TEST(InterpreterTest, DeclsAndStatements) {
+  Args 

[PATCH] D97993: [Driver] Suppress GCC detection under -B for non-Android

2021-03-12 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

@tstellar :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97993

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.
This revision is now accepted and ready to land.

Thanks @Xiangling_L and also to the other reviewers for the great comments. 
This LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 330369.
Xiangling_L marked 2 inline comments as done.
Xiangling_L added a comment.
Herald added a subscriber: jansvoboda11.

Addressed the comments;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

Files:
  clang/include/clang/Basic/LLVM.h
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -663,7 +663,7 @@
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector GeneratedArgs1;
+  SmallVector GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector GeneratedArgs2;
+  SmallVector GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1913,7 +1913,7 @@
 emitCapturedStmtCall(CodeGenFunction , EmittedClosureTy Cap,
  llvm::ArrayRef Args) {
   // Append the closure context to the argument.
-  llvm::SmallVector EffectiveArgs;
+  SmallVector EffectiveArgs;
   EffectiveArgs.reserve(Args.size() + 1);
   llvm::append_range(EffectiveArgs, Args);
   EffectiveArgs.push_back(Cap.second);
Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,9 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to prevent `too few template arguments for
+// class template 'SmallVector'` building error with build compilers like XL.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.
@@ -68,8 +71,6 @@
   using llvm::OwningArrayRef;
   using llvm::SaveAndRestore;
   using llvm::SmallString;
-  using llvm::SmallVector;
-  using llvm::SmallVectorImpl;
   using llvm::StringRef;
   using llvm::Twine;
   using llvm::VersionTuple;


Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -663,7 +663,7 @@
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector GeneratedArgs1;
+  SmallVector GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector GeneratedArgs2;
+  SmallVector GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1913,7 +1913,7 @@
 emitCapturedStmtCall(CodeGenFunction , EmittedClosureTy Cap,
  llvm::ArrayRef Args) {
   // Append the closure context to the argument.
-  llvm::SmallVector EffectiveArgs;
+  SmallVector EffectiveArgs;
   EffectiveArgs.reserve(Args.size() + 1);
   llvm::append_range(EffectiveArgs, Args);
   EffectiveArgs.push_back(Cap.second);
Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,9 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to prevent `too few template arguments for
+// class template 'SmallVector'` building error with build compilers like XL.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.
@@ -68,8 +71,6 @@
   using llvm::OwningArrayRef;
   using llvm::SaveAndRestore;
   using llvm::SmallString;
-  using llvm::SmallVector;
-  using llvm::SmallVectorImpl;
   using llvm::StringRef;
   using llvm::Twine;
   using 

[PATCH] D98556: [ASTMatchers][Dynamic] Add missing matchers from Registry

2021-03-12 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, steveire.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add the `fixedPointLiteral`, `hasAnyBody` and `templateArgumentLoc` to the 
dynamic matcher registry.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98556

Files:
  clang/lib/ASTMatchers/Dynamic/Registry.cpp


Index: clang/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -229,6 +229,7 @@
   REGISTER_MATCHER(expr);
   REGISTER_MATCHER(exprWithCleanups);
   REGISTER_MATCHER(fieldDecl);
+  REGISTER_MATCHER(fixedPointLiteral);
   REGISTER_MATCHER(floatLiteral);
   REGISTER_MATCHER(forDecomposition);
   REGISTER_MATCHER(forEach);
@@ -254,6 +255,7 @@
   REGISTER_MATCHER(hasAnyArgument);
   REGISTER_MATCHER(hasAnyBase);
   REGISTER_MATCHER(hasAnyBinding);
+  REGISTER_MATCHER(hasAnyBody);
   REGISTER_MATCHER(hasAnyClause);
   REGISTER_MATCHER(hasAnyConstructorInitializer);
   REGISTER_MATCHER(hasAnyDeclaration);
@@ -526,6 +528,7 @@
   REGISTER_MATCHER(tagType);
   REGISTER_MATCHER(templateArgument);
   REGISTER_MATCHER(templateArgumentCountIs);
+  REGISTER_MATCHER(templateArgumentLoc);
   REGISTER_MATCHER(templateName);
   REGISTER_MATCHER(templateSpecializationType);
   REGISTER_MATCHER(templateTemplateParmDecl);


Index: clang/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -229,6 +229,7 @@
   REGISTER_MATCHER(expr);
   REGISTER_MATCHER(exprWithCleanups);
   REGISTER_MATCHER(fieldDecl);
+  REGISTER_MATCHER(fixedPointLiteral);
   REGISTER_MATCHER(floatLiteral);
   REGISTER_MATCHER(forDecomposition);
   REGISTER_MATCHER(forEach);
@@ -254,6 +255,7 @@
   REGISTER_MATCHER(hasAnyArgument);
   REGISTER_MATCHER(hasAnyBase);
   REGISTER_MATCHER(hasAnyBinding);
+  REGISTER_MATCHER(hasAnyBody);
   REGISTER_MATCHER(hasAnyClause);
   REGISTER_MATCHER(hasAnyConstructorInitializer);
   REGISTER_MATCHER(hasAnyDeclaration);
@@ -526,6 +528,7 @@
   REGISTER_MATCHER(tagType);
   REGISTER_MATCHER(templateArgument);
   REGISTER_MATCHER(templateArgumentCountIs);
+  REGISTER_MATCHER(templateArgumentLoc);
   REGISTER_MATCHER(templateName);
   REGISTER_MATCHER(templateSpecializationType);
   REGISTER_MATCHER(templateTemplateParmDecl);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98554: Save strings for CC_PRINT env vars

2021-03-12 Thread Sean via Phabricator via cfe-commits
SeanP created this revision.
SeanP added reviewers: hubert.reinterpretcast, uweigand, Kai.
SeanP requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The contents of the string returned by getenv() is not guaranteed across calls 
to getenv().  The code to handle the CC_PRINT etc env vars calls getenv() and 
saves the results in just a char *.  The string returned by getenv() needs to 
be copied and saved.  Switching the type of the strings from char * to 
std::string will do this and manage the alloated memory.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98554

Files:
  clang/include/clang/Driver/Driver.h
  clang/lib/Driver/Compilation.cpp
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Clang.cpp


Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5107,7 +5107,7 @@
 
   if (D.CCPrintHeaders && !D.CCGenDiagnostics) {
 CmdArgs.push_back("-header-include-file");
-CmdArgs.push_back(D.CCPrintHeadersFilename ? D.CCPrintHeadersFilename
+CmdArgs.push_back(!D.CCPrintHeadersFilename.empty() ? 
D.CCPrintHeadersFilename.c_str()
: "-");
 CmdArgs.push_back("-sys-header-deps");
   }
@@ -5116,7 +5116,7 @@
 
   if (D.CCLogDiagnostics && !D.CCGenDiagnostics) {
 CmdArgs.push_back("-diagnostic-log-file");
-CmdArgs.push_back(D.CCLogDiagnosticsFilename ? D.CCLogDiagnosticsFilename
+CmdArgs.push_back(!D.CCLogDiagnosticsFilename.empty() ? 
D.CCLogDiagnosticsFilename.c_str()
  : "-");
   }
 
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -135,9 +135,9 @@
 : Diags(Diags), VFS(std::move(VFS)), Mode(GCCMode),
   SaveTemps(SaveTempsNone), BitcodeEmbed(EmbedNone), LTOMode(LTOK_None),
   ClangExecutable(ClangExecutable), SysRoot(DEFAULT_SYSROOT),
-  DriverTitle(Title), CCPrintStatReportFilename(nullptr),
-  CCPrintOptionsFilename(nullptr), CCPrintHeadersFilename(nullptr),
-  CCLogDiagnosticsFilename(nullptr), CCCPrintBindings(false),
+  DriverTitle(Title), CCPrintStatReportFilename(),
+  CCPrintOptionsFilename(), CCPrintHeadersFilename(),
+  CCLogDiagnosticsFilename(), CCCPrintBindings(false),
   CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false),
   CCGenDiagnostics(false), CCPrintProcessStats(false),
   TargetTriple(TargetTriple), CCCGenericGCCName(""), Saver(Alloc),
@@ -4040,7 +4040,7 @@
   else
 LinkingOutput = getDefaultImageName();
 
-  if (!CCPrintStatReportFilename) {
+  if (CCPrintStatReportFilename.empty()) {
 using namespace llvm;
 // Human readable output.
 outs() << sys::path::filename(Cmd.getExecutable()) << ": "
@@ -4063,7 +4063,7 @@
 << '\n';
 Out.flush();
 std::error_code EC;
-llvm::raw_fd_ostream OS(CCPrintStatReportFilename, EC,
+llvm::raw_fd_ostream OS(CCPrintStatReportFilename.c_str(), EC,
 llvm::sys::fs::OF_Append);
 if (EC)
   return;
Index: clang/lib/Driver/Compilation.cpp
===
--- clang/lib/Driver/Compilation.cpp
+++ clang/lib/Driver/Compilation.cpp
@@ -170,10 +170,10 @@
 
 // Follow gcc implementation of CC_PRINT_OPTIONS; we could also cache the
 // output stream.
-if (getDriver().CCPrintOptions && getDriver().CCPrintOptionsFilename) {
+if (getDriver().CCPrintOptions && 
!getDriver().CCPrintOptionsFilename.empty()) {
   std::error_code EC;
   OwnedStream.reset(new llvm::raw_fd_ostream(
-  getDriver().CCPrintOptionsFilename, EC,
+  getDriver().CCPrintOptionsFilename.c_str(), EC,
   llvm::sys::fs::OF_Append | llvm::sys::fs::OF_Text));
   if (EC) {
 getDriver().Diag(diag::err_drv_cc_print_options_failure)
Index: clang/include/clang/Driver/Driver.h
===
--- clang/include/clang/Driver/Driver.h
+++ clang/include/clang/Driver/Driver.h
@@ -157,16 +157,16 @@
   std::string HostBits, HostMachine, HostSystem, HostRelease;
 
   /// The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled.
-  const char *CCPrintStatReportFilename;
+  std::string CCPrintStatReportFilename;
 
   /// The file to log CC_PRINT_OPTIONS output to, if enabled.
-  const char *CCPrintOptionsFilename;
+  std::string CCPrintOptionsFilename;
 
   /// The file to log CC_PRINT_HEADERS output to, if enabled.
-  const char *CCPrintHeadersFilename;
+  std::string CCPrintHeadersFilename;
 
   /// The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
-  const char *CCLogDiagnosticsFilename;

[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L marked 2 inline comments as done.
Xiangling_L added inline comments.



Comment at: clang/include/clang/Basic/LLVM.h:25
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to unblock the XL build compiler issue.
+#include "llvm/ADT/SmallVector.h"

RKSimon wrote:
> Is there a better comment? "unblock the XL build compiler issue" isn't going 
> to mean much to someone in the future
How about "Add this header as a workaround to prevent "too few template 
arguments for class template 'SmallVector' ""? Or do you have any suggestion?



Comment at: clang/include/clang/Basic/LLVM.h:38
   template class SmallVector;
   template class SmallVectorImpl;
   template class Optional;

RKSimon wrote:
> Should these 2 forward declarations be removed?
Thanks. will do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

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


[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-12 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8968-8970
 def note_defaulted_comparison_calls_deleted : Note<
   "defaulted %0 is implicitly deleted because it would invoke a deleted "
   "comparison function%select{| for member %2| for base class %2}1">;

Would it be useful to apply the same diagnostic improvement to this diagnostic 
too? (Genuine question: I *think* we'll attach a note pointing to the deleted 
function in this case, which would probably make the "for T" part just be 
noise, but I've not checked.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97990

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added a comment.

In D98552#2623399 , @jsji wrote:

> If we use this workaround, can we also revert 
> 561fb7f60ab631e712c3fb6bbeb47061222c6818 
>  and 
> 8dc70bdcd0fe4efb65876dce0144d9c3386a2f07 
>  in this 
> patch?

Good idea. Will do


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: clang/include/clang/Basic/LLVM.h:25
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to unblock the XL build compiler issue.
+#include "llvm/ADT/SmallVector.h"

Is there a better comment? "unblock the XL build compiler issue" isn't going to 
mean much to someone in the future



Comment at: clang/include/clang/Basic/LLVM.h:38
   template class SmallVector;
   template class SmallVectorImpl;
   template class Optional;

Should these 2 forward declarations be removed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

If we use this workaround, can we also revert 
561fb7f60ab631e712c3fb6bbeb47061222c6818 
 and 
8dc70bdcd0fe4efb65876dce0144d9c3386a2f07 
 in this 
patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98552

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


[PATCH] D98552: [NFC] Adjust SmallVector.h header to workaround XL build compiler issue

2021-03-12 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L created this revision.
Xiangling_L added reviewers: rzurob, hubert.reinterpretcast, jsji, lei, 
cebowleratibm.
Herald added a subscriber: dexonsmith.
Xiangling_L requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Previously we delivered a patch to workaround the building issue related to 
SmallVector here:
https://reviews.llvm.org/D98265.

But in order to prevent further building issues related to the usage of it in 
other compilation unit, this patch adjusts the `llvm.h` header as a workaround 
instead.

We will further investigate the real problem of build compiler as a follow-up.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98552

Files:
  clang/include/clang/Basic/LLVM.h


Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,8 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to unblock the XL build compiler issue.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.


Index: clang/include/clang/Basic/LLVM.h
===
--- clang/include/clang/Basic/LLVM.h
+++ clang/include/clang/Basic/LLVM.h
@@ -22,6 +22,8 @@
 // None.h includes an enumerator that is desired & cannot be forward declared
 // without a definition of NoneType.
 #include "llvm/ADT/None.h"
+// Add this header as a workaround to unblock the XL build compiler issue.
+#include "llvm/ADT/SmallVector.h"
 
 namespace llvm {
   // ADT's.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97680: [OpenMP] Simplify GPU memory globalization

2021-03-12 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 updated this revision to Diff 330352.
jhuber6 added a comment.
Herald added a subscriber: ormris.

Changed the RTL to have an argument that indicates if there is only one active 
caller for a team. This makes it easier to optimize.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97680

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/globalization_remarks.ll
  openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu
  openmp/libomptarget/deviceRTLs/interface.h

Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -424,13 +424,8 @@
 EXTERN bool __kmpc_kernel_parallel(void **WorkFn);
 EXTERN void __kmpc_kernel_end_parallel();
 
-EXTERN void __kmpc_data_sharing_init_stack();
-EXTERN void __kmpc_data_sharing_init_stack_spmd();
-EXTERN void *__kmpc_data_sharing_coalesced_push_stack(size_t size,
-  int16_t UseSharedMemory);
-EXTERN void *__kmpc_data_sharing_push_stack(size_t size,
-int16_t UseSharedMemory);
-EXTERN void __kmpc_data_sharing_pop_stack(void *a);
+EXTERN void *__kmpc_alloc_shared(size_t Size, int16_t OnePerTeam);
+EXTERN void __kmpc_free_shared(void *Data);
 EXTERN void __kmpc_begin_sharing_variables(void ***GlobalArgs, size_t nArgs);
 EXTERN void __kmpc_end_sharing_variables();
 EXTERN void __kmpc_get_shared_variables(void ***GlobalArgs);
@@ -445,4 +440,11 @@
 EXTERN void __kmpc_restore_team_static_memory(int16_t isSPMDExecutionMode,
   int16_t is_shared);
 
+// Deprecated globalization interface
+EXTERN void *__kmpc_data_sharing_coalesced_push_stack(size_t size, int16_t s);
+EXTERN void *__kmpc_data_sharing_push_stack(size_t size, int16_t s);
+EXTERN void __kmpc_data_sharing_pop_stack(void *a);
+EXTERN void __kmpc_data_sharing_init_stack();
+EXTERN void __kmpc_data_sharing_init_stack_spmd();
+
 #endif
Index: openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu
+++ openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu
@@ -24,187 +24,16 @@
 // Runtime functions for trunk data sharing scheme.
 
 
-INLINE static void data_sharing_init_stack_common() {
-  ASSERT0(LT_FUSSY, isRuntimeInitialized(), "Runtime must be initialized.");
-  omptarget_nvptx_TeamDescr *teamDescr =
-  _nvptx_threadPrivateContext->TeamContext();
-
-  for (int WID = 0; WID < DS_Max_Warp_Number; WID++) {
-__kmpc_data_sharing_slot *RootS = teamDescr->GetPreallocatedSlotAddr(WID);
-DataSharingState.SlotPtr[WID] = RootS;
-DataSharingState.StackPtr[WID] = (void *)>Data[0];
-  }
+// Allocate memory that can be shared between the threads.
+// TODO: Add a small buffer of shared memory to allocate memory from
+// TODO: Add an INFO message to communicate with the user
+EXTERN void *__kmpc_alloc_shared(size_t DataSize, int16_t IsOnePerTeam) {
+  return (void *)SafeMalloc(DataSize, "Alloc Shared");
 }
 
-// Initialize data sharing data structure. This function needs to be called
-// once at the beginning of a data sharing context (coincides with the kernel
-// initialization). This function is called only by the MASTER thread of each
-// team in non-SPMD mode.
-EXTERN void __kmpc_data_sharing_init_stack() {
-  ASSERT0(LT_FUSSY, isRuntimeInitialized(), "Runtime must be initialized.");
-  // This function initializes the stack pointer with the pointer to the
-  // statically allocated shared memory slots. The size of a shared memory
-  // slot is pre-determined to be 256 bytes.
-  data_sharing_init_stack_common();
-  omptarget_nvptx_globalArgs.Init();
-}
-
-// Initialize data sharing data structure. This function needs to be called
-// once at the beginning of a data sharing context (coincides with the kernel
-// initialization). This function is called in SPMD mode only.
-EXTERN void __kmpc_data_sharing_init_stack_spmd() {
-  ASSERT0(LT_FUSSY, isRuntimeInitialized(), "Runtime must be initialized.");
-  // This function initializes the stack pointer with the pointer to the
-  // statically allocated shared memory slots. The size of a shared memory
-  // slot is pre-determined to be 256 bytes.
-  if (GetThreadIdInBlock() == 0)
-data_sharing_init_stack_common();
-
-  __kmpc_impl_threadfence_block();
-}
-
-INLINE static void *data_sharing_push_stack_common(size_t PushSize) {
-  ASSERT0(LT_FUSSY, isRuntimeInitialized(), "Expected initialized runtime.");
-
-  // Only 

[PATCH] D98237: [clang-format] Option for empty lines after an access modifier.

2021-03-12 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added a comment.

I'm missing tests with both EmptyLineBeforeAccessModifier and 
EmptyLine(s)AfterAccessModifier options.
And possibly other options that could interfere with them.




Comment at: clang/include/clang/Format/Format.h:1957
+  /// Defines how many lines are put after access modifiers.
+  unsigned EmptyLinesAfterAccessModifier;
+

This option seems to be very different from `EmptyLineBeforeAccessModifier`. I 
don't mean in what it does, because this is analogical, but in the possible 
options.
Wouldn't it be less surprising to have (at least some) similar options here and 
there?
Is there any value in having more than one line after access modifiers? 
Couldn't that be achieved with Leave option?
How do the two options work together?

Also, the difference in singular vs. plural form of "Line(s)" in these two 
options is disconcerting.
From the user perspective, it's error-prone to have two options that are at the 
same time so similar and so different.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98237

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


[PATCH] D98277: [release][docs] List all cores Arm has added support for in LLVM 12.

2021-03-12 Thread Amilendra Kodithuwakku via Phabricator via cfe-commits
amilendra closed this revision.
amilendra added a comment.

Commited the fix to LLVM Release 12.x branch. Rendering looks okay this time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98277

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


[PATCH] D89909: [SYCL] Implement SYCL address space attributes handling

2021-03-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D89909#2623211 , @Anastasia wrote:

> In D89909#2617194 , @bader wrote:
>
>> @Anastasia, do you suggest we copy 
>> https://github.com/intel/llvm/blob/sycl/sycl/doc/CompilerAndRuntimeDesign.md 
>> document to clang/docs within this patch?
>
> For the purpose of this specific topic, you could indeed move "Address spaces 
> handling" section into the clang documentation. I would suggest creating a 
> dedicated page where you could gather SYCL specific internals for the clang 
> community. You could also link the github page to it for more comprehensive 
> details.
>
> I would recommend extending the documentation slightly to focus on what 
> behavior is expected to be implemented rather than how you propose to 
> implement it in clang too. This is a general guideline for the clang 
> contributions that suggest that the documentation should be detailed such 
> that it would be possible to implement it in other frontend/compiler. You 
> could for example include some more information on expected language semantic 
> i.e. what you inherit from embedded C and what you inherent from OpenCL or 
> any other available language features with relevant spec/doc references 
> including SYCL spec. This should facilitate anyone who needs to understand 
> the implementation to find further details.
>
> It would probably make sense to create a separate review to avoid adding too 
> much noise here. Once you create a review we can link it here and also refine 
> any necessary details as we go along.

These all seem like good suggestions, from my limited perspective, so thank you 
for them! I'm not opposed to the documentation requests, however, I think that 
is work that is separable from the proposed changes in this review and could be 
done with post-commit follow-ups, unless you think the current documentation is 
wrong as it relates to this patch. I worry that back-and-forth on documentation 
clarity (while certainly important) is going to hold this patch up for several 
more months, which is a burden.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89909

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D97058#2623160 , @thakis wrote:

> I'm going to revert this in 30 minutes. The tree has been red for 12h due to 
> this then.

I have committed the fix mentioned above. Apology for the delay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D98277: [release][docs] List all cores Arm has added support for in LLVM 12.

2021-03-12 Thread Kristof Beyls via Phabricator via cfe-commits
kristof.beyls accepted this revision.
kristof.beyls added a comment.
This revision is now accepted and ready to land.

Still LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98277

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


[PATCH] D98548: [clang][Sema] Don't try to initialize implicit variable of invalid anonymous union/struct

2021-03-12 Thread Ta-Wei Tu via Phabricator via cfe-commits
TaWeiTu added a comment.

I'm not familiar with this code and clang/sema in general, so not sure if the 
fix makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98548

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


[PATCH] D98548: [clang][Sema] Don't try to initialize implicit variable of invalid anonymous union/struct

2021-03-12 Thread Ta-Wei Tu via Phabricator via cfe-commits
TaWeiTu created this revision.
TaWeiTu added reviewers: tmatheson, rsmith, dnsampaio.
TaWeiTu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This fixes https://bugs.llvm.org/show_bug.cgi?id=49534, where the call to the 
constructor 
of the anonymous union is checked and triggers assertion failure when trying to 
retrieve 
the alignment of the `this` argument (which is a union with virtual function).

The extra check for alignment was introduced in D97187 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98548

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/PR49534.cpp


Index: clang/test/SemaCXX/PR49534.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR49534.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -x c++ -fsyntax-only %s -verify
+
+static union { // expected-warning {{declaration does not declare 
anything}}
+  virtual int a(); // expected-error {{unions cannot have virtual functions}} \
+   // expected-error {{functions cannot be declared in an 
anonymous union}}
+};
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5211,7 +5211,8 @@
 // trivial in almost all cases, except if a union member has an in-class
 // initializer:
 //   union { int n = 0; };
-ActOnUninitializedDecl(Anon);
+if (!Invalid)
+  ActOnUninitializedDecl(Anon);
   }
   Anon->setImplicit();
 


Index: clang/test/SemaCXX/PR49534.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR49534.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -x c++ -fsyntax-only %s -verify
+
+static union { // expected-warning {{declaration does not declare anything}}
+  virtual int a(); // expected-error {{unions cannot have virtual functions}} \
+   // expected-error {{functions cannot be declared in an anonymous union}}
+};
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5211,7 +5211,8 @@
 // trivial in almost all cases, except if a union member has an in-class
 // initializer:
 //   union { int n = 0; };
-ActOnUninitializedDecl(Anon);
+if (!Invalid)
+  ActOnUninitializedDecl(Anon);
   }
   Anon->setImplicit();
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D89909: [SYCL] Implement SYCL address space attributes handling

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D89909#2617194 , @bader wrote:

> In D89909#2606180 , @Anastasia wrote:
>
>> In D89909#2600859 , @aaron.ballman 
>> wrote:
>>
>>> Just a few minor nits from me, but I'm mostly wondering: where are we at 
>>> with this and are there still substantive changes required? (I looked 
>>> through the comments, but there's a lot of back-and-forth since Oct and I'm 
>>> not certain what's holding the patch back currently.)
>>
>> To make it short, from my side I am not very clear about the overall design. 
>> From the SYCL spec side, there is no indication of what compiler extensions 
>> are needed and if at all. As a result, some of the design choices are 
>> unclear to me - in particular why SPIR target would need a separate address 
>> space map for SYCL. This is not how it was intended originally and I am 
>> worried that this will create issues for the consumers of IR to handle two 
>> different formats. But in general, if the community is now to maintain this 
>> code we should at least have some deeper understanding of it.
>>
>> I would suggest starting from some high-level documentation that provides 
>> the details of the compiler extension being implemented. Perhaps the 
>> documentation that @bader has linked earlier could be used as a starting 
>> point with some more details that would allow assessing and reviewing the 
>> changes.
>
> @Anastasia, do you suggest we copy 
> https://github.com/intel/llvm/blob/sycl/sycl/doc/CompilerAndRuntimeDesign.md 
> document to clang/docs within this patch?

For the purpose of this specific topic, you could indeed move "Address spaces 
handling" section into the clang documentation. I would suggest creating a 
dedicated page where you could gather SYCL specific internals for the clang 
community. You could also link the github page to it for more comprehensive 
details.

I would recommend extending the documentation slightly to focus on what 
behavior is expected to be implemented rather than how you propose to implement 
it in clang too. This is a general guideline for the clang contributions that 
suggest that the documentation should be detailed such that it would be 
possible to implement it in other frontend/compiler. You could for example 
include some more information on expected language semantic i.e. what you 
inherit from embedded C and what you inherent from OpenCL or any other 
available language features with relevant spec/doc references including SYCL 
spec. This should facilitate anyone who needs to understand the implementation 
to find further details.

It would probably make sense to create a separate review to avoid adding too 
much noise here. Once you create a review we can link it here and also refine 
any necessary details as we go along.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89909

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


[PATCH] D97411: [DebugInfo] Add an attribute to force type info to be emitted for types that are required to be complete.

2021-03-12 Thread Amy Huang 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 rGd7cd208f08af: [DebugInfo] Add an attribute to force type 
info to be emitted for types that… (authored by akhuang).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97411

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/standalone-debug-attribute.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Sema/attr-standalonedebug.cpp

Index: clang/test/Sema/attr-standalonedebug.cpp
===
--- /dev/null
+++ clang/test/Sema/attr-standalonedebug.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -x c
+
+#ifdef __cplusplus
+int a __attribute__((standalone_debug)); // expected-warning {{'standalone_debug' attribute only applies to classes}}
+
+void __attribute__((standalone_debug)) b(); // expected-warning {{'standalone_debug' attribute only applies to classes}}
+
+struct __attribute__((standalone_debug(1))) c {}; // expected-error {{'standalone_debug' attribute takes no arguments}}
+
+#else
+// Check that attribute only works in C++.
+struct __attribute__((standalone_debug)) a {}; // expected-warning {{'standalone_debug' attribute ignored}}
+#endif
Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -154,6 +154,7 @@
 // CHECK-NEXT: Section (SubjectMatchRule_function, SubjectMatchRule_variable_is_global, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property)
 // CHECK-NEXT: SetTypestate (SubjectMatchRule_function_is_member)
 // CHECK-NEXT: SpeculativeLoadHardening (SubjectMatchRule_function, SubjectMatchRule_objc_method)
+// CHECK-NEXT: StandaloneDebug (SubjectMatchRule_record)
 // CHECK-NEXT: SwiftAsync (SubjectMatchRule_function, SubjectMatchRule_objc_method)
 // CHECK-NEXT: SwiftAsyncError (SubjectMatchRule_function, SubjectMatchRule_objc_method)
 // CHECK-NEXT: SwiftAsyncName (SubjectMatchRule_objc_method, SubjectMatchRule_function)
Index: clang/test/CodeGenCXX/standalone-debug-attribute.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/standalone-debug-attribute.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=DEBUG
+// RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=WITHATTR
+// Use -debug-info-kind=constructor because it includes all the optimizations.
+
+#if SETATTR
+#define STANDALONEDEBUGATTR __attribute__((standalone_debug))
+#else
+#define STANDALONEDEBUGATTR
+#endif
+
+struct STANDALONEDEBUGATTR StructWithConstructor {
+  StructWithConstructor() {}
+};
+void f(StructWithConstructor s) {}
+// DEBUG:  !DICompositeType({{.*}}name: "StructWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "StructWithConstructor"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+union STANDALONEDEBUGATTR UnionWithConstructor {
+  UnionWithConstructor() {}
+};
+void f(UnionWithConstructor u) {}
+// DEBUG:  !DICompositeType({{.*}}name: "UnionWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "UnionWithConstructor"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+template  struct ExternTemplate {
+  ExternTemplate() {}
+  T x;
+};
+extern template struct STANDALONEDEBUGATTR ExternTemplate;
+void f(ExternTemplate s) {}
+// DEBUG: !DICompositeType({{.*}}name: "ExternTemplate"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "ExternTemplate"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+struct STANDALONEDEBUGATTR CompleteTypeRequired {};
+void f(CompleteTypeRequired ) {}
+// DEBUG: !DICompositeType({{.*}}name: "CompleteTypeRequired"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "CompleteTypeRequired"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+struct STANDALONEDEBUGATTR Redecl;
+struct Redecl {};
+void f(Redecl ) {}
+// DEBUG: !DICompositeType({{.*}}name: "Redecl"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "Redecl"
+// WITHATTR-NOT: DIFlagFwdDecl
+
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ 

[clang] d7cd208 - [DebugInfo] Add an attribute to force type info to be emitted for types that are required to be complete.

2021-03-12 Thread Amy Huang via cfe-commits

Author: Amy Huang
Date: 2021-03-12T12:30:01-08:00
New Revision: d7cd208f08afca450484be97604a55704a628e88

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

LOG: [DebugInfo] Add an attribute to force type info to be emitted for types 
that are required to be complete.

This was motivated by the fact that constructor type homing (debug info
optimization that we want to turn on by default) drops some libc++ types,
so an attribute would allow us to override constructor homing and emit
them anyway. I'm currently looking into the particular libc++ issue, but
even if we do fix that, this issue might come up elsewhere and it might be
nice to have this.

As I've implemented it now, the attribute isn't specific to the
constructor homing optimization and overrides all of the debug info
optimizations.

Open to discussion about naming, specifics on what the attribute should do, etc.

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

Added: 
clang/test/CodeGenCXX/standalone-debug-attribute.cpp
clang/test/Sema/attr-standalonedebug.cpp

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/Misc/pragma-attribute-supported-attributes-list.test

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 9625e7f8f3221..664eb566a7032 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -1673,6 +1673,14 @@ def NoDebug : InheritableAttr {
   let Documentation = [NoDebugDocs];
 }
 
+def StandaloneDebug : InheritableAttr {
+  let Spellings = [Clang<"standalone_debug", /*allowInC =*/0>];
+  let Subjects = SubjectList<[CXXRecord]>;
+  let Documentation = [StandaloneDebugDocs];
+  let SimpleHandler = 1;
+  let LangOpts = [CPlusPlus];
+}
+
 def NoDuplicate : InheritableAttr {
   let Spellings = [Clang<"noduplicate">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index deda68b64f909..77d3bd1fdcd6e 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -1102,6 +1102,16 @@ data member, or for a typedef or using declaration.
   }];
 }
 
+def StandaloneDebugDocs : Documentation {
+  let Category = DocCatVariable;
+  let Content = [{
+The ``standalone_debug`` attribute causes debug info to be emitted for a record
+type regardless of the debug info optimizations that are enabled with
+-fno-standalone-debug. This attribute only has an effect when debug info
+optimizations are enabled (e.g. with -fno-standalone-debug), and is C++-only.
+  }];
+}
+
 def NoDuplicateDocs : Documentation {
   let Category = DocCatFunction;
   let Content = [{

diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 0aa8737b9f07d..468c2b78b488d 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2385,7 +2385,8 @@ static bool 
shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind,
   if (DebugKind == codegenoptions::DebugLineTablesOnly)
 return true;
 
-  if (DebugKind > codegenoptions::LimitedDebugInfo)
+  if (DebugKind > codegenoptions::LimitedDebugInfo ||
+  RD->hasAttr())
 return false;
 
   if (!LangOpts.CPlusPlus)

diff  --git a/clang/test/CodeGenCXX/standalone-debug-attribute.cpp 
b/clang/test/CodeGenCXX/standalone-debug-attribute.cpp
new file mode 100644
index 0..a814e6f425ed6
--- /dev/null
+++ b/clang/test/CodeGenCXX/standalone-debug-attribute.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm 
-debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=DEBUG
+// RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm 
-debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=WITHATTR
+// Use -debug-info-kind=constructor because it includes all the optimizations.
+
+#if SETATTR
+#define STANDALONEDEBUGATTR __attribute__((standalone_debug))
+#else
+#define STANDALONEDEBUGATTR
+#endif
+
+struct STANDALONEDEBUGATTR StructWithConstructor {
+  StructWithConstructor() {}
+};
+void f(StructWithConstructor s) {}
+// DEBUG:  !DICompositeType({{.*}}name: "StructWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "StructWithConstructor"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+union STANDALONEDEBUGATTR UnionWithConstructor {
+  UnionWithConstructor() {}
+};
+void f(UnionWithConstructor u) {}
+// DEBUG:  !DICompositeType({{.*}}name: "UnionWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "UnionWithConstructor"
+// WITHATTR-NOT: 

[PATCH] D98277: [release][docs] List all cores Arm has added support for in LLVM 12.

2021-03-12 Thread Amilendra Kodithuwakku via Phabricator via cfe-commits
amilendra requested review of this revision.
amilendra added a comment.

Sorry for the back-and-forth. Requesting re-review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98277

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


[PATCH] D98277: [release][docs] List all cores Arm has added support for in LLVM 12.

2021-03-12 Thread Amilendra Kodithuwakku via Phabricator via cfe-commits
amilendra updated this revision to Diff 330345.
amilendra added a comment.

Add a newline before the sub-list to fix a rendering issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98277

Files:
  clang/docs/ReleaseNotes.rst


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -132,6 +132,7 @@
   (`D92054 `_)
 - Support has been added for the following processors (command-line identifiers
   in parentheses):
+
   - Arm Cortex-A78C (cortex-a78c).
   - Arm Cortex-R82 (cortex-r82).
   - Arm Neoverse V1 (neoverse-v1).


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -132,6 +132,7 @@
   (`D92054 `_)
 - Support has been added for the following processors (command-line identifiers
   in parentheses):
+
   - Arm Cortex-A78C (cortex-a78c).
   - Arm Cortex-R82 (cortex-r82).
   - Arm Neoverse V1 (neoverse-v1).
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97411: [DebugInfo] Add an attribute to force type info to be emitted for types that are required to be complete.

2021-03-12 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 330344.
akhuang added a comment.

add allowInC to attribute


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97411

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/standalone-debug-attribute.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Sema/attr-standalonedebug.cpp

Index: clang/test/Sema/attr-standalonedebug.cpp
===
--- /dev/null
+++ clang/test/Sema/attr-standalonedebug.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -x c
+
+#ifdef __cplusplus
+int a __attribute__((standalone_debug)); // expected-warning {{'standalone_debug' attribute only applies to classes}}
+
+void __attribute__((standalone_debug)) b(); // expected-warning {{'standalone_debug' attribute only applies to classes}}
+
+struct __attribute__((standalone_debug(1))) c {}; // expected-error {{'standalone_debug' attribute takes no arguments}}
+
+#else
+// Check that attribute only works in C++.
+struct __attribute__((standalone_debug)) a {}; // expected-warning {{'standalone_debug' attribute ignored}}
+#endif
Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -154,6 +154,7 @@
 // CHECK-NEXT: Section (SubjectMatchRule_function, SubjectMatchRule_variable_is_global, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property)
 // CHECK-NEXT: SetTypestate (SubjectMatchRule_function_is_member)
 // CHECK-NEXT: SpeculativeLoadHardening (SubjectMatchRule_function, SubjectMatchRule_objc_method)
+// CHECK-NEXT: StandaloneDebug (SubjectMatchRule_record)
 // CHECK-NEXT: SwiftAsync (SubjectMatchRule_function, SubjectMatchRule_objc_method)
 // CHECK-NEXT: SwiftAsyncError (SubjectMatchRule_function, SubjectMatchRule_objc_method)
 // CHECK-NEXT: SwiftAsyncName (SubjectMatchRule_objc_method, SubjectMatchRule_function)
Index: clang/test/CodeGenCXX/standalone-debug-attribute.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/standalone-debug-attribute.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=DEBUG
+// RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=WITHATTR
+// Use -debug-info-kind=constructor because it includes all the optimizations.
+
+#if SETATTR
+#define STANDALONEDEBUGATTR __attribute__((standalone_debug))
+#else
+#define STANDALONEDEBUGATTR
+#endif
+
+struct STANDALONEDEBUGATTR StructWithConstructor {
+  StructWithConstructor() {}
+};
+void f(StructWithConstructor s) {}
+// DEBUG:  !DICompositeType({{.*}}name: "StructWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "StructWithConstructor"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+union STANDALONEDEBUGATTR UnionWithConstructor {
+  UnionWithConstructor() {}
+};
+void f(UnionWithConstructor u) {}
+// DEBUG:  !DICompositeType({{.*}}name: "UnionWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "UnionWithConstructor"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+template  struct ExternTemplate {
+  ExternTemplate() {}
+  T x;
+};
+extern template struct STANDALONEDEBUGATTR ExternTemplate;
+void f(ExternTemplate s) {}
+// DEBUG: !DICompositeType({{.*}}name: "ExternTemplate"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "ExternTemplate"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+struct STANDALONEDEBUGATTR CompleteTypeRequired {};
+void f(CompleteTypeRequired ) {}
+// DEBUG: !DICompositeType({{.*}}name: "CompleteTypeRequired"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "CompleteTypeRequired"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+struct STANDALONEDEBUGATTR Redecl;
+struct Redecl {};
+void f(Redecl ) {}
+// DEBUG: !DICompositeType({{.*}}name: "Redecl"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "Redecl"
+// WITHATTR-NOT: DIFlagFwdDecl
+
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2385,7 +2385,8 @@
   if (DebugKind == codegenoptions::DebugLineTablesOnly)
 return true;
 
-  if (DebugKind > codegenoptions::LimitedDebugInfo)
+  if (DebugKind > 

[PATCH] D98539: [OpenCL] Set target as spir for c-index-test for OpenCL

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D98539#2623038 , @thakis wrote:

> Can we get this landed asap please?

Done! Sorry for the noise.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98539

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

I'm going to revert this in 30 minutes. The tree has been red for 12h due to 
this then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D98539: [OpenCL] Set target as spir for c-index-test for OpenCL

2021-03-12 Thread Anastasia Stulova 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 rGeed88e91f331: [OpenCL] Use spir target for CIndex tests for 
OpenCL. (authored by Anastasia).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98539

Files:
  clang/test/Index/cxx.cl
  clang/test/Index/opencl-types.cl


Index: clang/test/Index/opencl-types.cl
===
--- clang/test/Index/opencl-types.cl
+++ clang/test/Index/opencl-types.cl
@@ -1,4 +1,4 @@
-// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s
+// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 -target spir | 
FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
Index: clang/test/Index/cxx.cl
===
--- clang/test/Index/cxx.cl
+++ clang/test/Index/cxx.cl
@@ -3,5 +3,5 @@
   addrspace_cast<__global int*>(ptr);
 }
 
-// RUN: c-index-test -test-load-source all %s -cl-std=clc++ | FileCheck %s
+// RUN: c-index-test -test-load-source all %s -cl-std=clc++ -target spir | 
FileCheck %s
 // CHECK: cxx.cl:3:3: CXXAddrspaceCastExpr


Index: clang/test/Index/opencl-types.cl
===
--- clang/test/Index/opencl-types.cl
+++ clang/test/Index/opencl-types.cl
@@ -1,4 +1,4 @@
-// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s
+// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 -target spir | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
Index: clang/test/Index/cxx.cl
===
--- clang/test/Index/cxx.cl
+++ clang/test/Index/cxx.cl
@@ -3,5 +3,5 @@
   addrspace_cast<__global int*>(ptr);
 }
 
-// RUN: c-index-test -test-load-source all %s -cl-std=clc++ | FileCheck %s
+// RUN: c-index-test -test-load-source all %s -cl-std=clc++ -target spir | FileCheck %s
 // CHECK: cxx.cl:3:3: CXXAddrspaceCastExpr
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] eed88e9 - [OpenCL] Use spir target for CIndex tests for OpenCL.

2021-03-12 Thread Anastasia Stulova via cfe-commits

Author: Anastasia Stulova
Date: 2021-03-12T20:11:26Z
New Revision: eed88e91f331d158d3d0c91e91fca408c9f1d1e1

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

LOG: [OpenCL] Use spir target for CIndex tests for OpenCL.

This fixes failing bots.

Patch by azabaznov (Anton Zabaznov)!

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

Added: 


Modified: 
clang/test/Index/cxx.cl
clang/test/Index/opencl-types.cl

Removed: 




diff  --git a/clang/test/Index/cxx.cl b/clang/test/Index/cxx.cl
index f4b03d78740e..997d4288669f 100644
--- a/clang/test/Index/cxx.cl
+++ b/clang/test/Index/cxx.cl
@@ -3,5 +3,5 @@ void test(int *ptr) {
   addrspace_cast<__global int*>(ptr);
 }
 
-// RUN: c-index-test -test-load-source all %s -cl-std=clc++ | FileCheck %s
+// RUN: c-index-test -test-load-source all %s -cl-std=clc++ -target spir | 
FileCheck %s
 // CHECK: cxx.cl:3:3: CXXAddrspaceCastExpr

diff  --git a/clang/test/Index/opencl-types.cl 
b/clang/test/Index/opencl-types.cl
index 496f38752fa2..485060167d21 100644
--- a/clang/test/Index/opencl-types.cl
+++ b/clang/test/Index/opencl-types.cl
@@ -1,4 +1,4 @@
-// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s
+// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 -target spir | 
FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable



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


[PATCH] D98546: [PowerPC] Add __PCREL__ when PC Relative is enabled.

2021-03-12 Thread Stefan Pintilie via Phabricator via cfe-commits
stefanp created this revision.
stefanp added a reviewer: nemanjai.
Herald added subscribers: shchenz, kbarton.
stefanp requested review of this revision.
Herald added a project: clang.

This patch adds the __PCREL__ define when PC Relative addressing is enabled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98546

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


Index: clang/test/Preprocessor/init-ppc64.c
===
--- clang/test/Preprocessor/init-ppc64.c
+++ clang/test/Preprocessor/init-ppc64.c
@@ -633,6 +633,7 @@
 // PPCPOWER10:#define _ARCH_PWR8 1
 // PPCPOWER10:#define _ARCH_PWR9 1
 // PPCPOWER10:#define __MMA__ 1
+// PPCPOWER10:#define __PCREL__ 1
 // PPCPOWER10-NOT:#define __ROP_PROTECTION__ 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none 
-target-cpu future -fno-signed-char < /dev/null | FileCheck -match-full-lines 
-check-prefix PPCFUTURE %s
@@ -652,6 +653,7 @@
 // PPCFUTURE:#define _ARCH_PWR9 1
 // PPCFUTURE:#define _ARCH_PWR_FUTURE 1
 // PPCFUTURE:#define __MMA__ 1
+// PPCFUTURE:#define __PCREL__ 1
 // PPCFUTURE-NOT:#define __ROP_PROTECTION__ 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none 
-target-feature +mma -target-cpu power10 -fno-signed-char < /dev/null | 
FileCheck -check-prefix PPC-MMA %s
Index: clang/lib/Basic/Targets/PPC.cpp
===
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -199,6 +199,8 @@
 Builder.defineMacro("__ROP_PROTECTION__");
   if (HasP10Vector)
 Builder.defineMacro("__POWER10_VECTOR__");
+  if (HasPCRelativeMemops)
+Builder.defineMacro("__PCREL__");
 
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");


Index: clang/test/Preprocessor/init-ppc64.c
===
--- clang/test/Preprocessor/init-ppc64.c
+++ clang/test/Preprocessor/init-ppc64.c
@@ -633,6 +633,7 @@
 // PPCPOWER10:#define _ARCH_PWR8 1
 // PPCPOWER10:#define _ARCH_PWR9 1
 // PPCPOWER10:#define __MMA__ 1
+// PPCPOWER10:#define __PCREL__ 1
 // PPCPOWER10-NOT:#define __ROP_PROTECTION__ 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu future -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCFUTURE %s
@@ -652,6 +653,7 @@
 // PPCFUTURE:#define _ARCH_PWR9 1
 // PPCFUTURE:#define _ARCH_PWR_FUTURE 1
 // PPCFUTURE:#define __MMA__ 1
+// PPCFUTURE:#define __PCREL__ 1
 // PPCFUTURE-NOT:#define __ROP_PROTECTION__ 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +mma -target-cpu power10 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-MMA %s
Index: clang/lib/Basic/Targets/PPC.cpp
===
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -199,6 +199,8 @@
 Builder.defineMacro("__ROP_PROTECTION__");
   if (HasP10Vector)
 Builder.defineMacro("__POWER10_VECTOR__");
+  if (HasPCRelativeMemops)
+Builder.defineMacro("__PCREL__");
 
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 42eb658 - [OpaquePtrs] Remove some uses of type-less CreateGEP() (NFC)

2021-03-12 Thread Nikita Popov via cfe-commits

Author: Nikita Popov
Date: 2021-03-12T21:01:16+01:00
New Revision: 42eb658f656c43ee63e25222f32acb86ad7b

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

LOG: [OpaquePtrs] Remove some uses of type-less CreateGEP() (NFC)

This removes some (but not all) uses of type-less CreateGEP()
and CreateInBoundsGEP() APIs, which are incompatible with opaque
pointers.

There are a still a number of tricky uses left, as well as many
more variation APIs for CreateGEP.

Added: 


Modified: 
clang/lib/CodeGen/CGBuilder.h
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/CodeGen/CGNonTrivialStruct.cpp
clang/lib/CodeGen/CGObjCRuntime.cpp
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/lib/CodeGen/TargetInfo.cpp
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/lib/Transforms/Scalar/SROA.cpp
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
polly/lib/CodeGen/RuntimeDebugBuilder.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuilder.h b/clang/lib/CodeGen/CGBuilder.h
index 4e22db67c57e..e79d72885e54 100644
--- a/clang/lib/CodeGen/CGBuilder.h
+++ b/clang/lib/CodeGen/CGBuilder.h
@@ -213,7 +213,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
 CharUnits::fromQuantity(DL.getTypeAllocSize(ElTy->getElementType()));
 
 return Address(
-CreateInBoundsGEP(Addr.getPointer(),
+CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
   {getSize(CharUnits::Zero()), getSize(Index)}, Name),
 Addr.getAlignment().alignmentAtOffset(Index * EltSize));
   }
@@ -254,7 +254,8 @@ class CGBuilderTy : public CGBuilderBaseTy {
   Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset,
  const llvm::Twine  = "") {
 assert(Addr.getElementType() == TypeCache.Int8Ty);
-return Address(CreateInBoundsGEP(Addr.getPointer(), getSize(Offset), Name),
+return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
+ getSize(Offset), Name),
Addr.getAlignment().alignmentAtOffset(Offset));
   }
   Address CreateConstByteGEP(Address Addr, CharUnits Offset,

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index a3a33e46583b..ed43e5fd091f 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -3251,7 +3251,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 Builder.CreateMemCpy(Dest, Src, SizeVal, false);
 if (BuiltinID == Builtin::BImempcpy ||
 BuiltinID == Builtin::BI__builtin_mempcpy)
-  return RValue::get(Builder.CreateInBoundsGEP(Dest.getPointer(), 
SizeVal));
+  return RValue::get(Builder.CreateInBoundsGEP(Dest.getElementType(),
+   Dest.getPointer(), 
SizeVal));
 else
   return RValue::get(Dest.getPointer());
   }
@@ -4682,7 +4683,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   auto *Zero = llvm::ConstantInt::get(IntTy, 0);
   for (unsigned I = First; I < NumArgs; ++I) {
 auto *Index = llvm::ConstantInt::get(IntTy, I - First);
-auto *GEP = Builder.CreateGEP(TmpPtr, {Zero, Index});
+auto *GEP = Builder.CreateGEP(Tmp.getElementType(), TmpPtr,
+  {Zero, Index});
 if (I == First)
   ElemPtr = GEP;
 auto *V =
@@ -8984,7 +8986,7 @@ Value 
*CodeGenFunction::EmitAArch64SVEBuiltinExpr(unsigned BuiltinID,
 for (unsigned I = 0; I < NumOpnds; ++I)
   Builder.CreateDefaultAlignedStore(
   IsBoolTy ? Builder.CreateZExt(Ops[I], EltTy) : Ops[I],
-  Builder.CreateGEP(Alloca.getPointer(),
+  Builder.CreateGEP(Alloca.getElementType(), Alloca.getPointer(),
 {Builder.getInt64(0), Builder.getInt64(I)}));
 
 SVETypeFlags TypeFlags(Builtin->TypeModifier);
@@ -8993,7 +8995,8 @@ Value 
*CodeGenFunction::EmitAArch64SVEBuiltinExpr(unsigned BuiltinID,
 llvm::Type *OverloadedTy = getSVEVectorForElementType(EltTy);
 Function *F = CGM.getIntrinsic(Intrinsic::aarch64_sve_ld1rq, OverloadedTy);
 Value *Alloca0 = Builder.CreateGEP(
-Alloca.getPointer(), {Builder.getInt64(0), Builder.getInt64(0)});
+Alloca.getElementType(), Alloca.getPointer(),
+{Builder.getInt64(0), Builder.getInt64(0)});
 Value *LD1RQ = Builder.CreateCall(F, {Pred, 

[PATCH] D97080: [flang][driver] Add -fintrinsic-modules-path option

2021-03-12 Thread Arnamoy B via Phabricator via cfe-commits
arnamoy10 updated this revision to Diff 330337.
arnamoy10 edited the summary of this revision.
arnamoy10 added a comment.

Update the path based on the patch D98522 


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

https://reviews.llvm.org/D97080

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/include/flang/Frontend/PreprocessorOptions.h
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Driver/Inputs/ieee_arithmetic.mod
  flang/test/Driver/Inputs/iso_fortran_env.mod
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90
  flang/test/Driver/intrinsic_module_path.f90

Index: flang/test/Driver/intrinsic_module_path.f90
===
--- /dev/null
+++ flang/test/Driver/intrinsic_module_path.f90
@@ -0,0 +1,35 @@
+! Ensure argument -fintrinsic-modules-path works as expected.
+! WITHOUT the option, the default location for the module is checked and no error generated.
+! With the option GIVEN, the module with the same name is PREPENDED, and considered over the
+! default one, causing a CHECKSUM error.
+
+
+!--
+! FLANG DRIVER (flang-new)
+!--
+! RUN: %flang-new -fsyntax-only %s  2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
+! RUN: not %flang-new -fsyntax-only -fintrinsic-modules-path %S/Inputs/ %s  2>&1 | FileCheck %s --check-prefix=GIVEN
+
+!-
+! FRONTEND FLANG DRIVER (flang-new -fc1)
+!-
+! RUN: %flang-new -fc1 %s  2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
+! RUN: not %flang-new -fc1 -fintrinsic-modules-path %S/Inputs/ %s  2>&1 | FileCheck %s --check-prefix=GIVEN
+
+!-
+! EXPECTED OUTPUT WITHOUT
+!-
+! WITHOUT-NOT: 'ieee_arithmetic.mod' was not found
+! WITHOUT-NOT: 'iso_fortran_env.mod' was not found
+
+!-
+! EXPECTED OUTPUT WITH
+!-
+! GIVEN: error: Cannot read module file for module 'ieee_arithmetic': File has invalid checksum
+! GIVEN: error: Cannot read module file for module 'iso_fortran_env': File has invalid checksum
+
+
+program test_intrinsic_module_path
+   use ieee_arithmetic, only: ieee_round_type
+   use iso_fortran_env, only: team_type, event_type, lock_type
+end program
Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -35,6 +35,8 @@
 ! HELP-NEXT: -ffree-formProcess source files in free form
 ! HELP-NEXT: -fimplicit-noneNo implicit typing allowed unless overridden by IMPLICIT statements
 ! HELP-NEXT: -finput-charset= Specify the default character set for source files
+! HELP-NEXT: -fintrinsic-modules-path 
+! HELP-NEXT:Specify where to find the compiled intrinsic modules
 ! HELP-NEXT: -flarge-sizes  Use INTEGER(KIND=8) for the result type in size-related intrinsics
 ! HELP-NEXT: -flogical-abbreviations Enable logical abbreviations
 ! HELP-NEXT: -fno-color-diagnostics Disable colors in diagnostics
@@ -82,6 +84,8 @@
 ! HELP-FC1-NEXT: -ffree-formProcess source files in free form
 ! HELP-FC1-NEXT: -fimplicit-noneNo implicit typing allowed unless overridden by IMPLICIT statements
 ! HELP-FC1-NEXT: -finput-charset= Specify the default character set for source files
+! HELP-FC1-NEXT: -fintrinsic-modules-path 
+! HELP-FC1-NEXT:Specify where to find the compiled intrinsic modules
 ! HELP-FC1-NEXT: -flarge-sizes  Use INTEGER(KIND=8) for the result type in size-related intrinsics
 ! HELP-FC1-NEXT: -flogical-abbreviations Enable logical abbreviations
 ! HELP-FC1-NEXT: -fopenacc  Enable OpenACC
Index: flang/test/Driver/driver-help-hidden.f90
===
--- flang/test/Driver/driver-help-hidden.f90
+++ flang/test/Driver/driver-help-hidden.f90
@@ -35,6 +35,8 @@
 ! CHECK-NEXT: -ffree-formProcess source files in free form
 ! CHECK-NEXT: -fimplicit-noneNo implicit typing allowed unless overridden by IMPLICIT statements
 ! CHECK-NEXT: -finput-charset= Specify the default character set for source files
+! CHECK-NEXT: -fintrinsic-modules-path 
+! CHECK-NEXT:Specify where to find the compiled intrinsic modules
 ! CHECK-NEXT: -flarge-sizes  Use INTEGER(KIND=8) for the result type in size-related intrinsics
 ! CHECK-NEXT: -flogical-abbreviations Enable logical abbreviations
 ! CHECK-NEXT: -fno-color-diagnostics Disable colors in diagnostics
Index: flang/test/Driver/Inputs/iso_fortran_env.mod
===
--- /dev/null

[PATCH] D98457: [WebAssembly] Remove unimplemented-simd target features

2021-03-12 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:3801
 Pass -z  to the linker
-

dschuff wrote:
> extraneous change?
Yes, will revert, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98457

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


[PATCH] D98457: [WebAssembly] Remove unimplemented-simd target features

2021-03-12 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: clang/include/clang/Basic/BuiltinsWebAssembly.def:191
 
-TARGET_BUILTIN(__builtin_wasm_qfma_f32x4, "V4fV4fV4fV4f", "nc", 
"unimplemented-simd128")
-TARGET_BUILTIN(__builtin_wasm_qfms_f32x4, "V4fV4fV4fV4f", "nc", 
"unimplemented-simd128")
-TARGET_BUILTIN(__builtin_wasm_qfma_f64x2, "V2dV2dV2dV2d", "nc", 
"unimplemented-simd128")
-TARGET_BUILTIN(__builtin_wasm_qfms_f64x2, "V2dV2dV2dV2d", "nc", 
"unimplemented-simd128")
+TARGET_BUILTIN(__builtin_wasm_qfma_f32x4, "V4fV4fV4fV4f", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_qfms_f32x4, "V4fV4fV4fV4f", "nc", "simd128")

dschuff wrote:
> is QFMA actually in MVP simd? I thought it was non-deterministic?
No, as you discovered, it's removed in the next patch. I kind of ended up with 
these patches in the wrong order, but I think it should be ok.



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:1712
 };
-  } else if (NumConstantLanes >= NumSplatLanes &&
- Subtarget->hasUnimplementedSIMD128()) {
-// If we support v128.const, emit it directly
+  } else if (NumConstantLanes >= NumSplatLanes) {
 SmallVector ConstLanes;

dschuff wrote:
> out of curiosity, are there any cases where a splat could be smaller than a 
> v128 const, since the consts are pretty big?
Yes, for sure. In fact, this code used to find the const lowering that resulted 
in the fewest bytes emitted. Our users much prefer to have the fewest 
instructions emitted, though, since this lowering is often critical for 
performance.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98457

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


[PATCH] D98504: [clang][Checkers] Fix PthreadLockChecker state cleanup at dead symbol.

2021-03-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment.

Hi, @balazske




Comment at: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:290-304
   // Existence in DestroyRetVal ensures existence in LockMap.
   // Existence in Destroyed also ensures that the lock state for lockR is 
either
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
   assert(lstate->isUntouchedAndPossiblyDestroyed() ||
  lstate->isUnlockedAndPossiblyDestroyed());
 
   ConstraintManager  = state->getConstraintManager();

I'm just wondering, did you think about such way of fixing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98504

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


[PATCH] D98277: [release][docs] List all cores Arm has added support for in LLVM 12.

2021-03-12 Thread Amilendra Kodithuwakku via Phabricator via cfe-commits
amilendra reopened this revision.
amilendra added a comment.
This revision is now accepted and ready to land.

Reopening to add a missing empty line before starting the level-2 list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98277

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


[PATCH] D98539: [OpenCL] Set target as spir for c-index-test for OpenCL

2021-03-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Can we get this landed asap please?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98539

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


[clang] d7b7e20 - Revert "[Clang][ARM] Reenable arm_acle.c test."

2021-03-12 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-03-12T14:37:37-05:00
New Revision: d7b7e2026b0a8b575df9ee7c4042ecff450f6549

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

LOG: Revert "[Clang][ARM] Reenable arm_acle.c test."

This reverts commit 5ae949a9276542b46f41374fbe7aee01e480d9d6.
Test fails everywhere.

Added: 


Modified: 
clang/test/CodeGen/arm_acle.c

Removed: 




diff  --git a/clang/test/CodeGen/arm_acle.c b/clang/test/CodeGen/arm_acle.c
index 7e85c767c301..9f0ad22bda4f 100644
--- a/clang/test/CodeGen/arm_acle.c
+++ b/clang/test/CodeGen/arm_acle.c
@@ -1,229 +1,125 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 -ffreestanding -triple armv8-eabi -target-cpu cortex-a57 
-O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s 
-check-prefixes=ARM,AArch32
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +neon -target-feature +crc -target-feature +crypto -O0 
-disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s 
-check-prefixes=ARM,AArch64
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.3a -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.5a -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483
+// RUN: %clang_cc1 -ffreestanding -triple armv8-eabi -target-cpu cortex-a57 
-O2  -fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch32 -check-prefix=ARM-LEGACY 
-check-prefix=AArch32-LEGACY
+// RUN: %clang_cc1 -ffreestanding -triple armv8-eabi -target-cpu cortex-a57 
-O2  -fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch32 -check-prefix=ARM-NEWPM 
-check-prefix=AArch32-NEWPM
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +neon -target-feature +crc -target-feature +crypto -O2 
-fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch64 -check-prefix=ARM-LEGACY 
-check-prefix=AArch64-LEGACY
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +neon -target-feature +crc -target-feature +crypto -O2 
-fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch64 -check-prefix=ARM-NEWPM 
-check-prefix=AArch64-NEWPM
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.3a -O2 -fexperimental-new-pass-manager -S -emit-llvm -o - 
%s | FileCheck %s -check-prefix=AArch64-v8_3
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.4a -O2 -fexperimental-new-pass-manager -S -emit-llvm -o - 
%s | FileCheck %s -check-prefix=AArch64-v8_3
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.5a -O2 -fexperimental-new-pass-manager -S -emit-llvm -o - 
%s | FileCheck %s -check-prefix=AArch64-v8_3
+
+// REQUIRES: rewrite
 
 #include 
 
 /* 8 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
 /* 8.3 Memory Barriers */
-
-// AArch32-LABEL: @test_dmb(
-// AArch32-NEXT:  entry:
-// AArch32-NEXT:call void @llvm.arm.dmb(i32 1)
-// AArch32-NEXT:ret void
-//
-// AArch64-LABEL: @test_dmb(
-// AArch64-NEXT:  entry:
-// AArch64-NEXT:call void @llvm.aarch64.dmb(i32 1)
-// AArch64-NEXT:ret void
-//
+// ARM-LABEL: test_dmb
+// AArch32: call void @llvm.arm.dmb(i32 1)
+// AArch64: call void @llvm.aarch64.dmb(i32 1)
 void test_dmb(void) {
   __dmb(1);
 }
 
-// AArch32-LABEL: @test_dsb(
-// AArch32-NEXT:  entry:
-// AArch32-NEXT:call void @llvm.arm.dsb(i32 2)
-// AArch32-NEXT:ret void
-//
-// AArch64-LABEL: @test_dsb(
-// AArch64-NEXT:  entry:
-// AArch64-NEXT:call void @llvm.aarch64.dsb(i32 2)
-// AArch64-NEXT:ret void
-//
+// ARM-LABEL: test_dsb
+// AArch32: call void @llvm.arm.dsb(i32 2)
+// AArch64: call void @llvm.aarch64.dsb(i32 2)
 void test_dsb(void) {
   __dsb(2);
 }
 
-// AArch32-LABEL: @test_isb(
-// AArch32-NEXT:  entry:
-// AArch32-NEXT:call void @llvm.arm.isb(i32 3)
-// AArch32-NEXT:ret void
-//
-// AArch64-LABEL: @test_isb(
-// AArch64-NEXT:  entry:
-// AArch64-NEXT:call void @llvm.aarch64.isb(i32 3)
-// AArch64-NEXT:ret void
-//
+// ARM-LABEL: test_isb
+// AArch32: call void @llvm.arm.isb(i32 3)
+// AArch64: call void @llvm.aarch64.isb(i32 3)
 void test_isb(void) {
   __isb(3);
 }
 
 /* 8.4 Hints */
-// 

[PATCH] D98277: [release][docs] List all cores Arm has added support for in LLVM 12.

2021-03-12 Thread Amilendra Kodithuwakku via Phabricator via cfe-commits
amilendra closed this revision.
amilendra added a comment.

Commited to LLVM Release 12.x branch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98277

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


[PATCH] D97411: [DebugInfo] Add an attribute to force type info to be emitted for types that are required to be complete.

2021-03-12 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 330316.
akhuang added a comment.
Herald added a subscriber: jdoerfert.

update test case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97411

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/standalone-debug-attribute.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Sema/attr-standalonedebug.cpp

Index: clang/test/Sema/attr-standalonedebug.cpp
===
--- /dev/null
+++ clang/test/Sema/attr-standalonedebug.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -x c
+
+#ifdef __cplusplus
+int a __attribute__((standalone_debug)); // expected-warning {{'standalone_debug' attribute only applies to classes}}
+
+void __attribute__((standalone_debug)) b(); // expected-warning {{'standalone_debug' attribute only applies to classes}}
+
+struct __attribute__((standalone_debug(1))) c {}; // expected-error {{'standalone_debug' attribute takes no arguments}}
+
+#else
+// Check that attribute only works in C++.
+struct __attribute__((standalone_debug)) a {}; // expected-warning {{'standalone_debug' attribute ignored}}
+#endif
Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -154,6 +154,7 @@
 // CHECK-NEXT: Section (SubjectMatchRule_function, SubjectMatchRule_variable_is_global, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property)
 // CHECK-NEXT: SetTypestate (SubjectMatchRule_function_is_member)
 // CHECK-NEXT: SpeculativeLoadHardening (SubjectMatchRule_function, SubjectMatchRule_objc_method)
+// CHECK-NEXT: StandaloneDebug (SubjectMatchRule_record)
 // CHECK-NEXT: SwiftAsync (SubjectMatchRule_function, SubjectMatchRule_objc_method)
 // CHECK-NEXT: SwiftAsyncError (SubjectMatchRule_function, SubjectMatchRule_objc_method)
 // CHECK-NEXT: SwiftAsyncName (SubjectMatchRule_objc_method, SubjectMatchRule_function)
Index: clang/test/CodeGenCXX/standalone-debug-attribute.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/standalone-debug-attribute.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -DSETATTR=0 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=DEBUG
+// RUN: %clang_cc1 -DSETATTR=1 -triple x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=constructor %s -o - | FileCheck %s --check-prefix=WITHATTR
+// Use -debug-info-kind=constructor because it includes all the optimizations.
+
+#if SETATTR
+#define STANDALONEDEBUGATTR __attribute__((standalone_debug))
+#else
+#define STANDALONEDEBUGATTR
+#endif
+
+struct STANDALONEDEBUGATTR StructWithConstructor {
+  StructWithConstructor() {}
+};
+void f(StructWithConstructor s) {}
+// DEBUG:  !DICompositeType({{.*}}name: "StructWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "StructWithConstructor"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+union STANDALONEDEBUGATTR UnionWithConstructor {
+  UnionWithConstructor() {}
+};
+void f(UnionWithConstructor u) {}
+// DEBUG:  !DICompositeType({{.*}}name: "UnionWithConstructor"
+// DEBUG-SAME:  flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "UnionWithConstructor"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+template  struct ExternTemplate {
+  ExternTemplate() {}
+  T x;
+};
+extern template struct STANDALONEDEBUGATTR ExternTemplate;
+void f(ExternTemplate s) {}
+// DEBUG: !DICompositeType({{.*}}name: "ExternTemplate"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "ExternTemplate"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+struct STANDALONEDEBUGATTR CompleteTypeRequired {};
+void f(CompleteTypeRequired ) {}
+// DEBUG: !DICompositeType({{.*}}name: "CompleteTypeRequired"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "CompleteTypeRequired"
+// WITHATTR-NOT: DIFlagFwdDecl
+
+struct STANDALONEDEBUGATTR Redecl;
+struct Redecl {};
+void f(Redecl ) {}
+// DEBUG: !DICompositeType({{.*}}name: "Redecl"
+// DEBUG-SAME: flags: {{.*}}DIFlagFwdDecl
+// WITHATTR: !DICompositeType({{.*}}name: "Redecl"
+// WITHATTR-NOT: DIFlagFwdDecl
+
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2385,7 +2385,8 @@
   if (DebugKind == codegenoptions::DebugLineTablesOnly)
 return true;
 
-  if (DebugKind > 

[clang] 5ae949a - [Clang][ARM] Reenable arm_acle.c test.

2021-03-12 Thread David Green via cfe-commits

Author: David Green
Date: 2021-03-12T19:21:21Z
New Revision: 5ae949a9276542b46f41374fbe7aee01e480d9d6

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

LOG: [Clang][ARM] Reenable arm_acle.c test.

This test was apparently disabled in 6fcd4e080f09c9765d6, without any
sign of how it was going to be reenabled. This patch rewrites the test
to use update_cc_test_checks, with midend optimizations other that
mem2reg disabled.

Added: 


Modified: 
clang/test/CodeGen/arm_acle.c

Removed: 




diff  --git a/clang/test/CodeGen/arm_acle.c b/clang/test/CodeGen/arm_acle.c
index 9f0ad22bda4f..7e85c767c301 100644
--- a/clang/test/CodeGen/arm_acle.c
+++ b/clang/test/CodeGen/arm_acle.c
@@ -1,125 +1,229 @@
-// RUN: %clang_cc1 -ffreestanding -triple armv8-eabi -target-cpu cortex-a57 
-O2  -fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch32 -check-prefix=ARM-LEGACY 
-check-prefix=AArch32-LEGACY
-// RUN: %clang_cc1 -ffreestanding -triple armv8-eabi -target-cpu cortex-a57 
-O2  -fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch32 -check-prefix=ARM-NEWPM 
-check-prefix=AArch32-NEWPM
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +neon -target-feature +crc -target-feature +crypto -O2 
-fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch64 -check-prefix=ARM-LEGACY 
-check-prefix=AArch64-LEGACY
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +neon -target-feature +crc -target-feature +crypto -O2 
-fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
-check-prefix=ARM -check-prefix=AArch64 -check-prefix=ARM-NEWPM 
-check-prefix=AArch64-NEWPM
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.3a -O2 -fexperimental-new-pass-manager -S -emit-llvm -o - 
%s | FileCheck %s -check-prefix=AArch64-v8_3
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.4a -O2 -fexperimental-new-pass-manager -S -emit-llvm -o - 
%s | FileCheck %s -check-prefix=AArch64-v8_3
-// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.5a -O2 -fexperimental-new-pass-manager -S -emit-llvm -o - 
%s | FileCheck %s -check-prefix=AArch64-v8_3
-
-// REQUIRES: rewrite
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -ffreestanding -triple armv8-eabi -target-cpu cortex-a57 
-O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s 
-check-prefixes=ARM,AArch32
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +neon -target-feature +crc -target-feature +crypto -O0 
-disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s 
-check-prefixes=ARM,AArch64
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.3a -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483
+// RUN: %clang_cc1 -ffreestanding -triple aarch64-eabi -target-cpu cortex-a57 
-target-feature +v8.5a -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483
 
 #include 
 
 /* 8 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
 /* 8.3 Memory Barriers */
-// ARM-LABEL: test_dmb
-// AArch32: call void @llvm.arm.dmb(i32 1)
-// AArch64: call void @llvm.aarch64.dmb(i32 1)
+
+// AArch32-LABEL: @test_dmb(
+// AArch32-NEXT:  entry:
+// AArch32-NEXT:call void @llvm.arm.dmb(i32 1)
+// AArch32-NEXT:ret void
+//
+// AArch64-LABEL: @test_dmb(
+// AArch64-NEXT:  entry:
+// AArch64-NEXT:call void @llvm.aarch64.dmb(i32 1)
+// AArch64-NEXT:ret void
+//
 void test_dmb(void) {
   __dmb(1);
 }
 
-// ARM-LABEL: test_dsb
-// AArch32: call void @llvm.arm.dsb(i32 2)
-// AArch64: call void @llvm.aarch64.dsb(i32 2)
+// AArch32-LABEL: @test_dsb(
+// AArch32-NEXT:  entry:
+// AArch32-NEXT:call void @llvm.arm.dsb(i32 2)
+// AArch32-NEXT:ret void
+//
+// AArch64-LABEL: @test_dsb(
+// AArch64-NEXT:  entry:
+// AArch64-NEXT:call void @llvm.aarch64.dsb(i32 2)
+// AArch64-NEXT:ret void
+//
 void test_dsb(void) {
   __dsb(2);
 }
 
-// ARM-LABEL: test_isb
-// AArch32: call void @llvm.arm.isb(i32 3)
-// AArch64: call void @llvm.aarch64.isb(i32 3)
+// AArch32-LABEL: @test_isb(
+// AArch32-NEXT:  entry:
+// AArch32-NEXT:call void @llvm.arm.isb(i32 3)
+// AArch32-NEXT:ret void
+//
+// AArch64-LABEL: @test_isb(
+// AArch64-NEXT:  entry:
+// AArch64-NEXT:call void 

[PATCH] D98466: [WebAssembly] Remove experimental SIMD instructions

2021-03-12 Thread Derek Schuff via Phabricator via cfe-commits
dschuff accepted this revision.
dschuff added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/include/clang/Basic/BuiltinsWebAssembly.def:191
 
-TARGET_BUILTIN(__builtin_wasm_qfma_f32x4, "V4fV4fV4fV4f", "nc", "simd128")
-TARGET_BUILTIN(__builtin_wasm_qfms_f32x4, "V4fV4fV4fV4f", "nc", "simd128")

I guess this answers my question from the previous review :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98466

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


[PATCH] D98457: [WebAssembly] Remove unimplemented-simd target features

2021-03-12 Thread Derek Schuff via Phabricator via cfe-commits
dschuff accepted this revision.
dschuff added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/docs/ClangCommandLineReference.rst:3801
 Pass -z  to the linker
-

extraneous change?



Comment at: clang/include/clang/Basic/BuiltinsWebAssembly.def:191
 
-TARGET_BUILTIN(__builtin_wasm_qfma_f32x4, "V4fV4fV4fV4f", "nc", 
"unimplemented-simd128")
-TARGET_BUILTIN(__builtin_wasm_qfms_f32x4, "V4fV4fV4fV4f", "nc", 
"unimplemented-simd128")
-TARGET_BUILTIN(__builtin_wasm_qfma_f64x2, "V2dV2dV2dV2d", "nc", 
"unimplemented-simd128")
-TARGET_BUILTIN(__builtin_wasm_qfms_f64x2, "V2dV2dV2dV2d", "nc", 
"unimplemented-simd128")
+TARGET_BUILTIN(__builtin_wasm_qfma_f32x4, "V4fV4fV4fV4f", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_qfms_f32x4, "V4fV4fV4fV4f", "nc", "simd128")

is QFMA actually in MVP simd? I thought it was non-deterministic?



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:1712
 };
-  } else if (NumConstantLanes >= NumSplatLanes &&
- Subtarget->hasUnimplementedSIMD128()) {
-// If we support v128.const, emit it directly
+  } else if (NumConstantLanes >= NumSplatLanes) {
 SmallVector ConstLanes;

out of curiosity, are there any cases where a splat could be smaller than a 
v128 const, since the consts are pretty big?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98457

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D97058#2622883 , @azabaznov wrote:

> Yes, I was able to reproduce the failure with `-target arm64-apple-macosx` 
> flag, I provided the fix to set explicit target: 
> https://reviews.llvm.org/D98539.

I have approved it. Thanks!

> @Anastasia, I tried to cherry-pick https://reviews.llvm.org/D92244, but the 
> error is still reproducible.

Do you also get `fatal error: 'opencl-c-base.h' file not found`? If so, we 
might need at least to file a clang bug that we should look at before the next 
release.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D98539: [OpenCL] Set target as spir for c-index-test for OpenCL

2021-03-12 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! I can't see why we would need to tests anything target-specific here 
anyway, so I think the change is reasonable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98539

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov added a comment.

Yes, I was able to reproduce the failure with `-target arm64-apple-macosx` 
flag, I provided the fix to set explicit target: 
https://reviews.llvm.org/D98539.

@Anastasia, I tried to cherry-pick https://reviews.llvm.org/D92244, but the 
error is still reproducible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D98539: [OpenCL] Set target as spir for c-index-test for OpenCL

2021-03-12 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov created this revision.
azabaznov added reviewers: Anastasia, svenvh, thakis.
Herald added subscribers: arphaman, yaxunl.
azabaznov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Otherwise (for other targets) testing may be non-determistic as
targets support different extension/feature set, but SPIR target
support all extensions/features by default


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98539

Files:
  clang/test/Index/cxx.cl
  clang/test/Index/opencl-types.cl


Index: clang/test/Index/opencl-types.cl
===
--- clang/test/Index/opencl-types.cl
+++ clang/test/Index/opencl-types.cl
@@ -1,4 +1,4 @@
-// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s
+// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 -target spir | 
FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
Index: clang/test/Index/cxx.cl
===
--- clang/test/Index/cxx.cl
+++ clang/test/Index/cxx.cl
@@ -3,5 +3,5 @@
   addrspace_cast<__global int*>(ptr);
 }
 
-// RUN: c-index-test -test-load-source all %s -cl-std=clc++ | FileCheck %s
+// RUN: c-index-test -test-load-source all %s -cl-std=clc++ -target spir | 
FileCheck %s
 // CHECK: cxx.cl:3:3: CXXAddrspaceCastExpr


Index: clang/test/Index/opencl-types.cl
===
--- clang/test/Index/opencl-types.cl
+++ clang/test/Index/opencl-types.cl
@@ -1,4 +1,4 @@
-// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s
+// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 -target spir | FileCheck %s
 
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
Index: clang/test/Index/cxx.cl
===
--- clang/test/Index/cxx.cl
+++ clang/test/Index/cxx.cl
@@ -3,5 +3,5 @@
   addrspace_cast<__global int*>(ptr);
 }
 
-// RUN: c-index-test -test-load-source all %s -cl-std=clc++ | FileCheck %s
+// RUN: c-index-test -test-load-source all %s -cl-std=clc++ -target spir | FileCheck %s
 // CHECK: cxx.cl:3:3: CXXAddrspaceCastExpr
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98538: [clangd] Perform merging for stale symbols in MergeIndex

2021-03-12 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added a reviewer: sammccall.
Herald added subscribers: usaxena95, arphaman.
kadircet requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

Clangd drops symbols from static index whenever the dynamic index is
authoritative for the file. This results in regressions when static and
dynamic index contains different set of information, e.g.
IncludeHeaders.

After this patch, we'll choose to merge symbols from static index with
dynamic one rather than just dropping. This implies correctness problems
when the definition/documentation of the symbol is deleted. But seems
like it is worth having in more cases.

We still drop symbols if dynamic index owns the file and didn't report
the symbol, which means symbol is deleted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98538

Files:
  clang-tools-extra/clangd/index/Merge.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp

Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "Annotations.h"
+#include "SyncAPI.h"
 #include "TestIndex.h"
 #include "TestTU.h"
 #include "index/FileIndex.h"
@@ -17,6 +18,7 @@
 #include "clang/Index/IndexSymbol.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include 
 
 using ::testing::_;
 using ::testing::AllOf;
@@ -312,16 +314,26 @@
   AST = Test.build();
   DynamicIndex.updateMain(testPath(Test.Filename), AST);
 
-  // Merged index should not return the symbol definition if this definition
-  // location is inside a file from the dynamic index.
+  // Even though the definition is actually deleted in the newer version of the
+  // file, we still chose to merge with information coming from static index.
   LookupRequest LookupReq;
   LookupReq.IDs = {Foo.ID};
   unsigned SymbolCounter = 0;
   Merge.lookup(LookupReq, [&](const Symbol ) {
 ++SymbolCounter;
-EXPECT_FALSE(Sym.Definition);
+EXPECT_TRUE(Sym.Definition);
   });
   EXPECT_EQ(SymbolCounter, 1u);
+
+  // Drop the symbol completely.
+  Test.Code = "class Bar {};";
+  AST = Test.build();
+  DynamicIndex.updateMain(testPath(Test.Filename), AST);
+
+  // Now we don't expect to see the symbol at all.
+  SymbolCounter = 0;
+  Merge.lookup(LookupReq, [&](const Symbol ) { ++SymbolCounter; });
+  EXPECT_EQ(SymbolCounter, 0u);
 }
 
 TEST(MergeIndexTest, FuzzyFind) {
@@ -585,6 +597,44 @@
IncludeHeaderWithRef("new", 1u)));
 }
 
+TEST(MergeIndexTest, IncludeHeadersMerged) {
+  auto S = symbol("Z");
+  S.Definition.FileURI = "unittest:///foo.cc";
+
+  SymbolSlab::Builder DynB;
+  S.IncludeHeaders.clear();
+  DynB.insert(S);
+  SymbolSlab DynSymbols = std::move(DynB).build();
+  RefSlab DynRefs;
+  auto DynSize = DynSymbols.bytes() + DynRefs.bytes();
+  auto DynData = std::make_pair(std::move(DynSymbols), std::move(DynRefs));
+  llvm::StringSet<> DynFiles = {S.Definition.FileURI};
+  MemIndex DynIndex(std::move(DynData.first), std::move(DynData.second),
+RelationSlab(), std::move(DynFiles), IndexContents::Symbols,
+std::move(DynData), DynSize);
+
+  SymbolSlab::Builder StaticB;
+  S.IncludeHeaders.push_back({"", 0});
+  StaticB.insert(S);
+  auto StaticIndex =
+  MemIndex::build(std::move(StaticB).build(), RefSlab(), RelationSlab());
+  MergedIndex Merge(, StaticIndex.get());
+
+  EXPECT_THAT(runFuzzyFind(Merge, S.Name),
+  ElementsAre(testing::Field(
+  ::IncludeHeaders,
+  ElementsAre(IncludeHeaderWithRef("", 0u);
+
+  LookupRequest Req;
+  Req.IDs = {S.ID};
+  std::string IncludeHeader;
+  Merge.lookup(Req, [&](const Symbol ) {
+EXPECT_TRUE(IncludeHeader.empty());
+ASSERT_EQ(S.IncludeHeaders.size(), 1u);
+IncludeHeader = S.IncludeHeaders.front().IncludeHeader.str();
+  });
+  EXPECT_EQ(IncludeHeader, "");
+}
 } // namespace
 } // namespace clangd
 } // namespace clang
Index: clang-tools-extra/clangd/index/Merge.cpp
===
--- clang-tools-extra/clangd/index/Merge.cpp
+++ clang-tools-extra/clangd/index/Merge.cpp
@@ -43,30 +43,40 @@
   });
   SymbolSlab Dyn = std::move(DynB).build();
 
-  llvm::DenseSet SeenDynamicSymbols;
+  llvm::DenseSet ReportedDynSymbols;
   {
 auto DynamicContainsFile = Dynamic->indexedFiles();
 More |= Static->fuzzyFind(Req, [&](const Symbol ) {
-  // We expect the definition to see the canonical declaration, so it seems
-  // to be enough to check only the definition if it exists.
-  if ((DynamicContainsFile(S.Definition ? S.Definition.FileURI
+  auto DynS = Dyn.find(S.ID);
+  // If symbol also exist 

[PATCH] D96976: [analyzer] Fix reinterpret_cast handling for pointer-to-member

2021-03-12 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment.

In D96976#2622342 , @steakhal wrote:

> I'm somewhat busy. If it's not urgent, I would postpone this.
> Ping me in a few weeks.

Sure ok. Is it okay if I tell someone else to take a look at this in the 
meanwhile?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96976

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

I can't find why and how `opencl-c-base.h` is used for the test. But it feels 
it is adding the random noise to the testing as it is not expected to be used. 
I don't feel that this commit is affecting the header though, so it is 
something that might have already been broken and hasn't been noticed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D97058#2622750 , @Anastasia wrote:

> In D97058#2622717 , @thakis wrote:
>
>> In case it's useful, here's the output of the RUN line on an m1 mac with 
>> this patch locally reverted (where the test passes): 
>> http://pastie.org/p/2F3Y0xUMtH5RP9TVRzG4LI
>
> Thanks, this seems strange as we are not supposed to have Intel specific 
> extensions exposed for Arm:
>
>   VarDecl=mce_payload:131:37 (Definition) (invalid) [type=__private 
> intel_sub_group_avc_mce_payload_t] [typekind=Typedef] 
> [canonicaltype=__private intel_sub_group_avc_mce_payload_t] 
> [canonicaltypekind=OCLIntelSubgroupAVCMcePayload] [isPOD=1] [isAnonRecDecl=0]
>   TypeRef=intel_sub_group_avc_mce_payload_t:0:0 
> [type=intel_sub_group_avc_mce_payload_t] [typekind=Typedef] 
> [canonicaltype=intel_sub_group_avc_mce_payload_t] 
> [canonicaltypekind=OCLIntelSubgroupAVCMcePayload] [isPOD=1] [isAnonRecDecl=0]
>
> It feels like we aren't doing something right either in default headers or in 
> the frontend setup.

Oh, I just realized that I already have a fix for this 
https://reviews.llvm.org/D92244. I better commit this on Monday though. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D97058#2622717 , @thakis wrote:

> In case it's useful, here's the output of the RUN line on an m1 mac with this 
> patch locally reverted (where the test passes): 
> http://pastie.org/p/2F3Y0xUMtH5RP9TVRzG4LI

Thanks, this seems strange as we are not supposed to have Intel specific 
extensions exposed for Arm:

  VarDecl=mce_payload:131:37 (Definition) (invalid) [type=__private 
intel_sub_group_avc_mce_payload_t] [typekind=Typedef] [canonicaltype=__private 
intel_sub_group_avc_mce_payload_t] 
[canonicaltypekind=OCLIntelSubgroupAVCMcePayload] [isPOD=1] [isAnonRecDecl=0]
  TypeRef=intel_sub_group_avc_mce_payload_t:0:0 
[type=intel_sub_group_avc_mce_payload_t] [typekind=Typedef] 
[canonicaltype=intel_sub_group_avc_mce_payload_t] 
[canonicaltypekind=OCLIntelSubgroupAVCMcePayload] [isPOD=1] [isAnonRecDecl=0]

It feels like we aren't doing something right either in default headers or in 
the frontend setup.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In case it's useful, here's the output of the RUN line on an m1 mac with this 
patch locally reverted (where the test passes): 
http://pastie.org/p/2F3Y0xUMtH5RP9TVRzG4LI


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.



> (The `fatal error: 'opencl-c-base.h' file not found` bit is printed when the 
> test passes too, and is unrelated.)

I can't reproduce this locally neither with nor without this commit.

I think there is something wrong with the way this test runs, this might 
explain why it didn't show up as failing even though it could not have been 
parsed successfully with Arm or Amd triples.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov added a comment.

Thanks guys,

I'm on way to trying that, just building clang from scratch.

>   If it is, then just adding a fixed triple is fine.

Yeah, it is expected as this change removes types which require extension from 
parsers state. X86 and SPIR support all extensions by default, so that's why 
`mce_payload` is there. I'll provide the fix to the test once I'll try that 
locally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D97058#2622681 , @svenvh wrote:

> In D97058#2622669 , @thakis wrote:
>
>> Does it repro if you add `-target arm64-apple-macosx` as arg to c-index-test 
>> on the RUN line of that test?
>
> I also had trouble reproducing the failure locally, but by specifying this 
> target I can reproduce the failure.
>
> That means the fix is simple then? Simply add `-target spir` to the test.

I can't get how this test could even work for other targets since it is using 
Intel's extension successfully. My guess is that `-target spir` might indeed be 
a proper fix. However, I am confused why it only started failing on this commit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

It repros for me with this local diff

  % git diff
  diff --git a/clang/test/Index/opencl-types.cl 
b/clang/test/Index/opencl-types.cl
  index 496f38752fa2..13f6058864b5 100644
  --- a/clang/test/Index/opencl-types.cl
  +++ b/clang/test/Index/opencl-types.cl
  @@ -1,4 +1,4 @@
  -// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s
  +// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 -target 
arm64-apple-macosx | FileCheck %s
  
   #pragma OPENCL EXTENSION cl_khr_fp16 : enable
   #pragma OPENCL EXTENSION cl_khr_fp64 : enable

The failure goes away if I locally revert the change.

I don't know if it's expected that the test added in 
https://reviews.llvm.org/D51484 starts failing after this change for arm 
triples. If it is, then just adding a fixed triple is fine. If it's unexpected, 
the let's revert and analyze async, with a green tree.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment.

In D97058#2622669 , @thakis wrote:

> Does it repro if you add `-target arm64-apple-macosx` as arg to c-index-test 
> on the RUN line of that test?

I also had trouble reproducing the failure locally, but by specifying this 
target I can reproduce the failure.

That means the fix is simple then? Simply add `-target spir` to the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Does it repro if you add `-target arm64-apple-macosx` as arg to c-index-test on 
the RUN line of that test?

Here's the output of that RUN line on an arm mac when the test fails: 
http://pastie.org/p/1go1Y9WXjs5T371RtyJ3Gi

Let's revert for now, things have been broken for over 9 hours already.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


[PATCH] D97058: [OpenCL] Refactor diagnostic for OpenCL extension/feature

2021-03-12 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov added a comment.

Hi!

Yeah,  I'm looking into it, but I can't reproduce it locally: the test passes 
at x86_64 linux system. I'll revert the change if it takes too much time to 
investigate what's going on. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97058

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


  1   2   >