[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-18 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 3 inline comments as done.
balazske added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:406
 
+const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N,
+  SymbolRef StreamSym,

NoQ wrote:
> NoQ wrote:
> > Ok, so this is a tiny auxiliary visitor.
> > 
> > I wish we could set uniqueing location post-factum from within the note 
> > tag. Unfortunately we can't because notes are generated after uniqueing :(
> > 
> > I'd like you to experiment with tracking this information as part of the 
> > state instead so that you didn't need to perform an additional scan. I'd be 
> > happy if it helps you avoid performing this additional pass.
> > 
> > I.e., when you're opening the file, add all the information you need for 
> > building your uniqueing location into the stream state (not the node 
> > though, just the program point or something like that). Then retrieve it in 
> > O(1) when you're emitting the report.
> Another thing we could try is to implement such post-processing pass globally 
> for all checkers. I.e., instead of an optional uniqueing location accept an 
> optional lambda that looks at a node and answers whether this node should be 
> used as a uniqueing location. Then before report deduplication scan each 
> report that supplies such lambda and update its uniqueing location. That'll 
> probably require some work on BugReporter but that sounds like a nice way to 
> avoid all the boilerplate.
Storing the "acquisition site" in the state is the natural way of doing this. 
Probably I should not think that existing checkers do things the best way, this 
function is taken from  `FuchsiaHandleChecker` (or here it has a specific 
reason?). And not storing the data in the state is a bit less memory 
consumption if this matters.



Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:406
 
+const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N,
+  SymbolRef StreamSym,

balazske wrote:
> NoQ wrote:
> > NoQ wrote:
> > > Ok, so this is a tiny auxiliary visitor.
> > > 
> > > I wish we could set uniqueing location post-factum from within the note 
> > > tag. Unfortunately we can't because notes are generated after uniqueing :(
> > > 
> > > I'd like you to experiment with tracking this information as part of the 
> > > state instead so that you didn't need to perform an additional scan. I'd 
> > > be happy if it helps you avoid performing this additional pass.
> > > 
> > > I.e., when you're opening the file, add all the information you need for 
> > > building your uniqueing location into the stream state (not the node 
> > > though, just the program point or something like that). Then retrieve it 
> > > in O(1) when you're emitting the report.
> > Another thing we could try is to implement such post-processing pass 
> > globally for all checkers. I.e., instead of an optional uniqueing location 
> > accept an optional lambda that looks at a node and answers whether this 
> > node should be used as a uniqueing location. Then before report 
> > deduplication scan each report that supplies such lambda and update its 
> > uniqueing location. That'll probably require some work on BugReporter but 
> > that sounds like a nice way to avoid all the boilerplate.
> Storing the "acquisition site" in the state is the natural way of doing this. 
> Probably I should not think that existing checkers do things the best way, 
> this function is taken from  `FuchsiaHandleChecker` (or here it has a 
> specific reason?). And not storing the data in the state is a bit less memory 
> consumption if this matters.
We should check how many checkers can benefit from such a "uniqueing location 
callback". Normally the checker should know what the uniqueing location is, at 
least when the bug report is created. The location is naturally obtained from 
the state that the checker maintains, at least if we want to avoid scans like 
`getAcquisitionSite`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81407



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


[PATCH] D82002: [clangd] Drop FS usage in ClangTidyOpts

2020-06-18 Thread Nathan James via Phabricator via cfe-commits
njames93 added inline comments.



Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:495-498
+bool HasChecks = false;
+for (const auto &Source : Sources)
+  HasChecks |= Source.first.Checks.hasValue();
+if (!HasChecks)

`if (llvm::none_of(Sources, [](const auto &Source) { return 
Source.first.Checks.hasValue(); }))`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82002



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


[PATCH] D82002: [clangd] Drop FS usage in ClangTidyOpts

2020-06-18 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

I'm of the idea that rather than having `ClangdTidyOptionsProvider` inherit 
form `tidy::ClangTidyOptionsProvider`, just have it as its own class. We don't 
need the interface offered by clang tidy here. It would solve the `must be 
threadsafe` comment issue as well as reduce the need for some unnecessary code 
in there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82002



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


[clang] 12c8e36 - [Clang][Sema] Use of incorrect __has_feature vs __has_builtin

2020-06-18 Thread Guillaume Chatelet via cfe-commits

Author: Guillaume Chatelet
Date: 2020-06-18T09:00:12Z
New Revision: 12c8e3632edda3bc640867ba326b52b5b2220a57

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

LOG: [Clang][Sema] Use of incorrect __has_feature vs __has_builtin

Added: 


Modified: 
clang/test/Sema/builtins-memcpy-inline.cpp

Removed: 




diff  --git a/clang/test/Sema/builtins-memcpy-inline.cpp 
b/clang/test/Sema/builtins-memcpy-inline.cpp
index 5e03a975a71b..81b11fc021ff 100644
--- a/clang/test/Sema/builtins-memcpy-inline.cpp
+++ b/clang/test/Sema/builtins-memcpy-inline.cpp
@@ -2,7 +2,7 @@
 
 #define NULL ((char *)0)
 
-#if __has_feature(__builtin_memcpy_inline)
+#if __has_builtin(__builtin_memcpy_inline)
 #warning defined as expected
 // expected-warning@-1 {{defined as expected}}
 #endif



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


[clang] 1d7b4a7 - [SveEmitter] Add builtins for tuple creation (svcreate2/svcreate3/etc)

2020-06-18 Thread Sander de Smalen via cfe-commits

Author: Sander de Smalen
Date: 2020-06-18T10:07:09+01:00
New Revision: 1d7b4a7e5e4a25605ec9926da1fb461840a1f216

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

LOG: [SveEmitter] Add builtins for tuple creation (svcreate2/svcreate3/etc)

The svcreate builtins allow constructing a tuple from individual vectors, e.g.

  svint32x2_t svcreate2(svint32_t v2, svint32_t v2)`

Reviewers: c-rhodes, david-arm, efriedma

Reviewed By: c-rhodes, efriedma

Tags: #clang

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

Added: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create2.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create3.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create4.c

Modified: 
clang/include/clang/Basic/TargetBuiltins.h
clang/include/clang/Basic/arm_sve.td
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CodeGenFunction.h

Removed: 




diff  --git a/clang/include/clang/Basic/TargetBuiltins.h 
b/clang/include/clang/Basic/TargetBuiltins.h
index 899f6b5b6f3c..38d82d1d869f 100644
--- a/clang/include/clang/Basic/TargetBuiltins.h
+++ b/clang/include/clang/Basic/TargetBuiltins.h
@@ -247,6 +247,7 @@ namespace clang {
 bool isGatherPrefetch() const { return Flags & IsGatherPrefetch; }
 bool isReverseUSDOT() const { return Flags & ReverseUSDOT; }
 bool isUndef() const { return Flags & IsUndef; }
+bool isTupleCreate() const { return Flags & IsTupleCreate; }
 
 uint64_t getBits() const { return Flags; }
 bool isFlagSet(uint64_t Flag) const { return Flags & Flag; }

diff  --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index a7223f770455..0348a3754e22 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -200,6 +200,7 @@ def IsGatherPrefetch  : FlagType<0x1000>;
 def ReverseCompare: FlagType<0x2000>; // Compare operands must 
be swapped.
 def ReverseUSDOT  : FlagType<0x4000>; // Unsigned/signed 
operands must be swapped.
 def IsUndef   : FlagType<0x8000>; // Codegen `undef` of 
given type.
+def IsTupleCreate : FlagType<0x1>;
 
 // These must be kept in sync with the flags in 
include/clang/Basic/TargetBuiltins.h
 class ImmCheckType {
@@ -1279,6 +1280,10 @@ def SVUNDEF_2 : SInst<"svundef2_{d}", "2", 
"csilUcUsUiUlhfd", MergeNone, "", [Is
 def SVUNDEF_3 : SInst<"svundef3_{d}", "3", "csilUcUsUiUlhfd", MergeNone, "", 
[IsUndef]>;
 def SVUNDEF_4 : SInst<"svundef4_{d}", "4", "csilUcUsUiUlhfd", MergeNone, "", 
[IsUndef]>;
 
+def SVCREATE_2 : SInst<"svcreate2[_{d}]", "2dd",   "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_tuple_create2", [IsTupleCreate]>;
+def SVCREATE_3 : SInst<"svcreate3[_{d}]", "3ddd",  "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_tuple_create3", [IsTupleCreate]>;
+def SVCREATE_4 : SInst<"svcreate4[_{d}]", "4", "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_tuple_create4", [IsTupleCreate]>;
+
 

 // SVE2 WhileGE/GT
 let ArchGuard = "defined(__ARM_FEATURE_SVE2)" in {

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index b81b2a449425..05de88c392aa 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -4646,7 +4646,7 @@ struct ARMVectorIntrinsicInfo {
   unsigned BuiltinID;
   unsigned LLVMIntrinsic;
   unsigned AltLLVMIntrinsic;
-  unsigned TypeModifier;
+  uint64_t TypeModifier;
 
   bool operator<(unsigned RHSBuiltinID) const {
 return BuiltinID < RHSBuiltinID;
@@ -7998,9 +7998,8 @@ static void InsertExplicitUndefOperand(CGBuilderTy 
&Builder, llvm::Type *Ty,
   Ops.insert(Ops.begin(), SplatUndef);
 }
 
-SmallVector
-CodeGenFunction::getSVEOverloadTypes(SVETypeFlags TypeFlags,
- ArrayRef Ops) {
+SmallVector CodeGenFunction::getSVEOverloadTypes(
+SVETypeFlags TypeFlags, llvm::Type *ResultType, ArrayRef Ops) {
   if (TypeFlags.isOverloadNone())
 return {};
 
@@ -8015,6 +8014,9 @@ CodeGenFunction::getSVEOverloadTypes(SVETypeFlags 
TypeFlags,
   if (TypeFlags.isOverloadCvt())
 return {Ops[0]->getType(), Ops.back()->getType()};
 
+  if (TypeFlags.isTupleCreate())
+return {ResultType, Ops[0]->getType()};
+
   assert(TypeFlags.isOverloadDefault() && "Unexpected value for overloads");
   return {DefaultType};
 }
@@ -8112,7 +8114,7 @@ Value 
*CodeGenFunction::EmitAArch64SVEBuiltinExpr(unsigned BuiltinID,
 }
 
 Function *F = CGM.getIntrinsic(Builtin->LLVMIntrinsic,
-   getSVEOverloadTypes(TypeFlags, Ops));
+   getSVEOverloadTypes(TypeFlags, Ty, Ops));
 Value *Call = Builder.CreateC

[PATCH] D80961: Ignore template instantiations if not in AsIs mode

2020-06-18 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

In D80961#2099262 , @steveire wrote:

> In D80961#2095254 , @klimek wrote:
>
> > 1. the scare quotes around "standing objections" reads like you're not 
> > respecting the opinions of others here;
>
>
> Hmm, this wasn't intended. I sometimes quote things if they are a particular 
> term (ordinarily I would quote "particular term").
>
> Nevertheless, I'll take on your message. I don't have more to say.


Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80961



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


[PATCH] D73543: [clang] Add support for __builtin_memcpy_inline

2020-06-18 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet marked 2 inline comments as done.
gchatelet added inline comments.



Comment at: clang/test/Sema/builtins-memcpy-inline.c:7
+#warning defined as expected
+// expected-warning@-1 {{defined as expected}}
+#endif

gchatelet wrote:
> efriedma wrote:
> > melver wrote:
> > > It appears that the expected-warning check here is guarded by the #if as 
> > > well. Moving it after the #endif results in a failing test.
> > > 
> > > I noticed this as I was trying to use 
> > > __has_feature(__builtin_memcpy_inline), but it somehow does not work, 
> > > even though the compiler clearly supports __builtin_memcpy_inline.
> > > 
> > > Any idea what's wrong with the __has_feature test?
> > > 
> > > Thanks!
> > Should be `__has_builtin`, I think?  __has_feature only applies to features 
> > defined in clang/include/clang/Basic/Features.def.
> Thx for noticing. I'll send a patch to update the test.
Submitted as rG12c8e3632edda3bc640867ba326b52b5b2220a57


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73543



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


[PATCH] D73543: [clang] Add support for __builtin_memcpy_inline

2020-06-18 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet marked 3 inline comments as done.
gchatelet added inline comments.



Comment at: clang/test/Sema/builtins-memcpy-inline.c:7
+#warning defined as expected
+// expected-warning@-1 {{defined as expected}}
+#endif

efriedma wrote:
> melver wrote:
> > It appears that the expected-warning check here is guarded by the #if as 
> > well. Moving it after the #endif results in a failing test.
> > 
> > I noticed this as I was trying to use 
> > __has_feature(__builtin_memcpy_inline), but it somehow does not work, even 
> > though the compiler clearly supports __builtin_memcpy_inline.
> > 
> > Any idea what's wrong with the __has_feature test?
> > 
> > Thanks!
> Should be `__has_builtin`, I think?  __has_feature only applies to features 
> defined in clang/include/clang/Basic/Features.def.
Thx for noticing. I'll send a patch to update the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73543



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


[PATCH] D81676: [MSP430] Align the toolchain definition with the TI's msp430-gcc v8.3.1

2020-06-18 Thread Anatoly Trosinenko via Phabricator via cfe-commits
atrosinenko updated this revision to Diff 271610.
atrosinenko added a comment.

fix unit test: add another "-lgcc" and (hopefully) fix path separators on 
Windows


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81676

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/MSP430.cpp
  clang/lib/Driver/ToolChains/MSP430.h
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtend_no_eh.o
  clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtbegin_no_eh.o
  clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtend_no_eh.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crtn.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/exceptions/crt0.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/crt0.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/exceptions/crt0.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/crt0.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/exceptions/crt0.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/full-memory-range/crt0.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/full-memory-range/exceptions/crt0.o
  clang/test/Driver/msp430-toolchain.c

Index: clang/test/Driver/msp430-toolchain.c
===
--- clang/test/Driver/msp430-toolchain.c
+++ clang/test/Driver/msp430-toolchain.c
@@ -1,78 +1,231 @@
-// A basic clang -cc1 command-line, and simple environment check.
+// Tests for the toolchain description for msp430-gcc
+// Splitting some tests into POS and NEG parts so the latter can validate
+// output fragments as large as possible for absence of some text.
 
+
+// Tests for pa

[PATCH] D72781: [Matrix] Add __builtin_matrix_column_load to Clang.

2020-06-18 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 271613.
fhahn added a comment.

Rebased after recent parent patches landed. Will commit shortly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72781

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGen/matrix-type-builtins.c
  clang/test/CodeGenCXX/matrix-type-builtins.cpp
  clang/test/CodeGenObjC/matrix-type-builtins.m
  clang/test/Sema/matrix-type-builtins.c
  clang/test/SemaCXX/matrix-type-builtins-disabled.cpp
  clang/test/SemaCXX/matrix-type-builtins.cpp

Index: clang/test/SemaCXX/matrix-type-builtins.cpp
===
--- clang/test/SemaCXX/matrix-type-builtins.cpp
+++ clang/test/SemaCXX/matrix-type-builtins.cpp
@@ -39,3 +39,65 @@
   Mat3.value = transpose(Mat2);
   // expected-note@-1 {{in instantiation of function template specialization 'transpose' requested here}}
 }
+
+template 
+typename MyMatrix::matrix_t column_major_load(MyMatrix &A, EltTy0 *Ptr) {
+  char *v1 = __builtin_matrix_column_major_load(Ptr, 9, 4, 10);
+  // expected-error@-1 {{cannot initialize a variable of type 'char *' with an rvalue of type 'unsigned int __attribute__((matrix_type(9, 4)))'}}
+  // expected-error@-2 {{cannot initialize a variable of type 'char *' with an rvalue of type 'unsigned int __attribute__((matrix_type(9, 4)))'}}
+  // expected-error@-3 {{cannot initialize a variable of type 'char *' with an rvalue of type 'float __attribute__((matrix_type(9, 4)))'}}
+
+  return __builtin_matrix_column_major_load(Ptr, R0, C0, R0);
+  // expected-error@-1 {{cannot initialize return object of type 'typename MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(5, 5)))') with an rvalue of type 'unsigned int __attribute__((matrix_type(2, 3)))'}}
+  // expected-error@-2 {{cannot initialize return object of type 'typename MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(2, 3)))') with an rvalue of type 'float __attribute__((matrix_type(2, 3)))'}}
+}
+
+void test_column_major_loads_template(unsigned *Ptr1, float *Ptr2) {
+  MyMatrix Mat1;
+  Mat1.value = column_major_load(Mat1, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_load' requested here}}
+  column_major_load(Mat1, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_load' requested here}}
+
+  MyMatrix Mat2;
+  Mat1.value = column_major_load(Mat2, Ptr2);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_load' requested here}}
+}
+
+constexpr int constexpr1() { return 1; }
+constexpr int constexpr_neg1() { return -1; }
+
+void test_column_major_load_constexpr(unsigned *Ptr) {
+  (void)__builtin_matrix_column_major_load(Ptr, 2, 2, constexpr1());
+  // expected-error@-1 {{stride must be greater or equal to the number of rows}}
+  (void)__builtin_matrix_column_major_load(Ptr, constexpr_neg1(), 2, 4);
+  // expected-error@-1 {{row dimension is outside the allowed range [1, 1048575]}}
+  (void)__builtin_matrix_column_major_load(Ptr, 2, constexpr_neg1(), 4);
+  // expected-error@-1 {{column dimension is outside the allowed range [1, 1048575]}}
+}
+
+struct IntWrapper {
+  operator int() {
+return 1;
+  }
+};
+
+void test_column_major_load_wrapper(unsigned *Ptr, IntWrapper &W) {
+  (void)__builtin_matrix_column_major_load(Ptr, W, 2, 2);
+  // expected-error@-1 {{row argument must be a constant unsigned integer expression}}
+  (void)__builtin_matrix_column_major_load(Ptr, 2, W, 2);
+  // expected-error@-1 {{column argument must be a constant unsigned integer expression}}
+}
+
+template 
+void test_column_major_load_temp(T Ptr) {
+  (void)__builtin_matrix_column_major_load(Ptr, R, C, S);
+}
+
+void call_column_major_load_temp(unsigned *Ptr, unsigned X) {
+  (void)__builtin_matrix_column_major_load(Ptr, X, X, X);
+  // expected-error@-1 {{row argument must be a constant unsigned integer expression}}
+  // expected-error@-2 {{column argument must be a constant unsigned integer expression}}
+  (void)__builtin_matrix_column_major_load(X, 2, 2, 2);
+  // expected-error@-1 {{first argument must be a pointer to a valid matrix element type}}
+}
Index: clang/test/SemaCXX/matrix-type-builtins-disabled.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/matrix-type-builtins-disabled.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -pedantic -std=c++11 -verify -triple=x86_64-apple-darwin9
+
+// Make sure we fail without -fenable-matrix when
+// __builtin_matrix_column_major_load is used to construct a new matrix type.
+void column_major_load_with_stride(int *Ptr) {
+  

[PATCH] D81282: [builtins] Move more float128-related helpers to GENERIC_TF_SOURCES list

2020-06-18 Thread Anatoly Trosinenko via Phabricator via cfe-commits
atrosinenko updated this revision to Diff 271612.
atrosinenko added a comment.

1. Since different quite unrelated patches failed on Jun 5 with quite the same 
messages, just rebase onto current `master` expecting build failure to go away
2. Ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81282

Files:
  compiler-rt/lib/builtins/CMakeLists.txt


Index: compiler-rt/lib/builtins/CMakeLists.txt
===
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -46,7 +46,6 @@
   absvti2.c
   adddf3.c
   addsf3.c
-  addtf3.c
   addvdi3.c
   addvsi3.c
   addvti3.c
@@ -75,9 +74,7 @@
   divsc3.c
   divsf3.c
   divsi3.c
-  divtc3.c
   divti3.c
-  divtf3.c
   extendsfdf2.c
   extendhfsf2.c
   ffsdi2.c
@@ -123,7 +120,6 @@
   mulsc3.c
   mulsf3.c
   multi3.c
-  multf3.c
   mulvdi3.c
   mulvsi3.c
   mulvti3.c
@@ -149,7 +145,6 @@
   subvdi3.c
   subvsi3.c
   subvti3.c
-  subtf3.c
   trampoline_setup.c
   truncdfhf2.c
   truncdfsf2.c
@@ -168,7 +163,10 @@
 )
 
 set(GENERIC_TF_SOURCES
+  addtf3.c
   comparetf2.c
+  divtc3.c
+  divtf3.c
   extenddftf2.c
   extendsftf2.c
   fixtfdi.c
@@ -184,6 +182,8 @@
   floatunsitf.c
   floatuntitf.c
   multc3.c
+  multf3.c
+  subtf3.c
   trunctfdf2.c
   trunctfsf2.c
 )


Index: compiler-rt/lib/builtins/CMakeLists.txt
===
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -46,7 +46,6 @@
   absvti2.c
   adddf3.c
   addsf3.c
-  addtf3.c
   addvdi3.c
   addvsi3.c
   addvti3.c
@@ -75,9 +74,7 @@
   divsc3.c
   divsf3.c
   divsi3.c
-  divtc3.c
   divti3.c
-  divtf3.c
   extendsfdf2.c
   extendhfsf2.c
   ffsdi2.c
@@ -123,7 +120,6 @@
   mulsc3.c
   mulsf3.c
   multi3.c
-  multf3.c
   mulvdi3.c
   mulvsi3.c
   mulvti3.c
@@ -149,7 +145,6 @@
   subvdi3.c
   subvsi3.c
   subvti3.c
-  subtf3.c
   trampoline_setup.c
   truncdfhf2.c
   truncdfsf2.c
@@ -168,7 +163,10 @@
 )
 
 set(GENERIC_TF_SOURCES
+  addtf3.c
   comparetf2.c
+  divtc3.c
+  divtf3.c
   extenddftf2.c
   extendsftf2.c
   fixtfdi.c
@@ -184,6 +182,8 @@
   floatunsitf.c
   floatuntitf.c
   multc3.c
+  multf3.c
+  subtf3.c
   trunctfdf2.c
   trunctfsf2.c
 )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81463: [SveEmitter] Add builtins for tuple creation (svcreate2/svcreate3/etc)

2020-06-18 Thread Sander de Smalen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d7b4a7e5e4a: [SveEmitter] Add builtins for tuple creation 
(svcreate2/svcreate3/etc) (authored by sdesmalen).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81463

Files:
  clang/include/clang/Basic/TargetBuiltins.h
  clang/include/clang/Basic/arm_sve.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create2.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create3.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create4.c

Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create4.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_create4.c
@@ -0,0 +1,99 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+#endif
+
+svint8x4_t test_svcreate4_s8(svint8_t x0, svint8_t x1, svint8_t x2, svint8_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_s8
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv64i8.nxv16i8( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_s8,,)(x0, x1, x2, x4);
+}
+
+svint16x4_t test_svcreate4_s16(svint16_t x0, svint16_t x1, svint16_t x2, svint16_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_s16
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv32i16.nxv8i16( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_s16,,)(x0, x1, x2, x4);
+}
+
+svint32x4_t test_svcreate4_s32(svint32_t x0, svint32_t x1, svint32_t x2, svint32_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_s32
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_s32,,)(x0, x1, x2, x4);
+}
+
+svint64x4_t test_svcreate4_s64(svint64_t x0, svint64_t x1, svint64_t x2, svint64_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_s64
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv8i64.nxv2i64( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_s64,,)(x0, x1, x2, x4);
+}
+
+svuint8x4_t test_svcreate4_u8(svuint8_t x0, svuint8_t x1, svuint8_t x2, svuint8_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_u8
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv64i8.nxv16i8( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_u8,,)(x0, x1, x2, x4);
+}
+
+svuint16x4_t test_svcreate4_u16(svuint16_t x0, svuint16_t x1, svuint16_t x2, svuint16_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_u16
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv32i16.nxv8i16( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_u16,,)(x0, x1, x2, x4);
+}
+
+svuint32x4_t test_svcreate4_u32(svuint32_t x0, svuint32_t x1, svuint32_t x2, svuint32_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_u32
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv16i32.nxv4i32( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_u32,,)(x0, x1, x2, x4);
+}
+
+svuint64x4_t test_svcreate4_u64(svuint64_t x0, svuint64_t x1, svuint64_t x2, svuint64_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_u64
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv8i64.nxv2i64( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_u64,,)(x0, x1, x2, x4);
+}
+
+svfloat16x4_t test_svcreate4_f16(svfloat16_t x0, svfloat16_t x1, svfloat16_t x2, svfloat16_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_f16
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv32f16.nxv8f16( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_f16,,)(x0, x1, x2, x4);
+}
+
+svfloat32x4_t test_svcreate4_f32(svfloat32_t x0, svfloat32_t x1, svfloat32_t x2, svfloat32_t x4)
+{
+  // CHECK-LABEL: test_svcreate4_f32
+  // CHECK: %[[CREATE:.*]] = call  @llvm.aarch64.sve.tuple.create4.nxv16f32.nxv4f32( %x0,  %x1,  %x2,  %x4)
+  // CHECK-NEXT: ret  %[[CREATE]]
+  return SVE_ACLE_FUNC(svcreate4,_f32,,)(x0, x1, x2, x4);
+}
+
+svfloat64x4_t test_svcreate4_f64(svfloat64_t x0

[PATCH] D79755: Implement constexpr BinaryOperator for vector types

2020-06-18 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon edited reviewers, added: efriedma; removed: eli.friedman.
RKSimon added a comment.

Any frontend people got any comments on this? I'm keen to see constexpr vector 
support added but know next to nothing about the frontend.


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

https://reviews.llvm.org/D79755



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


[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:406
 
+const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N,
+  SymbolRef StreamSym,

balazske wrote:
> balazske wrote:
> > NoQ wrote:
> > > NoQ wrote:
> > > > Ok, so this is a tiny auxiliary visitor.
> > > > 
> > > > I wish we could set uniqueing location post-factum from within the note 
> > > > tag. Unfortunately we can't because notes are generated after uniqueing 
> > > > :(
> > > > 
> > > > I'd like you to experiment with tracking this information as part of 
> > > > the state instead so that you didn't need to perform an additional 
> > > > scan. I'd be happy if it helps you avoid performing this additional 
> > > > pass.
> > > > 
> > > > I.e., when you're opening the file, add all the information you need 
> > > > for building your uniqueing location into the stream state (not the 
> > > > node though, just the program point or something like that). Then 
> > > > retrieve it in O(1) when you're emitting the report.
> > > Another thing we could try is to implement such post-processing pass 
> > > globally for all checkers. I.e., instead of an optional uniqueing 
> > > location accept an optional lambda that looks at a node and answers 
> > > whether this node should be used as a uniqueing location. Then before 
> > > report deduplication scan each report that supplies such lambda and 
> > > update its uniqueing location. That'll probably require some work on 
> > > BugReporter but that sounds like a nice way to avoid all the boilerplate.
> > Storing the "acquisition site" in the state is the natural way of doing 
> > this. Probably I should not think that existing checkers do things the best 
> > way, this function is taken from  `FuchsiaHandleChecker` (or here it has a 
> > specific reason?). And not storing the data in the state is a bit less 
> > memory consumption if this matters.
> We should check how many checkers can benefit from such a "uniqueing location 
> callback". Normally the checker should know what the uniqueing location is, 
> at least when the bug report is created. The location is naturally obtained 
> from the state that the checker maintains, at least if we want to avoid scans 
> like `getAcquisitionSite`.
> Probably I should not think that existing checkers do things the best way

Well, if you ever find yourself copy-pasting a large chunk of code from a 
different checker and using it almost unchanged, it's a good indication that 
the checker API needs to be improved. You can't do things "the best way" in a 
single checker in isolation, it's a collective effort. You're a programmer, you 
can change everything, no need to be confined in your checker.

> We should check how many checkers can benefit from such a "uniqueing location 
> callback". Normally the checker should know what the uniqueing location is, 
> at least when the bug report is created.

No, i don't think it ever happens automagically. It's either tracked in the 
state specifically for that purpose or scanned backwards. So i'd rather believe 
that every checker that has non-default uniqueing locations will benefit from 
such facility.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81407



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


[PATCH] D72782: [Matrix] Add __builtin_matrix_column_store to Clang.

2020-06-18 Thread Florian Hahn via Phabricator via cfe-commits
fhahn updated this revision to Diff 271617.
fhahn added a comment.

Rebased after recent changes landed upstream. Will commit shortly


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72782

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/matrix-type-builtins.c
  clang/test/CodeGenCXX/matrix-type-builtins.cpp
  clang/test/CodeGenObjC/matrix-type-builtins.m
  clang/test/Sema/matrix-type-builtins.c
  clang/test/SemaCXX/matrix-type-builtins.cpp
  clang/test/SemaObjC/matrix-type-builtins.m

Index: clang/test/SemaObjC/matrix-type-builtins.m
===
--- clang/test/SemaObjC/matrix-type-builtins.m
+++ clang/test/SemaObjC/matrix-type-builtins.m
@@ -19,3 +19,13 @@
   m = __builtin_matrix_transpose(mv.value);
   // expected-error@-1 {{assigning to 'double3x3' (aka 'double __attribute__((matrix_type(3, 3)))') from incompatible type 'double __attribute__((matrix_type(4, 4)))'}}
 }
+
+double test_store(MatrixValue *mv, float *Ptr) {
+  __builtin_matrix_column_major_store(mv.value, Ptr, 1);
+  // expected-error@-1 {{the pointee of the second argument must match the element type of the first argument ('float' != 'double')}}
+  // expected-error@-2 {{stride must be greater or equal to the number of rows}}
+
+  __builtin_matrix_column_major_store(mv.value, mv.value, mv.value);
+  // expected-error@-1 {{second argument must be a pointer to a valid matrix element type}}
+  // expected-error@-2 {{casting 'double4x4' (aka 'double __attribute__((matrix_type(4, 4)))') to incompatible type 'unsigned long'}}
+}
Index: clang/test/SemaCXX/matrix-type-builtins.cpp
===
--- clang/test/SemaCXX/matrix-type-builtins.cpp
+++ clang/test/SemaCXX/matrix-type-builtins.cpp
@@ -101,3 +101,66 @@
   (void)__builtin_matrix_column_major_load(X, 2, 2, 2);
   // expected-error@-1 {{first argument must be a pointer to a valid matrix element type}}
 }
+
+template 
+void column_major_store(MyMatrix &A, PtrTy Ptr, unsigned Stride) {
+  __builtin_matrix_column_major_store(A.value, Ptr, Stride);
+  // expected-error@-1 {{the pointee of the second argument must match the element type of the first argument ('float' != 'unsigned int')}}
+}
+
+template 
+void column_major_store(MTy &A, PtrTy Ptr) {
+  __builtin_matrix_column_major_store(A.value, Ptr, Stride);
+  // expected-error@-1 {{stride must be greater or equal to the number of rows}}
+}
+
+void test_column_major_stores_template(MyMatrix &M1, unsigned *Ptr1, MyMatrix &M2, float *Ptr2) {
+  column_major_store(M1, Ptr2, 10);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store' requested here}}
+
+  column_major_store(M2, Ptr2);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store &, float *, 1>' requested here}}
+}
+
+template 
+void column_major_store(MyMatrix &A, EltTy1 *Ptr) {
+  __builtin_matrix_column_major_store(A.value, Ptr, 1);
+  // expected-error@-1 3 {{stride must be greater or equal to the number of rows}}
+  // expected-error@-2 {{the pointee of the second argument must match the element type of the first argument ('float' != 'unsigned int')}}
+  // expected-error@-3 {{the pointee of the second argument must match the element type of the first argument ('unsigned int' != 'float')}}
+
+  char *s;
+  return __builtin_matrix_column_major_store(A.value, s, 20);
+  // expected-error@-1 {{the pointee of the second argument must match the element type of the first argument ('char' != 'unsigned int')}}
+  // expected-error@-2 {{the pointee of the second argument must match the element type of the first argument ('char' != 'unsigned int')}}
+  // expected-error@-3 {{he pointee of the second argument must match the element type of the first argument ('char' != 'float')}}
+}
+
+void test_column_major_store_template(unsigned *Ptr1, float *Ptr2) {
+  MyMatrix Mat1;
+  column_major_store(Mat1, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store'}}
+  column_major_store(Mat1, Ptr2);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store'}}
+
+  MyMatrix Mat2;
+  column_major_store(Mat2, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store'}}
+}
+
+void test_column_major_store_constexpr(unsigned *Ptr, MyMatrix &M) {
+  __builtin_matrix_column_major_store(M.value, Ptr, constexpr1());
+  // expected-error@-1 {{stride must be greater or equal to the number of rows}}
+  __builtin_matrix_column_major_store(constexpr1(), Ptr, 1);
+  // expected-error@-1 {{first argument must be a matrix}}
+  __builtin_matrix_c

[PATCH] D81946: [WIP][RISCV] Enable multilib support even without a detected GCC install

2020-06-18 Thread Simon Cook via Phabricator via cfe-commits
simoncook added a comment.

Thanks for this Ed. I've tried building a toolchain with it and noticed a 
couple of things:

1. Printing the set of multilibs doesn't provide a default, I think that should 
still be defined and printed with `-print-multi-libs`
2. There's a slight path finding issue if I build compiler-rt with an option 
like `-DCMAKE_INSTALL_PREFIX=$(clang -print-resource-dir)/${CRT_MULTILIB_DIR}` 
(the latter being the multilib dir printed by `-print-multi-libs`).

The build system installs crtbegin/crtend/clang_rt into 
`${CMAKE_INSTALL_PREFIX}/lib` (if I set the OS to ""), but clang searches for 
the multilib variants in a folder without `/lib` at the end.

Looking at compiler-rt's CMake that seems to be down to:

  if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(COMPILER_RT_LIBRARY_OUTPUT_DIR
  ${COMPILER_RT_OUTPUT_DIR})
set(COMPILER_RT_LIBRARY_INSTALL_DIR
  ${COMPILER_RT_INSTALL_PATH})
  else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
set(COMPILER_RT_LIBRARY_OUTPUT_DIR
  ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
set(COMPILER_RT_LIBRARY_INSTALL_DIR
  ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
  endif()

I can work around this by setting `COMPILER_RT_OS_DIR` to "..", but I'm 
wondering whether it makes more sense to allow "lib" to be replaced with a 
multilib directory name, preserving "lib" for the default multilib?

Other than that, a first bit of testing this is working great, it's nice having 
native bare metal RISC-V multilibs for Clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81946



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


[PATCH] D81168: Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions

2020-06-18 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 271620.
eduucaldas marked 7 inline comments as done.
eduucaldas added a comment.

- cleanup for upstreaming
- better coverage for unqualified-id
- Better coverage for qualified-id
- Finish implementing unqualified-id.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81168

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -485,8 +485,9 @@
 | | |-SimpleDeclarator
 | | | `-x
 | | `-:
-| |-UnknownExpression
-| | `-a
+| |-IdExpression
+| | `-UnqualifiedId
+| |   `-a
 | |-)
 | `-EmptyStatement
 |   `-;
@@ -662,8 +663,9 @@
 |-{
 |-ExpressionStatement
 | |-UnknownExpression
-| | |-UnknownExpression
-| | | `-test
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-test
 | | |-(
 | | `-)
 | `-;
@@ -675,16 +677,18 @@
 | |-)
 | |-ExpressionStatement
 | | |-UnknownExpression
-| | | |-UnknownExpression
-| | | | `-test
+| | | |-IdExpression
+| | | | `-UnqualifiedId
+| | | |   `-test
 | | | |-(
 | | | `-)
 | | `-;
 | |-else
 | `-ExpressionStatement
 |   |-UnknownExpression
-|   | |-UnknownExpression
-|   | | `-test
+|   | |-IdExpression
+|   | | `-UnqualifiedId
+|   | |   `-test
 |   | |-(
 |   | `-)
 |   `-;
@@ -692,6 +696,464 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, UnqualifiedId) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+struct X {
+  // TODO: Expose `id-expression` from `Declarator`
+  friend X operator+(const X&, const X&);
+  operator int();
+};
+unsigned operator "" _w(long long unsigned);
+template
+void f(T&);
+void test(X x) {
+  x;  // identifier
+  operator+(x, x);// operator-function-id
+  operator "" _w(1llu);   // literal-operator-id
+
+  f(x);// template-id
+
+  // TODO: Expose `id-expression` from `MemberExpr`
+  x.operator int();   // conversion-funtion-id
+  x.~X(); // ~type-name
+  x.~decltype(x)();   // ~decltype-specifier
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+|-SimpleDeclaration
+| |-struct
+| |-X
+| |-{
+| |-UnknownDeclaration
+| | `-SimpleDeclaration
+| |   |-friend
+| |   |-X
+| |   |-SimpleDeclarator
+| |   | |-operator
+| |   | |-+
+| |   | `-ParametersAndQualifiers
+| |   |   |-(
+| |   |   |-SimpleDeclaration
+| |   |   | |-const
+| |   |   | |-X
+| |   |   | `-SimpleDeclarator
+| |   |   |   `-&
+| |   |   |-,
+| |   |   |-SimpleDeclaration
+| |   |   | |-const
+| |   |   | |-X
+| |   |   | `-SimpleDeclarator
+| |   |   |   `-&
+| |   |   `-)
+| |   `-;
+| |-SimpleDeclaration
+| | |-SimpleDeclarator
+| | | |-operator
+| | | |-int
+| | | `-ParametersAndQualifiers
+| | |   |-(
+| | |   `-)
+| | `-;
+| |-}
+| `-;
+|-SimpleDeclaration
+| |-unsigned
+| |-SimpleDeclarator
+| | |-operator
+| | |-""
+| | |-_w
+| | `-ParametersAndQualifiers
+| |   |-(
+| |   |-SimpleDeclaration
+| |   | |-long
+| |   | |-long
+| |   | `-unsigned
+| |   `-)
+| `-;
+|-TemplateDeclaration
+| |-template
+| |-<
+| |-UnknownDeclaration
+| | |-typename
+| | `-T
+| |->
+| `-SimpleDeclaration
+|   |-void
+|   |-SimpleDeclarator
+|   | |-f
+|   | `-ParametersAndQualifiers
+|   |   |-(
+|   |   |-SimpleDeclaration
+|   |   | |-T
+|   |   | `-SimpleDeclarator
+|   |   |   `-&
+|   |   `-)
+|   `-;
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   |-SimpleDeclaration
+  |   | |-X
+  |   | `-SimpleDeclarator
+  |   |   `-x
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-IdExpression
+| | `-UnqualifiedId
+| |   `-x
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   |-operator
+| | |   `-+
+| | |-(
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-x
+| | |-,
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-x
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   |-operator
+| | |   |-""
+| | |   `-_w
+| | |-(
+| | |-IntegerLiteralExpression
+| | | `-1llu
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   |-f
+| | |   |-<
+| | |   |-X
+| | |   `->
+| | |-(
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-x
+| 

[PATCH] D81168: Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions

2020-06-18 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas marked an inline comment as not done.
eduucaldas added inline comments.



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:190
+return N->kind() == NodeKind::NameSpecifier;
+  }
+};

gribozavr2 wrote:
> Should there be getters for various parts of the specifier?
I think not.



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:209
+/// qualified-id:
+///   nested-name-specifier template_opt unqualified-id
+class IdExpression final : public Expression {

gribozavr2 wrote:
> Please add a TODO for the accessor for the 'template' keyword (and a test 
> that has that keyword).
I can implement accessor. But I couldn't write a test with this template 
keyword that uses `DeclRefExpr`.  [[ https://godbolt.org/z/XWGuZP | This ]] is 
the test I came up with, note that both expressions are represented as 
`DependentScopeDeclRefExpr`



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:216
+  }
+
+  syntax::NestedNameSpecifier *qualifier();

Just by looking at code it is impossible to know if the accessed thing is 
optional or not. 
IdExpression ALWAYS has a UnqualifiedId
IdExpression MAY have a NestedNameSpecifier
This same issue repeats in other places


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81168



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


[clang] 934bcaf - [Matrix] Add __builtin_matrix_column_load to Clang.

2020-06-18 Thread Florian Hahn via cfe-commits

Author: Florian Hahn
Date: 2020-06-18T10:47:55+01:00
New Revision: 934bcaf10b57fc199d9b15722ea50f65a791ca4e

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

LOG: [Matrix] Add __builtin_matrix_column_load to Clang.

This patch add __builtin_matrix_column_major_load to Clang,
as described in clang/docs/MatrixTypes.rst. In the initial version,
the stride is not optional yet.

Reviewers: rjmccall, rsmith, jfb, Bigcheese

Reviewed By: rjmccall

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

Added: 
clang/test/SemaCXX/matrix-type-builtins-disabled.cpp

Modified: 
clang/include/clang/AST/Type.h
clang/include/clang/Basic/Builtins.def
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaExpr.cpp
clang/test/CodeGen/matrix-type-builtins.c
clang/test/CodeGenCXX/matrix-type-builtins.cpp
clang/test/CodeGenObjC/matrix-type-builtins.m
clang/test/Sema/matrix-type-builtins.c
clang/test/SemaCXX/matrix-type-builtins.cpp

Removed: 




diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 7ff87c983037..d32e657843da 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -3476,6 +3476,11 @@ class ConstantMatrixType final : public MatrixType {
NumElements <= ConstantMatrixTypeBitfields::MaxElementsPerDimension;
   }
 
+  /// Returns the maximum number of elements per dimension.
+  static unsigned getMaxElementsPerDimension() {
+return ConstantMatrixTypeBitfields::MaxElementsPerDimension;
+  }
+
   void Profile(llvm::FoldingSetNodeID &ID) {
 Profile(ID, getElementType(), getNumRows(), getNumColumns(),
 getTypeClass());

diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index 4deca85bb867..61a195bf5bf8 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -578,6 +578,7 @@ BUILTIN(__builtin_alloca_with_align, "v*zIz", "Fn")
 BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
 
 BUILTIN(__builtin_matrix_transpose, "v.", "nFt")
+BUILTIN(__builtin_matrix_column_major_load, "v.", "nFt")
 
 // "Overloaded" Atomic operator builtins.  These are overloaded to support data
 // types of i8, i16, i32, i64, and i128.  The front-end sees calls to the

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 52fc40771228..fb45ad8d44d9 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10786,6 +10786,18 @@ def warn_import_on_definition : Warning<
 def err_builtin_matrix_arg: Error<
   "%select{first|second}0 argument must be a matrix">;
 
+def err_builtin_matrix_scalar_unsigned_arg: Error<
+  "%0 argument must be a constant unsigned integer expression">;
+
+def err_builtin_matrix_pointer_arg: Error<
+  "%select{first|second}0 argument must be a pointer to a valid matrix element 
type">;
+
+def err_builtin_matrix_stride_too_small: Error<
+  "stride must be greater or equal to the number of rows">;
+
+def err_builtin_matrix_invalid_dimension: Error<
+  "%0 dimension is outside the allowed range [1, %1]">;
+
 def err_preserve_field_info_not_field : Error<
   "__builtin_preserve_field_info argument %0 not a field access">;
 def err_preserve_field_info_not_const: Error<

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 8f619b80a3e7..4f8289d70747 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4702,6 +4702,10 @@ class Sema final {
   bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
  UnresolvedSetImpl &NonTemplateOverloads);
 
+  /// Try to convert an expression \p E to type \p Ty. Returns the result of 
the
+  /// conversion.
+  ExprResult tryConvertExprToType(Expr *E, QualType Ty);
+
   /// Conditionally issue a diagnostic based on the current
   /// evaluation context.
   ///
@@ -12123,6 +12127,8 @@ class Sema final {
   // Matrix builtin handling.
   ExprResult SemaBuiltinMatrixTranspose(CallExpr *TheCall,
 ExprResult CallResult);
+  ExprResult SemaBuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
+  ExprResult CallResult);
 
 public:
   enum FormatStringType {

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 05de88c392aa..8f8481a71ffb 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -2387,6 +2387,25 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,

[clang] 108560e - Try to remove the acle_sve_adda.s file that's breaking tests

2020-06-18 Thread Hans Wennborg via cfe-commits

Author: Hans Wennborg
Date: 2020-06-18T11:59:53+02:00
New Revision: 108560e58c41fc70341d763b941a0d6c24c4d3a9

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

LOG: Try to remove the acle_sve_adda.s file that's breaking tests

Added: 


Modified: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_adda.c

Removed: 




diff  --git a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_adda.c 
b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_adda.c
index 6ac6e5d0d618..7ce0e4ae4fc7 100644
--- a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_adda.c
+++ b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_adda.c
@@ -1,3 +1,5 @@
+// REQUIRES: shell
+// RUN: rm -f -- "%S/acle_sve_adda.s"
 // RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu 
-target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple 
aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns 
-S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
 



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


[clang] 4ea8e27 - [SveEmitter] Add builtins to insert/extract subvectors from tuples (svget/svset)

2020-06-18 Thread Sander de Smalen via cfe-commits

Author: Sander de Smalen
Date: 2020-06-18T11:06:16+01:00
New Revision: 4ea8e27a642c6f97ca69cd39bbe44f7366870f6c

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

LOG: [SveEmitter] Add builtins to insert/extract subvectors from tuples 
(svget/svset)

For example:
  svint32_t svget4(svint32x4_t tuple, uint64_t imm_index)

returns the subvector at `index`, which must be in range `0..3`.
  svint32x3_t svset3(svint32x3_t tuple, uint64_t index, svint32_t vec)

returns a tuple vector with `vec` inserted into `tuple` at `index`,
which must be in range `0..2`.

Reviewers: c-rhodes, efriedma

Reviewed By: c-rhodes

Tags: #clang

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

Added: 
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get2.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get3.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get4.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_set2.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_set3.c
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_set4.c
clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_get2.c
clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_get3.c
clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_get4.c
clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set2.c
clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set3.c
clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set4.c

Modified: 
clang/include/clang/Basic/TargetBuiltins.h
clang/include/clang/Basic/arm_sve.td
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaChecking.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/TargetBuiltins.h 
b/clang/include/clang/Basic/TargetBuiltins.h
index 38d82d1d869f..eba055c302a7 100644
--- a/clang/include/clang/Basic/TargetBuiltins.h
+++ b/clang/include/clang/Basic/TargetBuiltins.h
@@ -248,6 +248,8 @@ namespace clang {
 bool isReverseUSDOT() const { return Flags & ReverseUSDOT; }
 bool isUndef() const { return Flags & IsUndef; }
 bool isTupleCreate() const { return Flags & IsTupleCreate; }
+bool isTupleGet() const { return Flags & IsTupleGet; }
+bool isTupleSet() const { return Flags & IsTupleSet; }
 
 uint64_t getBits() const { return Flags; }
 bool isFlagSet(uint64_t Flag) const { return Flags & Flag; }

diff  --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index 0348a3754e22..7c8eb8d38f75 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -201,6 +201,8 @@ def ReverseCompare: FlagType<0x2000>; // 
Compare operands must b
 def ReverseUSDOT  : FlagType<0x4000>; // Unsigned/signed 
operands must be swapped.
 def IsUndef   : FlagType<0x8000>; // Codegen `undef` of 
given type.
 def IsTupleCreate : FlagType<0x1>;
+def IsTupleGet: FlagType<0x2>;
+def IsTupleSet: FlagType<0x4>;
 
 // These must be kept in sync with the flags in 
include/clang/Basic/TargetBuiltins.h
 class ImmCheckType {
@@ -219,6 +221,9 @@ def ImmCheckLaneIndexDot: ImmCheckType<9>;  // 
0..(128/(4*sizeinbits(elt
 def ImmCheckComplexRot90_270: ImmCheckType<10>; // [90,270]
 def ImmCheckComplexRotAll90 : ImmCheckType<11>; // [0, 90, 180,270]
 def ImmCheck0_13: ImmCheckType<12>; // 0..13
+def ImmCheck0_1 : ImmCheckType<13>; // 0..1
+def ImmCheck0_2 : ImmCheckType<14>; // 0..2
+def ImmCheck0_3 : ImmCheckType<15>; // 0..3
 
 class ImmCheck {
   int Arg = arg;
@@ -1284,6 +1289,17 @@ def SVCREATE_2 : SInst<"svcreate2[_{d}]", "2dd",   
"csilUcUsUiUlhfd", MergeNone,
 def SVCREATE_3 : SInst<"svcreate3[_{d}]", "3ddd",  "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_tuple_create3", [IsTupleCreate]>;
 def SVCREATE_4 : SInst<"svcreate4[_{d}]", "4", "csilUcUsUiUlhfd", 
MergeNone, "aarch64_sve_tuple_create4", [IsTupleCreate]>;
 
+
+
+// Vector insertion and extraction
+def SVGET_2 : SInst<"svget2[_{d}]", "d2i", "csilUcUsUiUlhfd", MergeNone, 
"aarch64_sve_tuple_get", [IsTupleGet], [ImmCheck<1, ImmCheck0_1>]>;
+def SVGET_3 : SInst<"svget3[_{d}]", "d3i", "csilUcUsUiUlhfd", MergeNone, 
"aarch64_sve_tuple_get", [IsTupleGet], [ImmCheck<1, ImmCheck0_2>]>;
+def SVGET_4 : SInst<"svget4[_{d}]", "d4i", "csilUcUsUiUlhfd", MergeNone, 
"aarch64_sve_tuple_get", [IsTupleGet], [ImmCheck<1, ImmCheck0_3>]>;
+
+def SVSET_2 : SInst<"svset2[_{d}]", "22id", "csilUcUsUiUlhfd", MergeNone, 
"aarch64_sve_tuple_set", [IsTupleSet], [ImmCheck<1, ImmCheck0_1>]>;
+def SVSET_3 : SInst<"

[PATCH] D81168: Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions

2020-06-18 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 271630.
eduucaldas added a comment.

Fix mistake on getting SourceRange for template-id


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81168

Files:
  clang/include/clang/Tooling/Syntax/Nodes.h
  clang/lib/Tooling/Syntax/BuildTree.cpp
  clang/lib/Tooling/Syntax/Nodes.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -485,8 +485,9 @@
 | | |-SimpleDeclarator
 | | | `-x
 | | `-:
-| |-UnknownExpression
-| | `-a
+| |-IdExpression
+| | `-UnqualifiedId
+| |   `-a
 | |-)
 | `-EmptyStatement
 |   `-;
@@ -662,8 +663,9 @@
 |-{
 |-ExpressionStatement
 | |-UnknownExpression
-| | |-UnknownExpression
-| | | `-test
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-test
 | | |-(
 | | `-)
 | `-;
@@ -675,16 +677,18 @@
 | |-)
 | |-ExpressionStatement
 | | |-UnknownExpression
-| | | |-UnknownExpression
-| | | | `-test
+| | | |-IdExpression
+| | | | `-UnqualifiedId
+| | | |   `-test
 | | | |-(
 | | | `-)
 | | `-;
 | |-else
 | `-ExpressionStatement
 |   |-UnknownExpression
-|   | |-UnknownExpression
-|   | | `-test
+|   | |-IdExpression
+|   | | `-UnqualifiedId
+|   | |   `-test
 |   | |-(
 |   | `-)
 |   `-;
@@ -692,6 +696,475 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, UnqualifiedId) {
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+  R"cpp(
+struct X {
+  // TODO: Expose `id-expression` from `Declarator`
+  friend X operator+(const X&, const X&);
+  operator int();
+};
+unsigned operator "" _w(long long unsigned);
+template
+void f(T&);
+void test(X x) {
+  x;  // identifier
+  operator+(x, x);// operator-function-id
+  operator "" _w(1llu);   // literal-operator-id
+
+  f(x);// template-id
+
+  // TODO: Expose `id-expression` from `MemberExpr`
+  x.operator int();   // conversion-funtion-id
+  x.~X(); // ~type-name
+  x.~decltype(x)();   // ~decltype-specifier
+}
+)cpp",
+  R"txt(
+*: TranslationUnit
+|-SimpleDeclaration
+| |-struct
+| |-X
+| |-{
+| |-UnknownDeclaration
+| | `-SimpleDeclaration
+| |   |-friend
+| |   |-X
+| |   |-SimpleDeclarator
+| |   | |-operator
+| |   | |-+
+| |   | `-ParametersAndQualifiers
+| |   |   |-(
+| |   |   |-SimpleDeclaration
+| |   |   | |-const
+| |   |   | |-X
+| |   |   | `-SimpleDeclarator
+| |   |   |   `-&
+| |   |   |-,
+| |   |   |-SimpleDeclaration
+| |   |   | |-const
+| |   |   | |-X
+| |   |   | `-SimpleDeclarator
+| |   |   |   `-&
+| |   |   `-)
+| |   `-;
+| |-SimpleDeclaration
+| | |-SimpleDeclarator
+| | | |-operator
+| | | |-int
+| | | `-ParametersAndQualifiers
+| | |   |-(
+| | |   `-)
+| | `-;
+| |-}
+| `-;
+|-SimpleDeclaration
+| |-unsigned
+| |-SimpleDeclarator
+| | |-operator
+| | |-""
+| | |-_w
+| | `-ParametersAndQualifiers
+| |   |-(
+| |   |-SimpleDeclaration
+| |   | |-long
+| |   | |-long
+| |   | `-unsigned
+| |   `-)
+| `-;
+|-TemplateDeclaration
+| |-template
+| |-<
+| |-UnknownDeclaration
+| | |-typename
+| | `-T
+| |->
+| `-SimpleDeclaration
+|   |-void
+|   |-SimpleDeclarator
+|   | |-f
+|   | `-ParametersAndQualifiers
+|   |   |-(
+|   |   |-SimpleDeclaration
+|   |   | |-T
+|   |   | `-SimpleDeclarator
+|   |   |   `-&
+|   |   `-)
+|   `-;
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   |-SimpleDeclaration
+  |   | |-X
+  |   | `-SimpleDeclarator
+  |   |   `-x
+  |   `-)
+  `-CompoundStatement
+|-{
+|-ExpressionStatement
+| |-IdExpression
+| | `-UnqualifiedId
+| |   `-x
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   |-operator
+| | |   `-+
+| | |-(
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-x
+| | |-,
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-x
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   |-operator
+| | |   |-""
+| | |   `-_w
+| | |-(
+| | |-IntegerLiteralExpression
+| | | `-1llu
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   |-f
+| | |   |-<
+| | |   |-X
+| | |   `->
+| | |-(
+| | |-IdExpression
+| | | `-UnqualifiedId
+| | |   `-x
+| | `-)
+| `-;
+|-ExpressionStatement
+| |-UnknownExpression
+| | |-UnknownExpression
+| | | |-IdExpression
+   

[PATCH] D72782: [Matrix] Add __builtin_matrix_column_store to Clang.

2020-06-18 Thread Florian Hahn via Phabricator via cfe-commits
fhahn marked an inline comment as done.
fhahn added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:10792
 def err_builtin_matrix_pointer_arg: Error<
-  "%select{first|second}0 argument must be a pointer to a valid matrix element 
type">;
+  "%0 argument must be a pointer to a valid matrix element type">;
+

rjmccall wrote:
> You can write `%ord0` to get the diagnostic to print `1st`, `2nd`, etc, if 
> that's acceptable vs. the spelled-out version.
Thanks for pointing me to `%ord`! I think most diagnostics for matrixes 
currently use the spelled out versions, but I'll prepare a follow-up patch to 
update all matrix diagnostics to consistently use `%ord`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72782



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


[PATCH] D72781: [Matrix] Add __builtin_matrix_column_load to Clang.

2020-06-18 Thread Florian Hahn via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG934bcaf10b57: [Matrix] Add __builtin_matrix_column_load to 
Clang. (authored by fhahn).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72781

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGen/matrix-type-builtins.c
  clang/test/CodeGenCXX/matrix-type-builtins.cpp
  clang/test/CodeGenObjC/matrix-type-builtins.m
  clang/test/Sema/matrix-type-builtins.c
  clang/test/SemaCXX/matrix-type-builtins-disabled.cpp
  clang/test/SemaCXX/matrix-type-builtins.cpp

Index: clang/test/SemaCXX/matrix-type-builtins.cpp
===
--- clang/test/SemaCXX/matrix-type-builtins.cpp
+++ clang/test/SemaCXX/matrix-type-builtins.cpp
@@ -39,3 +39,65 @@
   Mat3.value = transpose(Mat2);
   // expected-note@-1 {{in instantiation of function template specialization 'transpose' requested here}}
 }
+
+template 
+typename MyMatrix::matrix_t column_major_load(MyMatrix &A, EltTy0 *Ptr) {
+  char *v1 = __builtin_matrix_column_major_load(Ptr, 9, 4, 10);
+  // expected-error@-1 {{cannot initialize a variable of type 'char *' with an rvalue of type 'unsigned int __attribute__((matrix_type(9, 4)))'}}
+  // expected-error@-2 {{cannot initialize a variable of type 'char *' with an rvalue of type 'unsigned int __attribute__((matrix_type(9, 4)))'}}
+  // expected-error@-3 {{cannot initialize a variable of type 'char *' with an rvalue of type 'float __attribute__((matrix_type(9, 4)))'}}
+
+  return __builtin_matrix_column_major_load(Ptr, R0, C0, R0);
+  // expected-error@-1 {{cannot initialize return object of type 'typename MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(5, 5)))') with an rvalue of type 'unsigned int __attribute__((matrix_type(2, 3)))'}}
+  // expected-error@-2 {{cannot initialize return object of type 'typename MyMatrix::matrix_t' (aka 'unsigned int __attribute__((matrix_type(2, 3)))') with an rvalue of type 'float __attribute__((matrix_type(2, 3)))'}}
+}
+
+void test_column_major_loads_template(unsigned *Ptr1, float *Ptr2) {
+  MyMatrix Mat1;
+  Mat1.value = column_major_load(Mat1, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_load' requested here}}
+  column_major_load(Mat1, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_load' requested here}}
+
+  MyMatrix Mat2;
+  Mat1.value = column_major_load(Mat2, Ptr2);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_load' requested here}}
+}
+
+constexpr int constexpr1() { return 1; }
+constexpr int constexpr_neg1() { return -1; }
+
+void test_column_major_load_constexpr(unsigned *Ptr) {
+  (void)__builtin_matrix_column_major_load(Ptr, 2, 2, constexpr1());
+  // expected-error@-1 {{stride must be greater or equal to the number of rows}}
+  (void)__builtin_matrix_column_major_load(Ptr, constexpr_neg1(), 2, 4);
+  // expected-error@-1 {{row dimension is outside the allowed range [1, 1048575]}}
+  (void)__builtin_matrix_column_major_load(Ptr, 2, constexpr_neg1(), 4);
+  // expected-error@-1 {{column dimension is outside the allowed range [1, 1048575]}}
+}
+
+struct IntWrapper {
+  operator int() {
+return 1;
+  }
+};
+
+void test_column_major_load_wrapper(unsigned *Ptr, IntWrapper &W) {
+  (void)__builtin_matrix_column_major_load(Ptr, W, 2, 2);
+  // expected-error@-1 {{row argument must be a constant unsigned integer expression}}
+  (void)__builtin_matrix_column_major_load(Ptr, 2, W, 2);
+  // expected-error@-1 {{column argument must be a constant unsigned integer expression}}
+}
+
+template 
+void test_column_major_load_temp(T Ptr) {
+  (void)__builtin_matrix_column_major_load(Ptr, R, C, S);
+}
+
+void call_column_major_load_temp(unsigned *Ptr, unsigned X) {
+  (void)__builtin_matrix_column_major_load(Ptr, X, X, X);
+  // expected-error@-1 {{row argument must be a constant unsigned integer expression}}
+  // expected-error@-2 {{column argument must be a constant unsigned integer expression}}
+  (void)__builtin_matrix_column_major_load(X, 2, 2, 2);
+  // expected-error@-1 {{first argument must be a pointer to a valid matrix element type}}
+}
Index: clang/test/SemaCXX/matrix-type-builtins-disabled.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/matrix-type-builtins-disabled.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -pedantic -std=c++11 -verify -triple=x86_64-apple-darwin9
+
+// Make sure we fail without -fenable-matrix when
+// __builtin_matrix_column_major_load is used to construct a new matrix type.
+voi

[PATCH] D81464: [SveEmitter] Add builtins to insert/extract subvectors from tuples (svget/svset)

2020-06-18 Thread Sander de Smalen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4ea8e27a642c: [SveEmitter] Add builtins to insert/extract 
subvectors from tuples (svget/svset) (authored by sdesmalen).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81464

Files:
  clang/include/clang/Basic/TargetBuiltins.h
  clang/include/clang/Basic/arm_sve.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get2.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get3.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get4.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_set2.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_set3.c
  clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_set4.c
  clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_get2.c
  clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_get3.c
  clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_get4.c
  clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set2.c
  clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set3.c
  clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set4.c

Index: clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set4.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_set4.c
@@ -0,0 +1,143 @@
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=note %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=note %s
+
+#include 
+
+#ifdef SVE_OVERLOADED_FORMS
+// A simple used,unused... macro, long enough to represent any SVE builtin.
+#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
+#else
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+#endif
+
+svint8x4_t test_svset4_s8(svint8x4_t tuple, svint8_t x)
+{
+  // expected-error@+1 {{argument value 4 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_s8,,)(tuple, 4, x);
+}
+
+svint16x4_t test_svset4_s16(svint16x4_t tuple, svint16_t x)
+{
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_s16,,)(tuple, -1, x);
+}
+
+svint32x4_t test_svset4_s32(svint32x4_t tuple, svint32_t x)
+{
+  // expected-error@+1 {{argument value 4 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_s32,,)(tuple, 4, x);
+}
+
+svint64x4_t test_svset4_s64(svint64x4_t tuple, svint64_t x)
+{
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_s64,,)(tuple, -1, x);
+}
+
+svuint8x4_t test_svset4_u8(svuint8x4_t tuple, svuint8_t x)
+{
+  // expected-error@+1 {{argument value 4 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_u8,,)(tuple, 4, x);
+}
+
+svuint16x4_t test_svset4_u16(svuint16x4_t tuple, svuint16_t x)
+{
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_u16,,)(tuple, -1, x);
+}
+
+svuint32x4_t test_svset4_u32(svuint32x4_t tuple, svuint32_t x)
+{
+  // expected-error@+1 {{argument value 4 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_u32,,)(tuple, 4, x);
+}
+
+svuint64x4_t test_svset4_u64(svuint64x4_t tuple, svuint64_t x)
+{
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_u64,,)(tuple, -1, x);
+}
+
+svfloat16x4_t test_svset4_f16(svfloat16x4_t tuple, svfloat16_t x)
+{
+  // expected-error@+1 {{argument value 4 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_f16,,)(tuple, 4, x);
+}
+
+svfloat32x4_t test_svset4_f32(svfloat32x4_t tuple, svfloat32_t x)
+{
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_f32,,)(tuple, -1, x);
+}
+
+svfloat64x4_t test_svset4_f64(svfloat64x4_t tuple, svfloat64_t x)
+{
+  // expected-error@+1 {{argument value 4 is outside the valid range [0, 3]}}
+  return SVE_ACLE_FUNC(svset4,_f64,,)(tuple, 4, x);
+}
+
+svint8x4_t test_svset4_s8_var(svint8x4_t tuple, uint64_t imm_index, svint8_t x)
+{
+  // expected-error-re@+1 {{argument to '{{.*}}' must be a constant integer}}
+  return SVE_ACLE_FUNC(svset4,_s8,,)(tuple, imm_index, x);
+}
+
+svint16x4_t test_svset4_s16_var(svint16x4_t tuple, uint64_t imm_index, svint16_t x)
+{
+  // expected-error-re@+1 {{argument to '{{.*}}' must be a constant integer}}
+  return SVE_ACLE_FUNC(svset4,_s16,,)(tuple, imm_index, x);
+}
+
+svint32x4_t test_svset4_s32_var(svint32

[PATCH] D81168: Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions

2020-06-18 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added inline comments.



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:187
 
+/// A sequence of these specifiers make a `nested-name-specifier`
+class NameSpecifier final : public Tree {

Could you provide examples or a grammar quote in the comment?



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:207
+
+/// Models an `unqualified-id`, e.g. in `std::vector::size` it is `size`.
+/// C++ [expr.prim.id.unqual]

"the `size` in `std::vector::size`"



Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:214
+return N->kind() == NodeKind::UnqualifiedId;
+  }
+};

Could you add TODOs about adding accessors?



Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:700
+TEST_P(SyntaxTreeTest, UnqualifiedId) {
+  if (!GetParam().isCXX11OrLater()) {
+return;

Could you split off the parts of this test that don't depend on C++11?



Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:983
+
+TEST_P(SyntaxTreeTest, QualifiedIdWithTemplate) {
+  if (!GetParam().isCXX()) {

"WithTemplateKeyword"



Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:1101
+
+TEST_P(SyntaxTreeTest, DecltypeQualifiedId) {
+  if (!GetParam().isCXX11OrLater()) {

"QualifiedIdDecltype" for consistency with other tests.



Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:1109
+static void f(){}
+  };
+void test(S s) {

Indent -2?



Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:1112
+  decltype(s)::   // decltype-specifier
+  f();
+}

Could you indent the second line?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81168



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


[PATCH] D81678: Introduce partialinit attribute at call sites for stricter poison analysis

2020-06-18 Thread Gui Andrade via Phabricator via cfe-commits
guiand added a comment.

Adding the function attribute turns out to have other challenges. Specifically, 
we don't want to have transforms remove a `frozen` from a parameter and then 
have to go through and update all the other parameters. This might happen if 
the function is marked with `frozen_args`; something like `ArgumentPromotion`, 
which usually removes attributes, would have to be aware of it.

I spoke with Evgenii about having a "magic" function attribute that's only 
really exposed at the bitcode/text level. It would get converted to/from the 
individual parameter `frozen`s so that transforms don't need to know or care 
that it exists. `frozen_args` would only serve as a sort of compression keyword 
in the bitcode/text IR. He wasn't thrilled with the idea but suggested I get 
peoples' thoughts on it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81678



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


[PATCH] D81886: [AMDGPU] Add gfx1030 target

2020-06-18 Thread Stanislav Mekhanoshin via Phabricator via cfe-commits
rampitec marked an inline comment as done.
rampitec added inline comments.



Comment at: llvm/docs/AMDGPUUsage.rst:266-267

  names.
+ ``gfx1030`` ``amdgcn``   dGPU  - xnack   
*TBA*
+  [off]
+- wavefrontsize64

foad wrote:
> Seems odd to list xnack as a "supported fetaure" when the hardware doesn't 
> support it.
Yeah, it is off, but we may want to review the whole table.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81886



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


[PATCH] D81678: Introduce partialinit attribute at call sites for stricter poison analysis

2020-06-18 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

So I guess we've discussed the following alternatives so far:

1. Attach the "frozen" attribute everywhere; this makes the textual IR 
generated by clang messy, and likely bloats memory usage (not sure by how much).
2. Invert the meaning of the attribute; this makes reasoning about it messy.
3. Have a "frozen" attribute, but have a function attribute "frozen_args" to 
freeze all arguments.  This is slightly messy to access from C++, and messy to 
modify from C++.
4. Choose one of the previous three for memory, and a different one for textual 
IR, and do some magic to translate.  This makes it harder to understand the 
in-memory representation from reading textual IR.

I'm not particularly happy with any of these...

Maybe (1) is the least-bad; all the others compromise by making LLVM harder to 
understand.  We can make porting the clang tests easier by adding a cc1 flag to 
turn off emitting frozen attributes, I guess (so instead of updating the CHECK 
lines, you could just mechanically update the RUN line).

Maybe worth sending an email to llvm-dev.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81678



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


[PATCH] D81678: Introduce partialinit attribute at call sites for stricter poison analysis

2020-06-18 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis added a comment.

In D81678#2099444 , @efriedma wrote:

> So I guess we've discussed the following alternatives so far:
>
> 1. Attach the "frozen" attribute everywhere; this makes the textual IR 
> generated by clang messy, and likely bloats memory usage (not sure by how 
> much).
> 2. Invert the meaning of the attribute; this makes reasoning about it messy.
> 3. Have a "frozen" attribute, but have a function attribute "frozen_args" to 
> freeze all arguments.  This is slightly messy to access from C++, and messy 
> to modify from C++.
> 4. Choose one of the previous three for memory, and a different one for 
> textual IR, and do some magic to translate.  This makes it harder to 
> understand the in-memory representation from reading textual IR.
>
>   I'm not particularly happy with any of these...
>
>   Maybe (1) is the least-bad; all the others compromise by making LLVM harder 
> to understand.  We can make porting the clang tests easier by adding a cc1 
> flag to turn off emitting frozen attributes, I guess (so instead of updating 
> the CHECK lines, you could just mechanically update the RUN line).


I agree that (1) is the easiest to work with and the least error-prone, and 
that's what we must shoot for in the design. We could do (4) later as an 
optimization.

Not sure about the cc1 flag - it's an option, but it would mean we are not 
testing the same thing that is shipped to the users. It will make things a lot 
easier, on the other hand.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81678



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


[clang] b5e082e - [Matrix] Add __builtin_matrix_column_store to Clang.

2020-06-18 Thread Florian Hahn via cfe-commits

Author: Florian Hahn
Date: 2020-06-18T11:39:02+01:00
New Revision: b5e082e7289197bf82c9a28c6336b51d7999b419

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

LOG: [Matrix] Add __builtin_matrix_column_store to Clang.

This patch add __builtin_matrix_column_major_store to Clang,
as described in clang/docs/MatrixTypes.rst. In the initial version,
the stride is not optional yet.

Reviewers: rjmccall, jfb, rsmith, Bigcheese

Reviewed By: rjmccall

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

Added: 


Modified: 
clang/include/clang/Basic/Builtins.def
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/matrix-type-builtins.c
clang/test/CodeGenCXX/matrix-type-builtins.cpp
clang/test/CodeGenObjC/matrix-type-builtins.m
clang/test/Sema/matrix-type-builtins.c
clang/test/SemaCXX/matrix-type-builtins.cpp
clang/test/SemaObjC/matrix-type-builtins.m

Removed: 




diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index 61a195bf5bf8..ac9af6028867 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -579,6 +579,7 @@ BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
 
 BUILTIN(__builtin_matrix_transpose, "v.", "nFt")
 BUILTIN(__builtin_matrix_column_major_load, "v.", "nFt")
+BUILTIN(__builtin_matrix_column_major_store, "v.", "nFt")
 
 // "Overloaded" Atomic operator builtins.  These are overloaded to support data
 // types of i8, i16, i32, i64, and i128.  The front-end sees calls to the

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index fb45ad8d44d9..a7b8a992f745 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10783,14 +10783,19 @@ def warn_import_on_definition : Warning<
   "import %select{module|name}0 cannot be applied to a function with a 
definition">,
   InGroup;
 
-def err_builtin_matrix_arg: Error<
-  "%select{first|second}0 argument must be a matrix">;
+def err_builtin_matrix_arg: Error<"first argument must be a matrix">;
 
 def err_builtin_matrix_scalar_unsigned_arg: Error<
   "%0 argument must be a constant unsigned integer expression">;
 
 def err_builtin_matrix_pointer_arg: Error<
-  "%select{first|second}0 argument must be a pointer to a valid matrix element 
type">;
+  "%0 argument must be a pointer to a valid matrix element type">;
+
+def err_builtin_matrix_pointer_arg_mismatch: Error<
+  "the pointee of the second argument must match the element type of the first 
argument (%0 != %1)">;
+
+def err_builtin_matrix_store_to_const: Error<
+  "cannot store matrix to read-only pointer">;
 
 def err_builtin_matrix_stride_too_small: Error<
   "stride must be greater or equal to the number of rows">;

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 4f8289d70747..85c5ab476b5f 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -12129,6 +12129,8 @@ class Sema final {
 ExprResult CallResult);
   ExprResult SemaBuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
   ExprResult CallResult);
+  ExprResult SemaBuiltinMatrixColumnMajorStore(CallExpr *TheCall,
+   ExprResult CallResult);
 
 public:
   enum FormatStringType {

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 7a138c54fb36..2339446609f6 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -2406,6 +2406,25 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 return RValue::get(Result);
   }
 
+  case Builtin::BI__builtin_matrix_column_major_store: {
+MatrixBuilder MB(Builder);
+Value *Matrix = EmitScalarExpr(E->getArg(0));
+Address Dst = EmitPointerWithAlignment(E->getArg(1));
+Value *Stride = EmitScalarExpr(E->getArg(2));
+
+const auto *MatrixTy = 
E->getArg(0)->getType()->getAs();
+auto *PtrTy = E->getArg(1)->getType()->getAs();
+assert(PtrTy && "arg1 must be of pointer type");
+bool IsVolatile = PtrTy->getPointeeType().isVolatileQualified();
+
+EmitNonNullArgCheck(RValue::get(Dst.getPointer()), E->getArg(1)->getType(),
+E->getArg(1)->getExprLoc(), FD, 0);
+Value *Result = MB.CreateColumnMajorStore(
+Matrix, Dst.getPointer(), Align(Dst.getAlignment().getQuantity()),
+Stride, IsVolatile, MatrixTy->getNumRows(), MatrixTy->getNumColumns());
+return RValue::get(R

[PATCH] D78903: [Driver] Add option -fproc-stat-report

2020-06-18 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff updated this revision to Diff 271648.
sepavloff added a comment.

Updated patch according to reviewer's notes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78903

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Driver/Job.h
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/Job.cpp
  clang/test/Driver/report-stat.c

Index: clang/test/Driver/report-stat.c
===
--- /dev/null
+++ clang/test/Driver/report-stat.c
@@ -0,0 +1,6 @@
+// RUN: %clang -c -fproc-stat-report %s | FileCheck %s
+// CHECK: clang{{.*}}: output={{.*}}.o, total={{[0-9.]+}} ms, user={{[0-9.]+}} ms, mem={{[0-9]+}} Kb
+
+// RUN: %clang -c -fproc-stat-report=%t %s
+// RUN: cat %t | FileCheck --check-prefix=CSV %s
+// CSV: clang{{.*}},"{{.*}}.o",{{[0-9]+}},{{[0-9]+}},{{[0-9]+}}
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -370,8 +370,8 @@
 
   auto Args = llvm::toStringRefArray(Argv.data());
   return llvm::sys::ExecuteAndWait(Executable, Args, Env, Redirects,
-   /*secondsToWait*/ 0,
-   /*memoryLimit*/ 0, ErrMsg, ExecutionFailed);
+  /*secondsToWait*/ 0, /*memoryLimit*/ 0, ErrMsg, ExecutionFailed,
+  &ProcStat);
 }
 
 CC1Command::CC1Command(const Action &Source, const Tool &Creator,
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3761,11 +3761,70 @@
/*TargetDeviceOffloadKind*/ Action::OFK_None);
   }
 
-  // If we have more than one job, then disable integrated-cc1 for now.
-  if (C.getJobs().size() > 1)
+  StringRef StatReportFile;
+  bool PrintProcessStat = false;
+  if (const Arg *A = C.getArgs().getLastArg(options::OPT_fproc_stat_report_EQ))
+StatReportFile = A->getValue();
+  if (C.getArgs().hasArg(options::OPT_fproc_stat_report))
+PrintProcessStat = true;
+
+  // If we have more than one job, then disable integrated-cc1 for now. Do this
+  // also when we need to report process execution statistics.
+  if (C.getJobs().size() > 1 || !StatReportFile.empty() || PrintProcessStat)
 for (auto &J : C.getJobs())
   J.InProcess = false;
 
+  if (!StatReportFile.empty() || PrintProcessStat) {
+C.setPostCallback([=](const Command &Cmd, int Res) {
+  Optional ProcStat
+  = Cmd.getProcessStatistics();
+  if (ProcStat) {
+if (PrintProcessStat) {
+  using namespace llvm;
+  // Human readable output.
+  outs() << sys::path::filename(Cmd.getExecutable()) << ": "
+ << "output=";
+  if (Cmd.getOutputFilenames().empty())
+outs() << "\"\"";
+  else
+outs() << Cmd.getOutputFilenames().front();
+  outs() << ", total="
+ << format("%.3f", ProcStat->TotalTime.count() / 1000.) << " ms"
+ << ", user="
+ << format("%.3f", ProcStat->UserTime.count() / 1000.) << " ms"
+ << ", mem=" << ProcStat->PeakMemory << " Kb\n";
+}
+if (!StatReportFile.empty()) {
+  // CSV format.
+  std::string Buffer;
+  llvm::raw_string_ostream Out(Buffer);
+  Out << llvm::sys::path::filename(Cmd.getExecutable()) << ',';
+  if (Cmd.getOutputFilenames().empty())
+Out << "\"\"";
+  else
+Command::printArg(Out, Cmd.getOutputFilenames().front(), true);
+  Out << ','
+  << ProcStat->TotalTime.count() << ','
+  << ProcStat->UserTime.count() << ','
+  << ProcStat->PeakMemory << '\n';
+  Out.flush();
+  std::error_code EC;
+  llvm::raw_fd_ostream OS(StatReportFile, EC, llvm::sys::fs::OF_Append);
+  if (!EC) {
+if (auto L = OS.tryToLock())
+  OS << Buffer;
+else
+  handleAllErrors(std::move(L.takeError()),
+  [&](llvm::ErrorInfoBase &EIB) {
+llvm::errs() << "ERROR: Cannot lock file " << StatReportFile
+ << "n";
+  });
+  }
+}
+  }
+});
+  }
+
   // If the user passed -Qunused-arguments or there were errors, don't warn
   // about any unused arguments.
   if (Diags.hasErrorOccurred() ||
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1848,6 +1848,10 @@
 def ftime_trace_granularity_EQ : Joined<["-"], "ftime-trace-granularity=">, Group,
   HelpText<"Minimum time granularity (in microseconds) traced by time profiler">,

[PATCH] D82081: [z/OS] Add binary format goff and operating system zos to the triple

2020-06-18 Thread Kai Nacke via Phabricator via cfe-commits
Kai created this revision.
Kai added reviewers: uweigand, yusra.syeda, kbarton, eli.friedman, MaskRay, 
hubert.reinterpretcast, cor3ntin, ldionne, tahonermann, simoll, kaz7, stuij.
Herald added subscribers: llvm-commits, cfe-commits, dexonsmith, hiraditya.
Herald added projects: clang, LLVM.

Adds the binary format goff and the operating system zos to the triple class. 
goff is selected as default binary format if zos is choosen as operating 
system. No further functionality is added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82081

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGObjCMac.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/Support/TargetRegistry.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  llvm/unittests/ADT/TripleTest.cpp

Index: llvm/unittests/ADT/TripleTest.cpp
===
--- llvm/unittests/ADT/TripleTest.cpp
+++ llvm/unittests/ADT/TripleTest.cpp
@@ -170,6 +170,18 @@
   EXPECT_EQ(Triple::FreeBSD, T.getOS());
   EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
+  T = Triple("s390x-ibm-zos");
+  EXPECT_EQ(Triple::systemz, T.getArch());
+  EXPECT_EQ(Triple::IBM, T.getVendor());
+  EXPECT_EQ(Triple::ZOS, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
+  T = Triple("systemz-ibm-zos");
+  EXPECT_EQ(Triple::systemz, T.getArch());
+  EXPECT_EQ(Triple::IBM, T.getVendor());
+  EXPECT_EQ(Triple::ZOS, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
   T = Triple("arm-none-none-eabi");
   EXPECT_EQ(Triple::arm, T.getArch());
   EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
@@ -1289,6 +1301,15 @@
   EXPECT_EQ(Triple::ELF, Triple("i686-pc-windows-msvc-elf").getObjectFormat());
   EXPECT_EQ(Triple::ELF, Triple("i686-pc-cygwin-elf").getObjectFormat());
 
+  EXPECT_EQ(Triple::ELF, Triple("systemz-ibm-linux").getObjectFormat());
+  EXPECT_EQ(Triple::ELF, Triple("systemz-ibm-unknown").getObjectFormat());
+
+  EXPECT_EQ(Triple::GOFF, Triple("s390x-ibm-zos").getObjectFormat());
+  EXPECT_EQ(Triple::GOFF, Triple("systemz-ibm-zos").getObjectFormat());
+  EXPECT_EQ(Triple::GOFF, Triple("s390x-ibm-zos-goff").getObjectFormat());
+  EXPECT_EQ(Triple::GOFF, Triple("s390x-unknown-zos-goff").getObjectFormat());
+  EXPECT_EQ(Triple::GOFF, Triple("s390x---goff").getObjectFormat());
+
   EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-unknown").getObjectFormat());
   EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-unknown").getObjectFormat());
   EXPECT_EQ(Triple::Wasm, Triple("wasm32-wasi").getObjectFormat());
@@ -1335,6 +1356,9 @@
 
   T.setObjectFormat(Triple::XCOFF);
   EXPECT_EQ(Triple::XCOFF, T.getObjectFormat());
+
+  T.setObjectFormat(Triple::GOFF);
+  EXPECT_EQ(Triple::GOFF, T.getObjectFormat());
 }
 
 TEST(TripleTest, NormalizeWindows) {
Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1961,6 +1961,7 @@
   case Triple::MachO: return "__DATA,__asan_globals,regular";
   case Triple::Wasm:
   case Triple::XCOFF:
+  case Triple::GOFF:
 report_fatal_error(
 "ModuleAddressSanitizer not implemented for object file format.");
   case Triple::UnknownObjectFormat:
Index: llvm/lib/Support/Triple.cpp
===
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -217,6 +217,7 @@
   case WASI: return "wasi";
   case WatchOS: return "watchos";
   case Win32: return "windows";
+  case ZOS: return "zos";
   }
 
   llvm_unreachable("Invalid OSType");
@@ -503,6 +504,7 @@
 .StartsWith("solaris", Triple::Solaris)
 .StartsWith("win32", Triple::Win32)
 .StartsWith("windows", Triple::Win32)
+.StartsWith("zos", Triple::ZOS)
 .StartsWith("haiku", Triple::Haiku)
 .StartsWith("minix", Triple::Minix)
 .StartsWith("rtems", Triple::RTEMS)
@@ -557,6 +559,7 @@
 .EndsWith("xcoff", Triple::XCOFF)
 .EndsWith("coff", Triple::COFF)
 .EndsWith("elf", Triple::ELF)
+.EndsWith("goff", Triple::GOFF)
 .EndsWith("macho", Triple::MachO)
 .EndsWith("wasm", Triple::Wasm)
 .Default(Triple::UnknownObjectFormat);
@@ -651,6 +654,7 @@
   case Triple::MachO: return "macho";
   case Triple::Wasm:  return "wasm";
   case Triple::XCOFF: return "xcoff";
+  case Triple::GOFF:  return "goff";
   }
   llvm_unreachable("unknown object format type");
 }
@@ -705,7 +709,6 @@
   case Triple::sparcv9:
   case Triple::spir64:
   case Triple::spir:
-  case Triple::systemz:
   case Triple::tce:
   case Triple::tcele:
   case Triple::thumbeb:
@@ -719,6 +722,11 @@
   return Triple::XCOFF;
 return T

[PATCH] D72782: [Matrix] Add __builtin_matrix_column_store to Clang.

2020-06-18 Thread Florian Hahn via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb5e082e72891: [Matrix] Add __builtin_matrix_column_store to 
Clang. (authored by fhahn).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72782

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/matrix-type-builtins.c
  clang/test/CodeGenCXX/matrix-type-builtins.cpp
  clang/test/CodeGenObjC/matrix-type-builtins.m
  clang/test/Sema/matrix-type-builtins.c
  clang/test/SemaCXX/matrix-type-builtins.cpp
  clang/test/SemaObjC/matrix-type-builtins.m

Index: clang/test/SemaObjC/matrix-type-builtins.m
===
--- clang/test/SemaObjC/matrix-type-builtins.m
+++ clang/test/SemaObjC/matrix-type-builtins.m
@@ -19,3 +19,13 @@
   m = __builtin_matrix_transpose(mv.value);
   // expected-error@-1 {{assigning to 'double3x3' (aka 'double __attribute__((matrix_type(3, 3)))') from incompatible type 'double __attribute__((matrix_type(4, 4)))'}}
 }
+
+double test_store(MatrixValue *mv, float *Ptr) {
+  __builtin_matrix_column_major_store(mv.value, Ptr, 1);
+  // expected-error@-1 {{the pointee of the second argument must match the element type of the first argument ('float' != 'double')}}
+  // expected-error@-2 {{stride must be greater or equal to the number of rows}}
+
+  __builtin_matrix_column_major_store(mv.value, mv.value, mv.value);
+  // expected-error@-1 {{second argument must be a pointer to a valid matrix element type}}
+  // expected-error@-2 {{casting 'double4x4' (aka 'double __attribute__((matrix_type(4, 4)))') to incompatible type 'unsigned long'}}
+}
Index: clang/test/SemaCXX/matrix-type-builtins.cpp
===
--- clang/test/SemaCXX/matrix-type-builtins.cpp
+++ clang/test/SemaCXX/matrix-type-builtins.cpp
@@ -101,3 +101,66 @@
   (void)__builtin_matrix_column_major_load(X, 2, 2, 2);
   // expected-error@-1 {{first argument must be a pointer to a valid matrix element type}}
 }
+
+template 
+void column_major_store(MyMatrix &A, PtrTy Ptr, unsigned Stride) {
+  __builtin_matrix_column_major_store(A.value, Ptr, Stride);
+  // expected-error@-1 {{the pointee of the second argument must match the element type of the first argument ('float' != 'unsigned int')}}
+}
+
+template 
+void column_major_store(MTy &A, PtrTy Ptr) {
+  __builtin_matrix_column_major_store(A.value, Ptr, Stride);
+  // expected-error@-1 {{stride must be greater or equal to the number of rows}}
+}
+
+void test_column_major_stores_template(MyMatrix &M1, unsigned *Ptr1, MyMatrix &M2, float *Ptr2) {
+  column_major_store(M1, Ptr2, 10);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store' requested here}}
+
+  column_major_store(M2, Ptr2);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store &, float *, 1>' requested here}}
+}
+
+template 
+void column_major_store(MyMatrix &A, EltTy1 *Ptr) {
+  __builtin_matrix_column_major_store(A.value, Ptr, 1);
+  // expected-error@-1 3 {{stride must be greater or equal to the number of rows}}
+  // expected-error@-2 {{the pointee of the second argument must match the element type of the first argument ('float' != 'unsigned int')}}
+  // expected-error@-3 {{the pointee of the second argument must match the element type of the first argument ('unsigned int' != 'float')}}
+
+  char *s;
+  return __builtin_matrix_column_major_store(A.value, s, 20);
+  // expected-error@-1 {{the pointee of the second argument must match the element type of the first argument ('char' != 'unsigned int')}}
+  // expected-error@-2 {{the pointee of the second argument must match the element type of the first argument ('char' != 'unsigned int')}}
+  // expected-error@-3 {{he pointee of the second argument must match the element type of the first argument ('char' != 'float')}}
+}
+
+void test_column_major_store_template(unsigned *Ptr1, float *Ptr2) {
+  MyMatrix Mat1;
+  column_major_store(Mat1, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store'}}
+  column_major_store(Mat1, Ptr2);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store'}}
+
+  MyMatrix Mat2;
+  column_major_store(Mat2, Ptr1);
+  // expected-note@-1 {{in instantiation of function template specialization 'column_major_store'}}
+}
+
+void test_column_major_store_constexpr(unsigned *Ptr, MyMatrix &M) {
+  __builtin_matrix_column_major_store(M.value, Ptr, constexpr1());
+  // expected-error@-1 {{stride must be greater or equal to the number of rows}}
+  __builtin_matrix_column_major_store(constexpr1(), Ptr, 1);
+  // expected-error@-1 {{first ar

[PATCH] D81304: [llvm][SveEmitter] Emit the bfloat version of `svld1ro`.

2020-06-18 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1ro-bfloat.c:1
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 
-fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE 
-DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s

fpetrogalli wrote:
> sdesmalen wrote:
> > stuij wrote:
> > > There should be no dependency on `-fallow-half-arguments-and-returns`. 
> > > For bfloat we should use `-mfloat-abi hard`. Does this work for 
> > > `-mfloat-abi softfp`?
> > `-fallow-half-arguments-and-returns` isn't strictly needed for this test, 
> > we just use the same RUN line for all the ACLE tests and we needed this for 
> > `__fp16` in some of the tests.
> > 
> > I don't believe that `-mfloat-abi softfp` is supported for AArch64.
> @stuij - the following lines work, one with `softfp` and one with `hard`:
> 
> ```
> // RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
> -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE 
> -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve 
> -target\
> -feature +bf16 -mfloat-abi softfp -fallow-half-arguments-and-returns -S -O1 
> -Werror -Wall -emit-llvm -o - %s | FileCheck %s
> // RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
> -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE 
> -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve 
> -target\
> -feature +bf16 -mfloat-abi hard -fallow-half-arguments-and-returns -S -O1 
> -Werror -Wall -emit-llvm -o - %s | FileCheck %s
> ```
> 
> @sdesmalen I am not an experer here, but there is a test which targets 
> aarch64 that uses `softfp` (see 
> `clang/test/CodeGen/arm-bf16-params-returns.c`). The following line in that 
> test clearly targets `aarch64`:
> 
> ```
> // RUN: %clang_cc1 -triple aarch64-arm-none-eabi -target-abi aapcs 
> -mfloat-abi softfp -target-feature +bf16 -target-feature +neon -emit-llvm -O2 
> -o - %s | opt -S -mem2reg -sroa | FileCheck %s \
> --check-prefix=CHECK64-SOFTFP
> ```
> 
> @both - should I update the test with the two extra RUN lines mentioned up in 
> the message?
> @sdesmalen I am not an experer here, but there is a test which targets 
> aarch64 that uses softfp (see clang/test/CodeGen/arm-bf16-params-returns.c). 
> The following line in that test clearly targets aarch64:
`clang/test/CodeGen/arm-bf16-params-returns.c` also shows that setting `softfp` 
has no effect for AArch64.

> @both - should I update the test with the two extra RUN lines mentioned up in 
> the message?
No, I think the extra RUN lines aren't necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81304



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


[PATCH] D81972: [NFC] Cleanup of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc()

2020-06-18 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 271661.
Xiangling_L marked 2 inline comments as done.
Xiangling_L added a comment.

Address comments;


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

https://reviews.llvm.org/D81972

Files:
  clang/lib/CodeGen/CGDeclCXX.cpp


Index: clang/lib/CodeGen/CGDeclCXX.cpp
===
--- clang/lib/CodeGen/CGDeclCXX.cpp
+++ clang/lib/CodeGen/CGDeclCXX.cpp
@@ -533,6 +533,22 @@
   CXXThreadLocals.clear();
 }
 
+static SmallString<128> getTransformedFileName(llvm::Module &M) {
+  SmallString<128> FileName = llvm::sys::path::filename(M.getName());
+
+  if (FileName.empty())
+FileName = "";
+
+  for (size_t i = 0; i < FileName.size(); ++i) {
+// Replace everything that's not [a-zA-Z0-9._] with a _. This set happens
+// to be the set of C preprocessing numbers.
+if (!isPreprocessingNumberBody(FileName[i]))
+  FileName[i] = '_';
+  }
+
+  return FileName;
+}
+
 void
 CodeGenModule::EmitCXXGlobalInitFunc() {
   while (!CXXGlobalInits.empty() && !CXXGlobalInits.back())
@@ -577,22 +593,12 @@
 PrioritizedCXXGlobalInits.clear();
   }
 
-  // Include the filename in the symbol name. Including "sub_" matches gcc and
-  // makes sure these symbols appear lexicographically behind the symbols with
-  // priority emitted above.
-  SmallString<128> FileName = llvm::sys::path::filename(getModule().getName());
-  if (FileName.empty())
-FileName = "";
-
-  for (size_t i = 0; i < FileName.size(); ++i) {
-// Replace everything that's not [a-zA-Z0-9._] with a _. This set happens
-// to be the set of C preprocessing numbers.
-if (!isPreprocessingNumberBody(FileName[i]))
-  FileName[i] = '_';
-  }
-
+  // Include the filename in the symbol name. Including "sub_" matches gcc
+  // and makes sure these symbols appear lexicographically behind the symbols
+  // with priority emitted above.
   llvm::Function *Fn = CreateGlobalInitOrDestructFunction(
-  FTy, llvm::Twine("_GLOBAL__sub_I_", FileName), FI);
+  FTy,
+  llvm::Twine("_GLOBAL__sub_I_", getTransformedFileName(getModule())), FI);
 
   CodeGenFunction(*this).GenerateCXXGlobalInitFunc(Fn, CXXGlobalInits);
   AddGlobalCtor(Fn);
@@ -631,6 +637,7 @@
 
   CodeGenFunction(*this).GenerateCXXGlobalDtorsFunc(Fn, CXXGlobalDtors);
   AddGlobalDtor(Fn);
+  CXXGlobalDtors.clear();
 }
 
 /// Emit the code necessary to initialize the given global variable.


Index: clang/lib/CodeGen/CGDeclCXX.cpp
===
--- clang/lib/CodeGen/CGDeclCXX.cpp
+++ clang/lib/CodeGen/CGDeclCXX.cpp
@@ -533,6 +533,22 @@
   CXXThreadLocals.clear();
 }
 
+static SmallString<128> getTransformedFileName(llvm::Module &M) {
+  SmallString<128> FileName = llvm::sys::path::filename(M.getName());
+
+  if (FileName.empty())
+FileName = "";
+
+  for (size_t i = 0; i < FileName.size(); ++i) {
+// Replace everything that's not [a-zA-Z0-9._] with a _. This set happens
+// to be the set of C preprocessing numbers.
+if (!isPreprocessingNumberBody(FileName[i]))
+  FileName[i] = '_';
+  }
+
+  return FileName;
+}
+
 void
 CodeGenModule::EmitCXXGlobalInitFunc() {
   while (!CXXGlobalInits.empty() && !CXXGlobalInits.back())
@@ -577,22 +593,12 @@
 PrioritizedCXXGlobalInits.clear();
   }
 
-  // Include the filename in the symbol name. Including "sub_" matches gcc and
-  // makes sure these symbols appear lexicographically behind the symbols with
-  // priority emitted above.
-  SmallString<128> FileName = llvm::sys::path::filename(getModule().getName());
-  if (FileName.empty())
-FileName = "";
-
-  for (size_t i = 0; i < FileName.size(); ++i) {
-// Replace everything that's not [a-zA-Z0-9._] with a _. This set happens
-// to be the set of C preprocessing numbers.
-if (!isPreprocessingNumberBody(FileName[i]))
-  FileName[i] = '_';
-  }
-
+  // Include the filename in the symbol name. Including "sub_" matches gcc
+  // and makes sure these symbols appear lexicographically behind the symbols
+  // with priority emitted above.
   llvm::Function *Fn = CreateGlobalInitOrDestructFunction(
-  FTy, llvm::Twine("_GLOBAL__sub_I_", FileName), FI);
+  FTy,
+  llvm::Twine("_GLOBAL__sub_I_", getTransformedFileName(getModule())), FI);
 
   CodeGenFunction(*this).GenerateCXXGlobalInitFunc(Fn, CXXGlobalInits);
   AddGlobalCtor(Fn);
@@ -631,6 +637,7 @@
 
   CodeGenFunction(*this).GenerateCXXGlobalDtorsFunc(Fn, CXXGlobalDtors);
   AddGlobalDtor(Fn);
+  CXXGlobalDtors.clear();
 }
 
 /// Emit the code necessary to initialize the given global variable.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81003: [clang] SequenceChecker: Also visit default arguments and default initializers.

2020-06-18 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno updated this revision to Diff 271659.
riccibruno added a comment.

- Remove a left-over FIXME in the tests.
- Use a `%select` in the diagnostic.
- Pack `AdditionalSourceLocationData` into two `unsigned`s.
- Simplify the chain walking code in `checkUsage`.
- Mark the patch as needing review since the code has changed substantially 
since the original patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81003

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/SemaCXX/warn-unsequenced.cpp

Index: clang/test/SemaCXX/warn-unsequenced.cpp
===
--- clang/test/SemaCXX/warn-unsequenced.cpp
+++ clang/test/SemaCXX/warn-unsequenced.cpp
@@ -268,6 +268,114 @@
   // cxx17-warning@-1 {{unsequenced modification and access to 'pf'}}
 }
 
+namespace default_arg {
+  int a;
+  void f1(int = a, int = a++); // cxx11-warning 2{{unsequenced modification and access to 'a'}}
+   // cxx17-warning@-1 2{{unsequenced modification and access to 'a'}}
+
+  void f2(int = a++, int = a); // cxx11-warning {{unsequenced modification and access to 'a'}}
+   // cxx17-warning@-1 {{unsequenced modification and access to 'a'}}
+
+  void f3(int = a++, int = sizeof(a));
+
+  void test() {
+int b;
+f1();// cxx11-note {{in default argument used here}}
+ // cxx17-note@-1 {{in default argument used here}}
+f1(a);   // cxx11-note {{in default argument used here}}
+ // cxx17-note@-1 {{in default argument used here}}
+f1(a,a); // ok
+f1(b);   // ok
+f1(b,a++);   // ok
+
+f2();// cxx11-note {{in default argument used here}}
+ // cxx17-note@-1 {{in default argument used here}}
+f2(a);   // ok
+f2(a++); // cxx11-warning {{unsequenced modification and access to 'a'}}
+ // cxx17-warning@-1 {{unsequenced modification and access to 'a'}}
+
+f3();   // ok
+f3(a++);// ok
+  }
+}
+
+namespace default_init {
+  int a;
+  struct AggregateInCXX17 { int b = ++a; };
+  // cxx17-warning@-1 {{unsequenced modification and access to 'a'}}
+  void test_default_init() {
+int c = AggregateInCXX17{}.b + a;
+// cxx17-note@-1 {{in default initializer used here}}
+  }
+
+  struct NonAggregate { int b = ++a; virtual ~NonAggregate(); };
+  void test_default_init_non_aggregate() {
+int c = NonAggregate{}.b + a;
+  }
+}
+
+namespace default_arg_chain_0 {
+  int i;
+  int f0(int = i);
+  int f1(int = f0());
+  int f2(int = f1());
+  int f3(int, int = f2());
+
+  void test() {
+f3(i);// ok
+f3(i++);  // cxx11-warning {{unsequenced modification and access to 'i'}}
+  // cxx17-warning@-1 {{unsequenced modification and access to 'i'}}
+  }
+}
+
+namespace default_arg_chain_1 {
+  int i;
+  int f0(int = i++); // cxx11-warning {{unsequenced modification and access to 'i'}}
+ // cxx17-warning@-1 {{unsequenced modification and access to 'i'}}
+
+  int f1(int = f0());  // cxx11-note {{in default argument used here}}
+   // cxx17-note@-1 {{in default argument used here}}
+
+  int f2(int = f1());  // cxx11-note {{in default argument used here}}
+   // cxx17-note@-1 {{in default argument used here}}
+
+  int f3(int, int = f2()); // cxx11-note {{in default argument used here}}
+   // cxx17-note@-1 {{in default argument used here}}
+
+  void test() {
+f3(0);// ok
+f3(i);// cxx11-note {{in default argument used here}}
+  // cxx17-note@-1 {{in default argument used here}}
+  }
+}
+
+namespace default_arg_init_chain {
+  int i;
+  struct X { int b = ++i; }; // cxx17-warning 4{{unsequenced modification and access to 'i'}}
+
+  // Ok since X is an aggregate in C++17 but not in C++11.
+
+  int g0(int = X{}.b); // cxx17-note 4{{in default initializer used here}}
+  int g1(int = g0());  // cxx17-note 4{{in default argument used here}}
+  int g2(int = g1());  // cxx17-note 4{{in default argument used here}}
+  int g3(int = g2());  // cxx17-note 4{{in default argument used here}}
+
+  int g4a(int, int = g3() + i);  // cxx17-note {{in default argument used here}}
+  int g4b(int, int = i + g3());  // cxx17-note {{in default argument used here}}
+
+  int g5a(int = 0, int = g3());  // cxx17-note {{in default argument used here}}
+  int g5b(int = g3(), int = 0);
+
+  void test() {
+g5a();// ok
+g5b();// ok
+g5a(i);   // cxx17-note {{in default argument used here}}
+g5b(g3());// ok
+g5b(g3(), i); // cxx17-note {{in default argument used here}}
+  }
+}
+
+
 namespace PR20819 {
   struct foo { void bar(int); };
   foo get_foo(int);
Index: clang/lib/Sema/SemaC

[clang] d8c612b - Make matrix-type-builtins.m pass also on platforms where the type is 'unsigned long long'

2020-06-18 Thread Hans Wennborg via cfe-commits

Author: Hans Wennborg
Date: 2020-06-18T14:06:55+02:00
New Revision: d8c612b7eabcc7ec399fad533d5beefa4ae08ac9

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

LOG: Make matrix-type-builtins.m pass also on platforms where the type is 
'unsigned long long'

Added: 


Modified: 
clang/test/SemaObjC/matrix-type-builtins.m

Removed: 




diff  --git a/clang/test/SemaObjC/matrix-type-builtins.m 
b/clang/test/SemaObjC/matrix-type-builtins.m
index 63193574ca45..8187bffae525 100644
--- a/clang/test/SemaObjC/matrix-type-builtins.m
+++ b/clang/test/SemaObjC/matrix-type-builtins.m
@@ -27,5 +27,5 @@ void test_element_type_mismatch(u4x4 m, MatrixValue *mv) {
 
   __builtin_matrix_column_major_store(mv.value, mv.value, mv.value);
   // expected-error@-1 {{second argument must be a pointer to a valid matrix 
element type}}
-  // expected-error@-2 {{casting 'double4x4' (aka 'double 
__attribute__((matrix_type(4, 4)))') to incompatible type 'unsigned long'}}
+  // expected-error@-2 {{casting 'double4x4' (aka 'double 
__attribute__((matrix_type(4, 4)))') to incompatible type 'unsigned long}}
 }



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


[clang] ada4c9d - [ARM][Clang] Removing lowering of half-precision FP arguments and returns from Clang's CodeGen

2020-06-18 Thread Lucas Prates via cfe-commits

Author: Lucas Prates
Date: 2020-06-18T13:17:07+01:00
New Revision: ada4c9dc4a63160b6b3cfd5965884c6cce2a405c

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

LOG: [ARM][Clang] Removing lowering of half-precision FP arguments and returns 
from Clang's CodeGen

Summary:
On the process of moving the argument lowering handling for
half-precision floating point arguments and returns to the backend, this
patch removes the code that was responsible for handling the coercion of
those arguments in Clang's Codegen.

Reviewers: rjmccall, chill, ostannard, dnsampaio

Reviewed By: ostannard

Subscribers: stuij, kristof.beyls, dmgreen, danielkiss, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/arm-fp16-arguments.c
clang/test/CodeGen/arm-mve-intrinsics/compare.c
clang/test/CodeGen/arm-mve-intrinsics/cplusplus.cpp
clang/test/CodeGen/arm-mve-intrinsics/dup.c
clang/test/CodeGen/arm-mve-intrinsics/get-set-lane.c
clang/test/CodeGen/arm-mve-intrinsics/ternary.c
clang/test/CodeGen/arm-mve-intrinsics/vaddq.c
clang/test/CodeGen/arm-mve-intrinsics/vminvq.c
clang/test/CodeGen/arm-mve-intrinsics/vmulq.c
clang/test/CodeGen/arm-mve-intrinsics/vsubq.c

Removed: 
clang/test/CodeGen/cmse-clear-fp16.c



diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 78a0ecef4f3f..87242442a57f 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3124,20 +3124,6 @@ llvm::Value 
*CodeGenFunction::EmitCMSEClearRecord(llvm::Value *Src,
   return R;
 }
 
-// Emit code to clear the padding bits when returning or passing as an argument
-// a 16-bit floating-point value.
-llvm::Value *CodeGenFunction::EmitCMSEClearFP16(llvm::Value *Src) {
-  llvm::Type *RetTy = Src->getType();
-  assert(RetTy->isFloatTy() ||
- (RetTy->isIntegerTy() && RetTy->getIntegerBitWidth() == 32));
-  if (RetTy->isFloatTy()) {
-llvm::Value *T0 = Builder.CreateBitCast(Src, Builder.getIntNTy(32));
-llvm::Value *T1 = Builder.CreateAnd(T0, 0x, "cmse.clear");
-return Builder.CreateBitCast(T1, RetTy);
-  }
-  return Builder.CreateAnd(Src, 0x, "cmse.clear");
-}
-
 void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,
  bool EmitRetDbgLoc,
  SourceLocation EndLoc) {
@@ -3307,17 +3293,10 @@ void CodeGenFunction::EmitFunctionEpilog(const 
CGFunctionInfo &FI,
 if (CurFuncDecl && CurFuncDecl->hasAttr()) {
   // For certain return types, clear padding bits, as they may reveal
   // sensitive information.
-  const Type *RTy = RetTy.getCanonicalType().getTypePtr();
-  if (RTy->isFloat16Type() || RTy->isHalfType()) {
-// 16-bit floating-point types are passed in a 32-bit integer or float,
-// with unspecified upper bits.
-RV = EmitCMSEClearFP16(RV);
-  } else {
-// Small struct/union types are passed as integers.
-auto *ITy = dyn_cast(RV->getType());
-if (ITy != nullptr && isa(RetTy.getCanonicalType()))
-  RV = EmitCMSEClearRecord(RV, ITy, RetTy);
-  }
+  // Small struct/union types are passed as integers.
+  auto *ITy = dyn_cast(RV->getType());
+  if (ITy != nullptr && isa(RetTy.getCanonicalType()))
+RV = EmitCMSEClearRecord(RV, ITy, RetTy);
 }
 EmitReturnValueCheck(RV);
 Ret = Builder.CreateRet(RV);
@@ -4620,17 +4599,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo 
&CallInfo,
 if (CallInfo.isCmseNSCall()) {
   // For certain parameter types, clear padding bits, as they may 
reveal
   // sensitive information.
-  const Type *PTy = I->Ty.getCanonicalType().getTypePtr();
-  // 16-bit floating-point types are passed in a 32-bit integer or
-  // float, with unspecified upper bits.
-  if (PTy->isFloat16Type() || PTy->isHalfType()) {
-Load = EmitCMSEClearFP16(Load);
-  } else {
-// Small struct/union types are passed as integer arrays.
-auto *ATy = dyn_cast(Load->getType());
-if (ATy != nullptr && isa(I->Ty.getCanonicalType()))
-  Load = EmitCMSEClearRecord(Load, ATy, I->Ty);
-  }
+  // Small struct/union types are passed as integer arrays.
+  auto *ATy = dyn_cast(Load->getType());
+  if (ATy != nullptr && isa(I->Ty.getCanonicalType()))
+Load = EmitCMSEClearRecord(Load, ATy, I->Ty);
 }
 IRCallArgs[FirstIRArg] = Load;
   }

diff  --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/c

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-18 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

Balázs, could you please add the checker option within this patch? If we find 
that the option works well (removes a lot of useless reports) I'd be happy to 
help implement that uniqueing pass.

  CmdLineOption,




Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:406
 
+const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N,
+  SymbolRef StreamSym,

NoQ wrote:
> balazske wrote:
> > balazske wrote:
> > > NoQ wrote:
> > > > NoQ wrote:
> > > > > Ok, so this is a tiny auxiliary visitor.
> > > > > 
> > > > > I wish we could set uniqueing location post-factum from within the 
> > > > > note tag. Unfortunately we can't because notes are generated after 
> > > > > uniqueing :(
> > > > > 
> > > > > I'd like you to experiment with tracking this information as part of 
> > > > > the state instead so that you didn't need to perform an additional 
> > > > > scan. I'd be happy if it helps you avoid performing this additional 
> > > > > pass.
> > > > > 
> > > > > I.e., when you're opening the file, add all the information you need 
> > > > > for building your uniqueing location into the stream state (not the 
> > > > > node though, just the program point or something like that). Then 
> > > > > retrieve it in O(1) when you're emitting the report.
> > > > Another thing we could try is to implement such post-processing pass 
> > > > globally for all checkers. I.e., instead of an optional uniqueing 
> > > > location accept an optional lambda that looks at a node and answers 
> > > > whether this node should be used as a uniqueing location. Then before 
> > > > report deduplication scan each report that supplies such lambda and 
> > > > update its uniqueing location. That'll probably require some work on 
> > > > BugReporter but that sounds like a nice way to avoid all the 
> > > > boilerplate.
> > > Storing the "acquisition site" in the state is the natural way of doing 
> > > this. Probably I should not think that existing checkers do things the 
> > > best way, this function is taken from  `FuchsiaHandleChecker` (or here it 
> > > has a specific reason?). And not storing the data in the state is a bit 
> > > less memory consumption if this matters.
> > We should check how many checkers can benefit from such a "uniqueing 
> > location callback". Normally the checker should know what the uniqueing 
> > location is, at least when the bug report is created. The location is 
> > naturally obtained from the state that the checker maintains, at least if 
> > we want to avoid scans like `getAcquisitionSite`.
> > Probably I should not think that existing checkers do things the best way
> 
> Well, if you ever find yourself copy-pasting a large chunk of code from a 
> different checker and using it almost unchanged, it's a good indication that 
> the checker API needs to be improved. You can't do things "the best way" in a 
> single checker in isolation, it's a collective effort. You're a programmer, 
> you can change everything, no need to be confined in your checker.
> 
> > We should check how many checkers can benefit from such a "uniqueing 
> > location callback". Normally the checker should know what the uniqueing 
> > location is, at least when the bug report is created.
> 
> No, i don't think it ever happens automagically. It's either tracked in the 
> state specifically for that purpose or scanned backwards. So i'd rather 
> believe that every checker that has non-default uniqueing locations will 
> benefit from such facility.
> Another thing we could try is to implement such post-processing pass globally 
> for all checkers. I.e., instead of an optional uniqueing location accept an 
> optional lambda that looks at a node and answers whether this node should be 
> used as a uniqueing location. Then before report deduplication scan each 
> report that supplies such lambda and update its uniqueing location. That'll 
> probably require some work on BugReporter but that sounds like a nice way to 
> avoid all the boilerplate.

I've lately found the uniqueing location quite wonky, because its hardly ever 
the location we want to unique by, but it is the only way to pull it off with 
the existing infrastructure. More often then not the uniqueing point is a 
variable, a stream object, or something that isn't a location, but can sort of 
be tied to a location. So, lets go with this suggestion!

@balazske As long as this is an off-by-default hidden checker option, I think 
we can commit this code for experimentation purposes. I believe it is correct 
for 99% of the cases. But I agree, we need to tie its enabling to a more robust 
solution.

Lets add some comments:
// HACK: This is essentially a tiny bugreporter visitor, but before the 
trimming of the exploded graph (so it may contain directed cycles still). We 
use it to acquire a uniqueing location, but it would be better if we could 
u

[PATCH] D74166: [AIX][Frontend] Static init implementation for AIX considering no priority

2020-06-18 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 271664.
Xiangling_L marked an inline comment as done.
Xiangling_L added a comment.

Adjust the patch corresponding to D81972 ;


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

https://reviews.llvm.org/D74166

Files:
  clang/include/clang/AST/Mangle.h
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/CodeGen/CGCXXABI.h
  clang/lib/CodeGen/CGDeclCXX.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/aix-constructor-attribute.cpp
  clang/test/CodeGen/aix-destructor-attribute.cpp
  clang/test/CodeGen/aix-init-priority-attribute.cpp
  clang/test/CodeGen/static-init.cpp
  clang/test/CodeGenCXX/aix-static-init.cpp

Index: clang/test/CodeGenCXX/aix-static-init.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/aix-static-init.cpp
@@ -0,0 +1,193 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -S -emit-llvm -x c++ \
+// RUN: -fno-use-cxa-atexit -std=c++2a < %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
+
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -S -emit-llvm -x c++ \
+// RUN: -fno-use-cxa-atexit -std=c++2a < %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
+
+namespace test1 {
+  struct Test1 {
+Test1();
+~Test1();
+  } t1, t2;
+} // namespace test1
+
+namespace test2 {
+  int foo() { return 3; }
+  int x = foo();
+} // namespace test2
+
+namespace test3 {
+  struct Test3 {
+constexpr Test3() {};
+~Test3() {};
+  };
+
+  constinit Test3 t;
+} // namespace test3
+
+namespace test4 {
+  struct Test4 {
+Test4();
+~Test4();
+  };
+
+  void f() {
+static Test4 staticLocal;
+  }
+} // namespace test4
+
+// CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__sinit8000_clang_1145401da454a7baad10bfe313c46638, i8* null }]
+// CHECK: @llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__sterm8000_clang_1145401da454a7baad10bfe313c46638, i8* null }]
+
+// CHECK: define internal void @__cxx_global_var_init() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1C1Ev(%"struct.test1::Test1"* @_ZN5test12t1E)
+// CHECK:   %0 = call i32 @atexit(void ()* @__dtor__ZN5test12t1E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__dtor__ZN5test12t1E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1D1Ev(%"struct.test1::Test1"* @_ZN5test12t1E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: declare i32 @atexit(void ()*)
+
+// CHECK: define internal void @__finalize__ZN5test12t1E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   %0 = call i32 @unatexit(void ()* @__dtor__ZN5test12t1E)
+// CHECK:   %needs_destruct = icmp eq i32 %0, 0
+// CHECK:   br i1 %needs_destruct, label %destruct.call, label %destruct.end
+
+// CHECK: destruct.call:
+// CHECK:   call void @__dtor__ZN5test12t1E()
+// CHECK:   br label %destruct.end
+
+// CHECK: destruct.end:
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: declare i32 @unatexit(void ()*)
+
+// CHECK: define internal void @__cxx_global_var_init.1() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1C1Ev(%"struct.test1::Test1"* @_ZN5test12t2E)
+// CHECK:   %0 = call i32 @atexit(void ()* @__dtor__ZN5test12t2E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__dtor__ZN5test12t2E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1D1Ev(%"struct.test1::Test1"* @_ZN5test12t2E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__finalize__ZN5test12t2E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   %0 = call i32 @unatexit(void ()* @__dtor__ZN5test12t2E)
+// CHECK:   %needs_destruct = icmp eq i32 %0, 0
+// CHECK:   br i1 %needs_destruct, label %destruct.call, label %destruct.end
+
+// CHECK: destruct.call:
+// CHECK:   call void @__dtor__ZN5test12t2E()
+// CHECK:   br label %destruct.end
+
+// CHECK: destruct.end:
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__cxx_global_var_init.2() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK32: %call = call i32 @_ZN5test23fooEv()
+// CHECK64: %call = call signext i32 @_ZN5test23fooEv()
+// CHECK:   store i32 %call, i32* @_ZN5test21xE
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__cxx_global_var_init.3() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   %0 = call i32 @atexit(void ()* @__dtor__ZN5test31tE)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__dtor__ZN5test31tE() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test

[PATCH] D78903: [Driver] Add option -fproc-stat-report

2020-06-18 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff updated this revision to Diff 271665.
sepavloff added a comment.

Updated patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78903

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Driver/Job.h
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/Job.cpp
  clang/test/Driver/report-stat.c

Index: clang/test/Driver/report-stat.c
===
--- /dev/null
+++ clang/test/Driver/report-stat.c
@@ -0,0 +1,6 @@
+// RUN: %clang -c -fproc-stat-report %s | FileCheck %s
+// CHECK: clang{{.*}}: output={{.*}}.o, total={{[0-9.]+}} ms, user={{[0-9.]+}} ms, mem={{[0-9]+}} Kb
+
+// RUN: %clang -c -fproc-stat-report=%t %s
+// RUN: cat %t | FileCheck --check-prefix=CSV %s
+// CSV: clang{{.*}},"{{.*}}.o",{{[0-9]+}},{{[0-9]+}},{{[0-9]+}}
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -370,8 +370,8 @@
 
   auto Args = llvm::toStringRefArray(Argv.data());
   return llvm::sys::ExecuteAndWait(Executable, Args, Env, Redirects,
-   /*secondsToWait*/ 0,
-   /*memoryLimit*/ 0, ErrMsg, ExecutionFailed);
+  /*secondsToWait*/ 0, /*memoryLimit*/ 0, ErrMsg, ExecutionFailed,
+  &ProcStat);
 }
 
 CC1Command::CC1Command(const Action &Source, const Tool &Creator,
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3761,11 +3761,69 @@
/*TargetDeviceOffloadKind*/ Action::OFK_None);
   }
 
-  // If we have more than one job, then disable integrated-cc1 for now.
-  if (C.getJobs().size() > 1)
+  StringRef StatReportFile;
+  bool PrintProcessStat = false;
+  if (const Arg *A = C.getArgs().getLastArg(options::OPT_fproc_stat_report_EQ))
+StatReportFile = A->getValue();
+  if (C.getArgs().hasArg(options::OPT_fproc_stat_report))
+PrintProcessStat = true;
+
+  // If we have more than one job, then disable integrated-cc1 for now. Do this
+  // also when we need to report process execution statistics.
+  if (C.getJobs().size() > 1 || !StatReportFile.empty() || PrintProcessStat)
 for (auto &J : C.getJobs())
   J.InProcess = false;
 
+  if (!StatReportFile.empty() || PrintProcessStat) {
+C.setPostCallback([=](const Command &Cmd, int Res) {
+  Optional ProcStat
+  = Cmd.getProcessStatistics();
+  if (!ProcStat)
+return;
+  if (PrintProcessStat) {
+using namespace llvm;
+// Human readable output.
+outs() << sys::path::filename(Cmd.getExecutable()) << ": "
+<< "output=";
+if (Cmd.getOutputFilenames().empty())
+  outs() << "\"\"";
+else
+  outs() << Cmd.getOutputFilenames().front();
+outs() << ", total="
+<< format("%.3f", ProcStat->TotalTime.count() / 1000.) << " ms"
+<< ", user="
+<< format("%.3f", ProcStat->UserTime.count() / 1000.) << " ms"
+<< ", mem=" << ProcStat->PeakMemory << " Kb\n";
+  }
+  if (!StatReportFile.empty()) {
+// CSV format.
+std::string Buffer;
+llvm::raw_string_ostream Out(Buffer);
+Out << llvm::sys::path::filename(Cmd.getExecutable()) << ',';
+if (Cmd.getOutputFilenames().empty())
+  Out << "\"\"";
+else
+  Command::printArg(Out, Cmd.getOutputFilenames().front(), true);
+Out << ','
+<< ProcStat->TotalTime.count() << ','
+<< ProcStat->UserTime.count() << ','
+<< ProcStat->PeakMemory << '\n';
+Out.flush();
+std::error_code EC;
+llvm::raw_fd_ostream OS(StatReportFile, EC, llvm::sys::fs::OF_Append);
+if (EC)
+  return;
+auto L = OS.tryToLock();
+if (!L) {
+  llvm::errs() << "ERROR: Cannot lock file " << StatReportFile << ": "
+   << toString(L.takeError()) << "\n";
+  return;
+}
+OS << Buffer;
+  }
+});
+  }
+
   // If the user passed -Qunused-arguments or there were errors, don't warn
   // about any unused arguments.
   if (Diags.hasErrorOccurred() ||
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1848,6 +1848,10 @@
 def ftime_trace_granularity_EQ : Joined<["-"], "ftime-trace-granularity=">, Group,
   HelpText<"Minimum time granularity (in microseconds) traced by time profiler">,
   Flags<[CC1Option, CoreOption]>;
+def fproc_stat_report : Joined<["-"], "fproc-stat-report">, Group,
+  Flags<[DriverOption]>, HelpText<"Print subprocess statistics">;
+def fpr

[PATCH] D81304: [llvm][SveEmitter] Emit the bfloat version of `svld1ro`.

2020-06-18 Thread Ties Stuij via Phabricator via cfe-commits
stuij added inline comments.



Comment at: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1ro-bfloat.c:1
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE -triple 
aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 
-fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
-D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE 
-DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve 
-target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s

sdesmalen wrote:
> fpetrogalli wrote:
> > sdesmalen wrote:
> > > stuij wrote:
> > > > There should be no dependency on `-fallow-half-arguments-and-returns`. 
> > > > For bfloat we should use `-mfloat-abi hard`. Does this work for 
> > > > `-mfloat-abi softfp`?
> > > `-fallow-half-arguments-and-returns` isn't strictly needed for this test, 
> > > we just use the same RUN line for all the ACLE tests and we needed this 
> > > for `__fp16` in some of the tests.
> > > 
> > > I don't believe that `-mfloat-abi softfp` is supported for AArch64.
> > @stuij - the following lines work, one with `softfp` and one with `hard`:
> > 
> > ```
> > // RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
> > -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE 
> > -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve 
> > -target\
> > -feature +bf16 -mfloat-abi softfp -fallow-half-arguments-and-returns -S -O1 
> > -Werror -Wall -emit-llvm -o - %s | FileCheck %s
> > // RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 
> > -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE 
> > -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve 
> > -target\
> > -feature +bf16 -mfloat-abi hard -fallow-half-arguments-and-returns -S -O1 
> > -Werror -Wall -emit-llvm -o - %s | FileCheck %s
> > ```
> > 
> > @sdesmalen I am not an experer here, but there is a test which targets 
> > aarch64 that uses `softfp` (see 
> > `clang/test/CodeGen/arm-bf16-params-returns.c`). The following line in that 
> > test clearly targets `aarch64`:
> > 
> > ```
> > // RUN: %clang_cc1 -triple aarch64-arm-none-eabi -target-abi aapcs 
> > -mfloat-abi softfp -target-feature +bf16 -target-feature +neon -emit-llvm 
> > -O2 -o - %s | opt -S -mem2reg -sroa | FileCheck %s \
> > --check-prefix=CHECK64-SOFTFP
> > ```
> > 
> > @both - should I update the test with the two extra RUN lines mentioned up 
> > in the message?
> > @sdesmalen I am not an experer here, but there is a test which targets 
> > aarch64 that uses softfp (see 
> > clang/test/CodeGen/arm-bf16-params-returns.c). The following line in that 
> > test clearly targets aarch64:
> `clang/test/CodeGen/arm-bf16-params-returns.c` also shows that setting 
> `softfp` has no effect for AArch64.
> 
> > @both - should I update the test with the two extra RUN lines mentioned up 
> > in the message?
> No, I think the extra RUN lines aren't necessary.
@fpetrogalli: @sdesmalen is totally right. Softfp doesn't make sense on AArch64 
as fp isn't optional. I think the original intent of that AArch64 line in 
`arm-bf16-params-returns.c` was to make sure AArch64 indeed doesn't change, but 
then the option should of course never be passed in the first place. I guess 
this is a bit of over-defensive coding against the way clang isn't stellar at 
argument passing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81304



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


[PATCH] D81676: [MSP430] Align the toolchain definition with the TI's msp430-gcc v8.3.1

2020-06-18 Thread Anatoly Trosinenko via Phabricator via cfe-commits
atrosinenko updated this revision to Diff 271670.
atrosinenko added a comment.

Fix test once again (replace more literal slashes with regex).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81676

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/MSP430.cpp
  clang/lib/Driver/ToolChains/MSP430.h
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/430/exceptions/crtend_no_eh.o
  clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtbegin_no_eh.o
  clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/exceptions/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/exceptions/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/crtend_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtbegin.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtbegin_no_eh.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtend.o
  
clang/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/8.3.1/large/full-memory-range/exceptions/crtend_no_eh.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crtn.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/exceptions/crt0.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/crt0.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/exceptions/crt0.o
  clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/crt0.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/exceptions/crt0.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/full-memory-range/crt0.o
  
clang/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/large/full-memory-range/exceptions/crt0.o
  clang/test/Driver/msp430-toolchain.c

Index: clang/test/Driver/msp430-toolchain.c
===
--- clang/test/Driver/msp430-toolchain.c
+++ clang/test/Driver/msp430-toolchain.c
@@ -1,78 +1,231 @@
-// A basic clang -cc1 command-line, and simple environment check.
+// Tests for the toolchain description for msp430-gcc
+// Splitting some tests into POS and NEG parts so the latter can validate
+// output fragments as large as possible for absence of some text.
 
+
+// Tests for passing flags to msp43

[PATCH] D74166: [AIX][Frontend] Static init implementation for AIX considering no priority

2020-06-18 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 271668.
Xiangling_L added a comment.

Fix the previous bad version;


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

https://reviews.llvm.org/D74166

Files:
  clang/include/clang/AST/Mangle.h
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/CodeGen/CGCXXABI.h
  clang/lib/CodeGen/CGDeclCXX.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/aix-constructor-attribute.cpp
  clang/test/CodeGen/aix-destructor-attribute.cpp
  clang/test/CodeGen/aix-init-priority-attribute.cpp
  clang/test/CodeGen/static-init.cpp
  clang/test/CodeGenCXX/aix-static-init.cpp

Index: clang/test/CodeGenCXX/aix-static-init.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/aix-static-init.cpp
@@ -0,0 +1,193 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -S -emit-llvm -x c++ \
+// RUN: -fno-use-cxa-atexit -std=c++2a < %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
+
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -S -emit-llvm -x c++ \
+// RUN: -fno-use-cxa-atexit -std=c++2a < %s | \
+// RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
+
+namespace test1 {
+  struct Test1 {
+Test1();
+~Test1();
+  } t1, t2;
+} // namespace test1
+
+namespace test2 {
+  int foo() { return 3; }
+  int x = foo();
+} // namespace test2
+
+namespace test3 {
+  struct Test3 {
+constexpr Test3() {};
+~Test3() {};
+  };
+
+  constinit Test3 t;
+} // namespace test3
+
+namespace test4 {
+  struct Test4 {
+Test4();
+~Test4();
+  };
+
+  void f() {
+static Test4 staticLocal;
+  }
+} // namespace test4
+
+// CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__sinit8000_clang_1145401da454a7baad10bfe313c46638, i8* null }]
+// CHECK: @llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__sterm8000_clang_1145401da454a7baad10bfe313c46638, i8* null }]
+
+// CHECK: define internal void @__cxx_global_var_init() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1C1Ev(%"struct.test1::Test1"* @_ZN5test12t1E)
+// CHECK:   %0 = call i32 @atexit(void ()* @__dtor__ZN5test12t1E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__dtor__ZN5test12t1E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1D1Ev(%"struct.test1::Test1"* @_ZN5test12t1E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: declare i32 @atexit(void ()*)
+
+// CHECK: define internal void @__finalize__ZN5test12t1E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   %0 = call i32 @unatexit(void ()* @__dtor__ZN5test12t1E)
+// CHECK:   %needs_destruct = icmp eq i32 %0, 0
+// CHECK:   br i1 %needs_destruct, label %destruct.call, label %destruct.end
+
+// CHECK: destruct.call:
+// CHECK:   call void @__dtor__ZN5test12t1E()
+// CHECK:   br label %destruct.end
+
+// CHECK: destruct.end:
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: declare i32 @unatexit(void ()*)
+
+// CHECK: define internal void @__cxx_global_var_init.1() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1C1Ev(%"struct.test1::Test1"* @_ZN5test12t2E)
+// CHECK:   %0 = call i32 @atexit(void ()* @__dtor__ZN5test12t2E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__dtor__ZN5test12t2E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test15Test1D1Ev(%"struct.test1::Test1"* @_ZN5test12t2E)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__finalize__ZN5test12t2E() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   %0 = call i32 @unatexit(void ()* @__dtor__ZN5test12t2E)
+// CHECK:   %needs_destruct = icmp eq i32 %0, 0
+// CHECK:   br i1 %needs_destruct, label %destruct.call, label %destruct.end
+
+// CHECK: destruct.call:
+// CHECK:   call void @__dtor__ZN5test12t2E()
+// CHECK:   br label %destruct.end
+
+// CHECK: destruct.end:
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__cxx_global_var_init.2() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK32: %call = call i32 @_ZN5test23fooEv()
+// CHECK64: %call = call signext i32 @_ZN5test23fooEv()
+// CHECK:   store i32 %call, i32* @_ZN5test21xE
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__cxx_global_var_init.3() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   %0 = call i32 @atexit(void ()* @__dtor__ZN5test31tE)
+// CHECK:   ret void
+// CHECK: }
+
+// CHECK: define internal void @__dtor__ZN5test31tE() [[ATTR:#[0-9]+]] {
+// CHECK: entry:
+// CHECK:   call void @_ZN5test35Test3D1Ev(%"struct.test3::Test3"* @_ZN5test31tE)
+// CHECK:   ret void
+// CHECK: }
+
+// 

[PATCH] D81408: [builtins] Improve compatibility with 16 bit targets

2020-06-18 Thread Anatoly Trosinenko via Phabricator via cfe-commits
atrosinenko updated this revision to Diff 271671.
atrosinenko added a comment.

Rebase onto working upstream commit to (hopefully) make tests pass for my patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81408

Files:
  compiler-rt/lib/builtins/floatdidf.c
  compiler-rt/lib/builtins/floatundidf.c
  compiler-rt/lib/builtins/fp_lib.h


Index: compiler-rt/lib/builtins/fp_lib.h
===
--- compiler-rt/lib/builtins/fp_lib.h
+++ compiler-rt/lib/builtins/fp_lib.h
@@ -46,7 +46,7 @@
 #define REP_C UINT32_C
 #define significandBits 23
 
-static __inline int rep_clz(rep_t a) { return __builtin_clz(a); }
+static __inline int rep_clz(rep_t a) { return clzsi(a); }
 
 // 32x32 --> 64 bit multiply
 static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
Index: compiler-rt/lib/builtins/floatundidf.c
===
--- compiler-rt/lib/builtins/floatundidf.c
+++ compiler-rt/lib/builtins/floatundidf.c
@@ -90,7 +90,7 @@
 // a is now rounded to DBL_MANT_DIG bits
   }
   double_bits fb;
-  fb.u.s.high = ((e + 1023) << 20) |  // exponent
+  fb.u.s.high = ((su_int)(e + 1023) << 20) |  // exponent
 ((su_int)(a >> 32) & 0x000F); // mantissa-high
   fb.u.s.low = (su_int)a; // mantissa-low
   return fb.f;
Index: compiler-rt/lib/builtins/floatdidf.c
===
--- compiler-rt/lib/builtins/floatdidf.c
+++ compiler-rt/lib/builtins/floatdidf.c
@@ -87,7 +87,7 @@
   }
   double_bits fb;
   fb.u.s.high = ((su_int)s & 0x8000) |// sign
-((e + 1023) << 20) |  // exponent
+((su_int)(e + 1023) << 20) |  // exponent
 ((su_int)(a >> 32) & 0x000F); // mantissa-high
   fb.u.s.low = (su_int)a; // mantissa-low
   return fb.f;


Index: compiler-rt/lib/builtins/fp_lib.h
===
--- compiler-rt/lib/builtins/fp_lib.h
+++ compiler-rt/lib/builtins/fp_lib.h
@@ -46,7 +46,7 @@
 #define REP_C UINT32_C
 #define significandBits 23
 
-static __inline int rep_clz(rep_t a) { return __builtin_clz(a); }
+static __inline int rep_clz(rep_t a) { return clzsi(a); }
 
 // 32x32 --> 64 bit multiply
 static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
Index: compiler-rt/lib/builtins/floatundidf.c
===
--- compiler-rt/lib/builtins/floatundidf.c
+++ compiler-rt/lib/builtins/floatundidf.c
@@ -90,7 +90,7 @@
 // a is now rounded to DBL_MANT_DIG bits
   }
   double_bits fb;
-  fb.u.s.high = ((e + 1023) << 20) |  // exponent
+  fb.u.s.high = ((su_int)(e + 1023) << 20) |  // exponent
 ((su_int)(a >> 32) & 0x000F); // mantissa-high
   fb.u.s.low = (su_int)a; // mantissa-low
   return fb.f;
Index: compiler-rt/lib/builtins/floatdidf.c
===
--- compiler-rt/lib/builtins/floatdidf.c
+++ compiler-rt/lib/builtins/floatdidf.c
@@ -87,7 +87,7 @@
   }
   double_bits fb;
   fb.u.s.high = ((su_int)s & 0x8000) |// sign
-((e + 1023) << 20) |  // exponent
+((su_int)(e + 1023) << 20) |  // exponent
 ((su_int)(a >> 32) & 0x000F); // mantissa-high
   fb.u.s.low = (su_int)a; // mantissa-low
   return fb.f;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80753: [clang-tidy] remove duplicate fixes of alias checkers

2020-06-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a few small nits, but please wait a bit for @njames93 in case 
they have final thoughts.




Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:758
+
+// Unique error, we keep it and move along
+if (Inserted.second) {

Add full stops to the end of your comments (here and elsewhere).



Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:777
+  "or make sure they are both configured the same. "
+  "Aliased checkers: '{0}', '{1}'",
+  ExistingError.DiagnosticName, Error.DiagnosticName)

Daniel599 wrote:
> njames93 wrote:
> > You don't really need the Aliased checkers note as that is wrapped in the 
> > initial diagnostic message. 
> > Also if there was a check that could spew out 3 different fix-its for the 
> > same diagnostic, this would result in the duplication note being made 
> > twice, maybe the notes should be cleared too?
> regarding your comment about 3 fix-it, as we walked before, there isn't a 
> case like that (I didn't find any) as I wanted to make a test out of it.
> I added the last line as it would show who are the two that conflict 
> (supporting the future case of more than 2 aliased checkers),
> I can remove it if it doesn't help, let me know.
> 
> > maybe the notes should be cleared too?
> I am open for suggestions about how to re-write this message :)
> I also think it could be better
> 
I would reword it to be a run-on sentence: `cannot apply fix-it because an 
alias checker has suggested a different fix-it; please remove one of the 
checkers ('{0}', '{1}') or ensure they are both configured the same`

This also nicely removes the nit about terminating punctuation in a diagnostic.



Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h:250
   void removeIncompatibleErrors();
+  void removeDuplicatedFixesOfAliasCheckers();
 

Daniel599 wrote:
> maybe I need to rename this method since now it's removing the errors also, 
> I`ll do it when I get back from work.
I think this should still be renamed. How about 
`removeDuplicatedDiagnosticsOfAliasCheckers()`?


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

https://reviews.llvm.org/D80753



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


[PATCH] D81428: [ARM] Moving CMSE handling of half arguments and return to the backend

2020-06-18 Thread Lucas Prates via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92ad6d57c218: [ARM] Moving CMSE handling of half arguments 
and return to the backend (authored by pratlucas).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81428

Files:
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/test/CodeGen/ARM/cmse-clear-float-hard.ll

Index: llvm/test/CodeGen/ARM/cmse-clear-float-hard.ll
===
--- llvm/test/CodeGen/ARM/cmse-clear-float-hard.ll
+++ llvm/test/CodeGen/ARM/cmse-clear-float-hard.ll
@@ -4,13 +4,13 @@
 ; RUN: llc %s -o - -mtriple=thumbebv8m.main -mattr=+fp-armv8d16sp,+dsp -float-abi=hard | \
 ; RUN:   FileCheck %s --check-prefix=CHECK-8M --check-prefix=CHECK-8M-BE
 ; RUN: llc %s -o - -mtriple=thumbv8.1m.main -mattr=+fp-armv8d16sp,+dsp -float-abi=hard | \
-; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-81M-LE
+; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-NO-MVE --check-prefix=CHECK-81M-LE
 ; RUN: llc %s -o - -mtriple=thumbebv8.1m.main -mattr=+fp-armv8d16sp,+dsp -float-abi=hard | \
-; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-81M-BE
+; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-NO-MVE --check-prefix=CHECK-81M-BE
 ; RUN: llc %s -o - -mtriple=thumbv8.1m.main -mattr=+mve.fp -float-abi=hard | \
-; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-81M-LE
+; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-MVE --check-prefix=CHECK-81M-LE
 ; RUN: llc %s -o - -mtriple=thumbebv8.1m.main -mattr=+mve.fp -float-abi=hard | \
-; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-81M-BE
+; RUN:   FileCheck %s --check-prefix=CHECK-81M --check-prefix=CHECK-MVE --check-prefix=CHECK-81M-BE
 
 define float @f1(float (float)* nocapture %fptr) #0 {
 ; CHECK-8M-LABEL: f1:
@@ -809,3 +809,443 @@
   ret void
 }
 
+define half @h1(half (half)* nocapture %hptr) "cmse_nonsecure_entry" nounwind {
+; CHECK-8M-LABEL: h1:
+; CHECK-8M:   @ %bb.0:
+; CHECK-8M-NEXT:push {r7, lr}
+; CHECK-8M-NEXT:vldr s0, .LCPI11_0
+; CHECK-8M-NEXT:blx r0
+; CHECK-8M-NEXT:vmov r0, s0
+; CHECK-8M-NEXT:uxth r0, r0
+; CHECK-8M-NEXT:vmov s0, r0
+; CHECK-8M-NEXT:pop.w {r7, lr}
+; CHECK-8M-NEXT:mrs r12, control
+; CHECK-8M-NEXT:tst.w r12, #8
+; CHECK-8M-NEXT:beq .LBB11_2
+; CHECK-8M-NEXT:  @ %bb.1:
+; CHECK-8M-NEXT:vmrs r12, fpscr
+; CHECK-8M-NEXT:vmov s1, lr
+; CHECK-8M-NEXT:vmov d1, lr, lr
+; CHECK-8M-NEXT:vmov d2, lr, lr
+; CHECK-8M-NEXT:vmov d3, lr, lr
+; CHECK-8M-NEXT:vmov d4, lr, lr
+; CHECK-8M-NEXT:vmov d5, lr, lr
+; CHECK-8M-NEXT:vmov d6, lr, lr
+; CHECK-8M-NEXT:vmov d7, lr, lr
+; CHECK-8M-NEXT:bic r12, r12, #159
+; CHECK-8M-NEXT:bic r12, r12, #4026531840
+; CHECK-8M-NEXT:vmsr fpscr, r12
+; CHECK-8M-NEXT:  .LBB11_2:
+; CHECK-8M-NEXT:mov r0, lr
+; CHECK-8M-NEXT:mov r1, lr
+; CHECK-8M-NEXT:mov r2, lr
+; CHECK-8M-NEXT:mov r3, lr
+; CHECK-8M-NEXT:mov r12, lr
+; CHECK-8M-NEXT:msr apsr_nzcvqg, lr
+; CHECK-8M-NEXT:bxns lr
+; CHECK-8M-NEXT:.p2align 2
+; CHECK-8M-NEXT:  @ %bb.3:
+; CHECK-8M-NEXT:  .LCPI11_0:
+; CHECK-8M-NEXT:.long 0x4900 @ float 2.61874657E-41
+;
+; CHECK-NO-MVE-LABEL: h1:
+; CHECK-NO-MVE:   @ %bb.0:
+; CHECK-NO-MVE-NEXT:vstr fpcxtns, [sp, #-4]!
+; CHECK-NO-MVE-NEXT:push {r7, lr}
+; CHECK-NO-MVE-NEXT:sub sp, #4
+; CHECK-NO-MVE-NEXT:vldr s0, .LCPI11_0
+; CHECK-NO-MVE-NEXT:blx r0
+; CHECK-NO-MVE-NEXT:vmov r0, s0
+; CHECK-NO-MVE-NEXT:uxth r0, r0
+; CHECK-NO-MVE-NEXT:vmov s0, r0
+; CHECK-NO-MVE-NEXT:add sp, #4
+; CHECK-NO-MVE-NEXT:pop.w {r7, lr}
+; CHECK-NO-MVE-NEXT:vscclrm {s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, vpr}
+; CHECK-NO-MVE-NEXT:vldr fpcxtns, [sp], #4
+; CHECK-NO-MVE-NEXT:clrm {r0, r1, r2, r3, r12, apsr}
+; CHECK-NO-MVE-NEXT:bxns lr
+; CHECK-NO-MVE-NEXT:.p2align 2
+; CHECK-NO-MVE-NEXT:  @ %bb.1:
+; CHECK-NO-MVE-NEXT:  .LCPI11_0:
+; CHECK-NO-MVE-NEXT:.long 0x4900 @ float 2.61874657E-41
+;
+; CHECK-MVE-LABEL: h1:
+; CHECK-MVE:   @ %bb.0:
+; CHECK-MVE-NEXT:vstr fpcxtns, [sp, #-4]!
+; CHECK-MVE-NEXT:push {r7, lr}
+; CHECK-MVE-NEXT:sub sp, #4
+; CHECK-MVE-NEXT:vmov.f16 s0, #1.00e+01
+; CHECK-MVE-NEXT:vmov.f16 r1, s0
+; CHECK-MVE-NEXT:vmov s0, r1
+; CHECK-MVE-NEXT:blx r0
+; CHECK-MVE-NEXT:vmov.f16 r0, s0
+; CHECK-MVE-NEXT:vmov s0, r0
+; CHECK-MVE-NEXT:add sp, #4
+; CHECK-MVE-NEXT:pop.w {r7, lr}
+; CHECK-MVE-NEXT:vscclrm {s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, vpr}
+; CHECK-MVE-NEXT:vldr fpcxtns, [sp], #4
+; CHECK-MVE-NEXT:clrm {r0, r1, r2, r3, r12, apsr}
+; CHECK-MVE-NEXT:bxns lr
+  %call = call half %hptr(half 10.0) noun

[PATCH] D81451: [ARM][Clang] Removing lowering of half-precision FP arguments and returns from Clang's CodeGen

2020-06-18 Thread Lucas Prates via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGada4c9dc4a63: [ARM][Clang] Removing lowering of 
half-precision FP arguments and returns from… (authored by pratlucas).

Changed prior to commit:
  https://reviews.llvm.org/D81451?vs=269453&id=271677#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81451

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/arm-fp16-arguments.c
  clang/test/CodeGen/arm-mve-intrinsics/compare.c
  clang/test/CodeGen/arm-mve-intrinsics/cplusplus.cpp
  clang/test/CodeGen/arm-mve-intrinsics/dup.c
  clang/test/CodeGen/arm-mve-intrinsics/get-set-lane.c
  clang/test/CodeGen/arm-mve-intrinsics/ternary.c
  clang/test/CodeGen/arm-mve-intrinsics/vaddq.c
  clang/test/CodeGen/arm-mve-intrinsics/vminvq.c
  clang/test/CodeGen/arm-mve-intrinsics/vmulq.c
  clang/test/CodeGen/arm-mve-intrinsics/vsubq.c
  clang/test/CodeGen/cmse-clear-fp16.c

Index: clang/test/CodeGen/cmse-clear-fp16.c
===
--- clang/test/CodeGen/cmse-clear-fp16.c
+++ /dev/null
@@ -1,59 +0,0 @@
-// RUN: %clang_cc1 -triple thumbv8m.main -O0 -mcmse  -S -emit-llvm \
-// RUN:-fallow-half-arguments-and-returns %s -o - | \
-// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-NOPT-SOFT
-// RUN: %clang_cc1 -triple thumbv8m.main -O2 -mcmse  -S -emit-llvm \
-// RUN:-fallow-half-arguments-and-returns %s -o - | \
-// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-OPT-SOFT
-// RUN: %clang_cc1 -triple thumbv8m.main -O0 -mcmse  -S -emit-llvm \
-// RUN:-fallow-half-arguments-and-returns -mfloat-abi hard %s -o - | \
-// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-NOPT-HARD
-// RUN: %clang_cc1 -triple thumbv8m.main -O2 -mcmse  -S -emit-llvm \
-// RUN:-fallow-half-arguments-and-returns -mfloat-abi hard %s -o - | \
-// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-OPT-HARD
-
-__fp16 g0();
-__attribute__((cmse_nonsecure_entry)) __fp16 f0() {
-  return g0();
-}
-// CHECK:   define {{.*}}@f0()
-
-// CHECK-NOPT-SOFT: %[[V0:.*]] = load i32
-// CHECK-NOPT-SOFT: %[[V1:.*]] = and i32 %[[V0]], 65535
-// CHECK-NOPT-SOFT: ret i32 %[[V1]]
-
-// CHECK-OPT-SOFT: %[[V0:.*]] = tail call {{.*}} @g0
-// CHECK-OPT-SOFT: %[[V1:.*]] = and i32 %[[V0]], 65535
-// CHECK-OPT-SOFT: ret i32 %[[V1]]
-
-// CHECK-NOPT-HARD: %[[V0:.*]] = bitcast float {{.*}} to i32
-// CHECK-NOPT-HARD: %[[V1:.*]] = and i32 %[[V0]], 65535
-// CHECK-NOPT-HARD: %[[V2:.*]] = bitcast i32 %[[V1]] to float
-// CHECK-NOPT-HARD: ret float %[[V2]]
-
-// CHECK-OPT-HARD: %[[V0:.*]] = bitcast float {{.*}} to i32
-// CHECK-OPT-HARD: %[[V1:.*]] = and i32 %[[V0]], 65535
-// CHECK-OPT-HARD: %[[V2:.*]] = bitcast i32 %[[V1]] to float
-// CHECK-OPT-HARD: ret float %[[V2]]
-
-void __attribute__((cmse_nonsecure_call)) (*g1)(__fp16);
-__fp16 x;
-void f1() {
-  g1(x);
-}
-// CHECK: define {{.*}}@f1()
-
-// CHECK-NOPT-SOFT: %[[V0:.*]] = load i32
-// CHECK-NOPT-SOFT: %[[V1:.*]] = and i32 %[[V0]], 65535
-// CHECK-NOPT-SOFT: call {{.*}} void {{.*}}(i32 %[[V1]])
-
-// CHECK-OPT-SOFT: %[[V1:.*]] = zext i16 {{.*}} to i32
-// CHECK-OPT-SOFT: call {{.*}} void {{.*}}(i32 %[[V1]])
-
-// CHECK-NOPT-HARD: %[[V0:.*]] = bitcast float {{.*}} to i32
-// CHECK-NOPT-HARD: %[[V1:.*]] = and i32 %[[V0]], 65535
-// CHECK-NOPT-HARD: %[[V2:.*]] = bitcast i32 %[[V1]] to float
-// CHECK-NOPT-HARD: call {{.*}}(float %[[V2]])
-
-// CHECK-OPT-HARD: %[[V0:.*]] = zext i16 {{.*}} to i32
-// CHECK-OPT-HARD: %[[V1:.*]] = bitcast i32 %[[V0]] to float
-// CHECK-OPT-HARD: call {{.*}}(float %[[V1]])
Index: clang/test/CodeGen/arm-mve-intrinsics/vsubq.c
===
--- clang/test/CodeGen/arm-mve-intrinsics/vsubq.c
+++ clang/test/CodeGen/arm-mve-intrinsics/vsubq.c
@@ -114,13 +114,10 @@
 
 // CHECK-LABEL: @test_vsubq_n_f16(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:[[TMP0:%.*]] = bitcast float [[B_COERCE:%.*]] to i32
-// CHECK-NEXT:[[TMP_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[TMP0]] to i16
-// CHECK-NEXT:[[TMP1:%.*]] = bitcast i16 [[TMP_0_EXTRACT_TRUNC]] to half
-// CHECK-NEXT:[[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[TMP1]], i32 0
+// CHECK-NEXT:[[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[B:%.*]], i32 0
 // CHECK-NEXT:[[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer
-// CHECK-NEXT:[[TMP2:%.*]] = fsub <8 x half> [[A:%.*]], [[DOTSPLAT]]
-// CHECK-NEXT:ret <8 x half> [[TMP2]]
+// CHECK-NEXT:[[TMP0:%.*]] = fsub <8 x half> [[A:%.*]], [[DOTSPLAT]]
+// CHECK-NEXT:ret <8 x half> [[TMP0]]
 //
 float16x8_t test_vsubq_n_f16(float16x8_t a, float16_t b)
 {
@@ -187,15 +184,12 @@
 
 // CHECK-LABEL: @test_vsubq_x_n_f16(
 // CHECK-NEXT:  entry:
-// CHE

[PATCH] D75169: [ARM] Supporting lowering of half-precision FP arguments and returns in AArch32's backend

2020-06-18 Thread Lucas Prates via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa255931c4055: [ARM] Supporting lowering of half-precision FP 
arguments and returns in… (authored by pratlucas).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75169

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/Target/ARM/ARMCallLowering.cpp
  llvm/lib/Target/ARM/ARMCallingConv.cpp
  llvm/lib/Target/ARM/ARMCallingConv.td
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.h
  llvm/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll
  llvm/test/CodeGen/ARM/fp16-args.ll
  llvm/test/CodeGen/ARM/fp16-bitcast.ll
  llvm/test/CodeGen/ARM/fp16-promote.ll
  llvm/test/CodeGen/ARM/fp16-vminmaxnm-safe.ll
  llvm/test/CodeGen/ARM/vecreduce-fadd-legalization-strict.ll
  llvm/test/CodeGen/ARM/vecreduce-fmul-legalization-strict.ll
  llvm/test/CodeGen/Thumb2/mve-shuffle.ll
  llvm/test/CodeGen/Thumb2/mve-vdup.ll
  llvm/test/CodeGen/Thumb2/mve-vecreduce-fminmax.ll

Index: llvm/test/CodeGen/Thumb2/mve-vecreduce-fminmax.ll
===
--- llvm/test/CodeGen/Thumb2/mve-vecreduce-fminmax.ll
+++ llvm/test/CodeGen/Thumb2/mve-vecreduce-fminmax.ll
@@ -78,7 +78,6 @@
 ; CHECK-NEXT:vminnm.f16 s0, s0, s2
 ; CHECK-NEXT:vminnm.f16 s0, s0, s2
 ; CHECK-NEXT:vminnm.f16 s0, s0, s2
-; CHECK-NEXT:vstr.16 s0, [r0]
 ; CHECK-NEXT:bx lr
 ; CHECK-NEXT:.p2align 1
 ; CHECK-NEXT:  @ %bb.1:
@@ -103,7 +102,6 @@
 ; CHECK-NEXT:vminnm.f16 s4, s4, s6
 ; CHECK-NEXT:vminnm.f16 s4, s4, s3
 ; CHECK-NEXT:vminnm.f16 s0, s4, s0
-; CHECK-NEXT:vstr.16 s0, [r0]
 ; CHECK-NEXT:bx lr
 entry:
   %z = call fast half @llvm.experimental.vector.reduce.fmin.v8f16(<8 x half> %x)
@@ -125,7 +123,6 @@
 ; CHECK-FP-NEXT:vminnm.f16 s4, s4, s6
 ; CHECK-FP-NEXT:vminnm.f16 s4, s4, s3
 ; CHECK-FP-NEXT:vminnm.f16 s0, s4, s0
-; CHECK-FP-NEXT:vstr.16 s0, [r0]
 ; CHECK-FP-NEXT:bx lr
 ;
 ; CHECK-NOFP-LABEL: fmin_v16f16:
@@ -169,7 +166,6 @@
 ; CHECK-NOFP-NEXT:vminnm.f16 s8, s8, s10
 ; CHECK-NOFP-NEXT:vselgt.f16 s0, s0, s4
 ; CHECK-NOFP-NEXT:vminnm.f16 s0, s8, s0
-; CHECK-NOFP-NEXT:vstr.16 s0, [r0]
 ; CHECK-NOFP-NEXT:bx lr
 entry:
   %z = call fast half @llvm.experimental.vector.reduce.fmin.v16f16(<16 x half> %x)
@@ -309,20 +305,20 @@
 define arm_aapcs_vfpcc half @fmin_v4f16_nofast(<4 x half> %x) {
 ; CHECK-FP-LABEL: fmin_v4f16_nofast:
 ; CHECK-FP:   @ %bb.0: @ %entry
-; CHECK-FP-NEXT:vmov r1, s1
-; CHECK-FP-NEXT:vdup.32 q1, r1
+; CHECK-FP-NEXT:vmov r0, s1
+; CHECK-FP-NEXT:vdup.32 q1, r0
 ; CHECK-FP-NEXT:vminnm.f16 q0, q0, q1
-; CHECK-FP-NEXT:vmov.u16 r1, q0[1]
-; CHECK-FP-NEXT:vdup.16 q1, r1
+; CHECK-FP-NEXT:vmov.u16 r0, q0[1]
+; CHECK-FP-NEXT:vdup.16 q1, r0
 ; CHECK-FP-NEXT:vminnm.f16 q0, q0, q1
-; CHECK-FP-NEXT:vstr.16 s0, [r0]
+; CHECK-FP-NEXT:@ kill: def $s0 killed $s0 killed $q0
 ; CHECK-FP-NEXT:bx lr
 ;
 ; CHECK-NOFP-LABEL: fmin_v4f16_nofast:
 ; CHECK-NOFP:   @ %bb.0: @ %entry
-; CHECK-NOFP-NEXT:vmov r1, s1
+; CHECK-NOFP-NEXT:vmov r0, s1
 ; CHECK-NOFP-NEXT:vmovx.f16 s10, s0
-; CHECK-NOFP-NEXT:vdup.32 q1, r1
+; CHECK-NOFP-NEXT:vdup.32 q1, r0
 ; CHECK-NOFP-NEXT:vmovx.f16 s8, s4
 ; CHECK-NOFP-NEXT:vcmp.f16 s8, s10
 ; CHECK-NOFP-NEXT:vmrs APSR_nzcv, fpscr
@@ -333,7 +329,6 @@
 ; CHECK-NOFP-NEXT:vcmp.f16 s8, s0
 ; CHECK-NOFP-NEXT:vmrs APSR_nzcv, fpscr
 ; CHECK-NOFP-NEXT:vselgt.f16 s0, s0, s8
-; CHECK-NOFP-NEXT:vstr.16 s0, [r0]
 ; CHECK-NOFP-NEXT:bx lr
 entry:
   %z = call half @llvm.experimental.vector.reduce.fmin.v4f16(<4 x half> %x)
@@ -346,13 +341,13 @@
 ; CHECK-FP-NEXT:vmov.f64 d2, d1
 ; CHECK-FP-NEXT:vmov.f32 s5, s3
 ; CHECK-FP-NEXT:vminnm.f16 q0, q0, q1
-; CHECK-FP-NEXT:vmov r1, s1
-; CHECK-FP-NEXT:vdup.32 q1, r1
+; CHECK-FP-NEXT:vmov r0, s1
+; CHECK-FP-NEXT:vdup.32 q1, r0
 ; CHECK-FP-NEXT:vminnm.f16 q0, q0, q1
-; CHECK-FP-NEXT:vmov.u16 r1, q0[1]
-; CHECK-FP-NEXT:vdup.16 q1, r1
+; CHECK-FP-NEXT:vmov.u16 r0, q0[1]
+; CHECK-FP-NEXT:vdup.16 q1, r0
 ; CHECK-FP-NEXT:vminnm.f16 q0, q0, q1
-; CHECK-FP-NEXT:vstr.16 s0, [r0]
+; CHECK-FP-NEXT:@ kill: def $s0 killed $s0 killed $q0
 ; CHECK-FP-NEXT:bx lr
 ;
 ; CHECK-NOFP-LABEL: fmin_v8f16_nofast:
@@ -384,7 +379,6 @@
 ; CHECK-NOFP-NEXT:vcmp.f16 s8, s0
 ; CHECK-NOFP-NEXT:vmrs APSR_nzcv, fpscr
 ; CHECK-NOFP-NEXT:vselgt.f16 s0, s0, s8
-; CHECK-NOFP-NEXT:vstr.16 s0, [r0]
 ; CHECK-NOFP-NEXT:bx lr
 entry:
   %z = call half @llvm.experimental.vector.reduce.fmin.v8f16(<8 x half> %x)
@@ -398,13 +392,13 @@
 ; CHECK-FP-NEXT:vmov.f64 d2, d1
 ; CHECK-FP-NEXT:vmov.f32 s5, s3
 ; CHECK-FP-NEXT:vminnm.f16 q0, q

[clang] eb4c758 - [Matrix] Pass darwin tripe to SeamObjc test to fix windows bot failure.

2020-06-18 Thread Florian Hahn via cfe-commits

Author: Florian Hahn
Date: 2020-06-18T13:35:03+01:00
New Revision: eb4c758fe4b60ae3779d3e9401d00ee1450ae41b

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

LOG: [Matrix] Pass darwin tripe to SeamObjc test to fix windows bot failure.

Without the triple, the test fails on a windows bot
(http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/16531/steps/stage%201%20check/logs/stdio)

because of different full type widths (unsigned long long vs unsigned long)

Added: 


Modified: 
clang/test/SemaObjC/matrix-type-builtins.m

Removed: 




diff  --git a/clang/test/SemaObjC/matrix-type-builtins.m 
b/clang/test/SemaObjC/matrix-type-builtins.m
index 8187bffae525..dc18905963e4 100644
--- a/clang/test/SemaObjC/matrix-type-builtins.m
+++ b/clang/test/SemaObjC/matrix-type-builtins.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fenable-matrix %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify 
-fenable-matrix %s
 
 typedef double double4x4 __attribute__((matrix_type(4, 4)));
 typedef unsigned u4x4 __attribute__((matrix_type(4, 4)));



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


[clang] c7350a3 - [clang][utils] Modify make-ast-dump-check.sh to generate AST serialization dump tests

2020-06-18 Thread Bruno Ricci via cfe-commits

Author: Bruno Ricci
Date: 2020-06-18T13:37:29+01:00
New Revision: c7350a3bab14eb633f39a949f85ac0e690cd9b4d

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

LOG: [clang][utils] Modify make-ast-dump-check.sh to generate AST serialization 
dump tests

An AST serialization dump test is a test which compares the output of -ast-dump
on the source and of -ast-dump-all on a PCH generated from the source. Modulo
a few differences the outputs should match.

This patch to make-ast-dump-check.sh enables automatically generating
these tests.

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

Reviewed By: aaron.ballman, lebedev.ri

Added: 


Modified: 
clang/utils/make-ast-dump-check.sh

Removed: 




diff  --git a/clang/utils/make-ast-dump-check.sh 
b/clang/utils/make-ast-dump-check.sh
index 2a9cf40a884c..578c725f48b1 100755
--- a/clang/utils/make-ast-dump-check.sh
+++ b/clang/utils/make-ast-dump-check.sh
@@ -3,12 +3,21 @@
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
 #
-# Usage:
+# Usage (to generate normal AST dump tests):
 #
 # $ lit -DFileCheck=$PWD/utils/make-ast-dump-check.sh 
test/AST/ast-dump-openmp-*
+#
+# Usage (to generate serialization AST dump tests):
+#
+# $ lit -DFileCheck="generate_serialization_test=1 
$PWD/utils/make-ast-dump-check.sh"
+# test/AST/ast-dump-openmp-*
 
 prefix=CHECK
 
+if [ -z ${generate_serialization_test+x} ];
+  then generate_serialization_test=0;
+fi
+
 while [[ "$#" -ne 0 ]]; do
   case "$1" in
   --check-prefix)
@@ -54,6 +63,10 @@ BEGIN {
   s = \$0
   gsub("0x[0-9a-fA-F]+", "{{.*}}", s)
   gsub("$testdir/", "{{.*}}", s)
+  if ($generate_serialization_test == 1) {
+gsub(" imported", "{{( imported)?}}", s)
+gsub(" ", "{{( )?}}", s)
+  }
 }
 
 matched_last_line == 0 {



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


[clang] 05843dc - [clang] Fix the serialization of LambdaExpr and the bogus mutation in LambdaExpr::getBody

2020-06-18 Thread Bruno Ricci via cfe-commits

Author: Bruno Ricci
Date: 2020-06-18T13:37:24+01:00
New Revision: 05843dc6ab97a00cbde7aa4f08bf3692eb83109d

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

LOG: [clang] Fix the serialization of LambdaExpr and the bogus mutation in 
LambdaExpr::getBody

The body of LambdaExpr is currently not properly serialized. Instead
LambdaExpr::getBody checks if the body has been already deserialized and if
not mutates LambdaExpr. This can be observed with an AST dump test, where
the body of the LambdaExpr will be null.

The mutation in LambdaExpr::getBody was left because of another bug: it is not
true that the body of a LambdaExpr is always a CompoundStmt; it can also be
a CoroutineBodyStmt wrapping a CompoundStmt. This is fixed by returning a
Stmt * from getBody and introducing a convenience function getCompoundStmtBody
which always returns a CompoundStmt *. This function can be used by callers who
do not care about the coroutine node.

Happily all but one user of getBody treat it as a Stmt * and so this change
is non-intrusive.

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

Reviewed By: aaron.ballman

Added: 


Modified: 
clang/include/clang/AST/ExprCXX.h
clang/lib/AST/ExprCXX.cpp
clang/lib/AST/StmtPrinter.cpp
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/AST/ast-dump-lambda.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ExprCXX.h 
b/clang/include/clang/AST/ExprCXX.h
index 822025a7503f..4c65daaa63fc 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -26,6 +26,7 @@
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/OperationKinds.h"
 #include "clang/AST/Stmt.h"
+#include "clang/AST/StmtCXX.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/UnresolvedSet.h"
@@ -2004,8 +2005,25 @@ class LambdaExpr final : public Expr,
   /// Whether this is a generic lambda.
   bool isGenericLambda() const { return getTemplateParameterList(); }
 
-  /// Retrieve the body of the lambda.
-  CompoundStmt *getBody() const;
+  /// Retrieve the body of the lambda. This will be most of the time
+  /// a \p CompoundStmt, but can also be \p CoroutineBodyStmt wrapping
+  /// a \p CompoundStmt. Note that unlike functions, lambda-expressions
+  /// cannot have a function-try-block.
+  Stmt *getBody() const { return getStoredStmts()[capture_size()]; }
+
+  /// Retrieve the \p CompoundStmt representing the body of the lambda.
+  /// This is a convenience function for callers who do not need
+  /// to handle node(s) which may wrap a \p CompoundStmt.
+  const CompoundStmt *getCompoundStmtBody() const {
+Stmt *Body = getBody();
+if (const auto *CoroBody = dyn_cast(Body))
+  return cast(CoroBody->getBody());
+return cast(Body);
+  }
+  CompoundStmt *getCompoundStmtBody() {
+const auto *ConstThis = this;
+return const_cast(ConstThis->getCompoundStmtBody());
+  }
 
   /// Determine whether the lambda is mutable, meaning that any
   /// captures values can be modified.

diff  --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index 8588e9b47d65..f9f825b29ed0 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -1118,15 +1118,6 @@ LambdaExpr::LambdaExpr(QualType T, SourceRange 
IntroducerRange,
 LambdaExpr::LambdaExpr(EmptyShell Empty, unsigned NumCaptures)
 : Expr(LambdaExprClass, Empty) {
   LambdaExprBits.NumCaptures = NumCaptures;
-
-  // FIXME: There is no need to do this since these members should be
-  // initialized during deserialization.
-  LambdaExprBits.CaptureDefault = LCD_None;
-  LambdaExprBits.ExplicitParams = false;
-  LambdaExprBits.ExplicitResultType = false;
-
-  // FIXME: Remove once the bug in LambdaExpr::getBody is fixed.
-  getStoredStmts()[capture_size()] = nullptr;
 }
 
 LambdaExpr *LambdaExpr::Create(const ASTContext &Context, CXXRecordDecl *Class,
@@ -1223,17 +1214,6 @@ ArrayRef 
LambdaExpr::getExplicitTemplateParameters() const {
   return Record->getLambdaExplicitTemplateParameters();
 }
 
-CompoundStmt *LambdaExpr::getBody() const {
-  // FIXME: this mutation in getBody is bogus. It should be
-  // initialized in ASTStmtReader::VisitLambdaExpr, but for reasons I
-  // don't understand, that doesn't work.
-  if (!getStoredStmts()[capture_size()])
-*const_cast(&getStoredStmts()[capture_size()]) =
-getCallOperator()->getBody();
-
-  return static_cast(getStoredStmts()[capture_size()]);
-}
-
 bool LambdaExpr::isMutable() const { return !getCallOperator()->isConst(); }
 
 ExprWithCleanups::ExprWithCleanups(Expr *subexpr,

diff  --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index d5d025335aa2..11e222f95176 100644
--- a/clang/lib/A

[clang] 92d8ad0 - [HIP] Fix rocm not found on rocm3.5

2020-06-18 Thread Yaxun Liu via cfe-commits

Author: Yaxun (Sam) Liu
Date: 2020-06-18T08:40:09-04:00
New Revision: 92d8ad02e92fed3884169ba5d98056fe4fa5660d

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

LOG: [HIP] Fix rocm not found on rocm3.5

Currently rocm detector expects device library bitcodes named as *.bc
instead of *.amdgcn.bc. However in rocm3.5 the device library bitcodes
are named as *.amdgcn.bc, which causes rocm3.5 not detected.

This patch fixes that.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/AMDGPU.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index adb659e3b229..edc52b86e45a 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -25,6 +25,7 @@ void RocmInstallationDetector::scanLibDevicePath() {
   assert(!LibDevicePath.empty());
 
   const StringRef Suffix(".bc");
+  const StringRef Suffix2(".amdgcn.bc");
 
   std::error_code EC;
   for (llvm::vfs::directory_iterator
@@ -36,7 +37,11 @@ void RocmInstallationDetector::scanLibDevicePath() {
 if (!FileName.endswith(Suffix))
   continue;
 
-StringRef BaseName = FileName.drop_back(Suffix.size());
+StringRef BaseName;
+if (FileName.endswith(Suffix2))
+  BaseName = FileName.drop_back(Suffix2.size());
+else if (FileName.endswith(Suffix))
+  BaseName = FileName.drop_back(Suffix.size());
 
 if (BaseName == "ocml") {
   OCML = FilePath;



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


[PATCH] D82087: AMDGPU/clang: Add builtins for llvm.amdgcn.ballot

2020-06-18 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: yaxunl, rampitec, b-sumner, foad, nhaehnle.
Herald added subscribers: kerbowa, t-tye, tpr, dstuttard, wdng, jvesely, 
kzhuravl.

I wasn't sure what the best strategy was for the wave size
difference. I went for an explicit, enforced builtin for each. The
other option would be to just assume wave64, and IRGen the different
mangling + zext. I didn't see an obvious way to check the wave size
where builtins are emitted, and it might be beneficial to force you to
acknowledge the wave size difference? Or it might be an unnecessary
complication.

The behavior is also slightly odd when directly specifying
-target-feature to cc1 for +/- the size (since we have both positive
and negative forms of both sizes), but this is probably unimportant.

We're also still missing a predefined macro for the wave size, which
we probably need.


https://reviews.llvm.org/D82087

Files:
  clang/include/clang/Basic/BuiltinsAMDGPU.def
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGenOpenCL/amdgpu-features.cl
  clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
  clang/test/CodeGenOpenCL/builtins-amdgcn-wave32.cl
  clang/test/CodeGenOpenCL/builtins-amdgcn-wave64.cl
  clang/test/SemaOpenCL/builtins-amdgcn-error-wave32.cl
  clang/test/SemaOpenCL/builtins-amdgcn-error-wave64.cl

Index: clang/test/SemaOpenCL/builtins-amdgcn-error-wave64.cl
===
--- /dev/null
+++ clang/test/SemaOpenCL/builtins-amdgcn-error-wave64.cl
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -verify -S -o - %s
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -target-feature +wavefrontsize32 -verify -S -o - %s
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -target-feature -wavefrontsize64 -verify -S -o - %s
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -verify -S -o - %s
+
+typedef unsigned long ulong;
+
+void test_ballot_wave64(global ulong* out, int a, int b) {
+  *out = __builtin_amdgcn_ballot_wave64(a == b);  // expected-error {{'__builtin_amdgcn_ballot_wave64' needs target feature wavefrontsize64}}
+}
Index: clang/test/SemaOpenCL/builtins-amdgcn-error-wave32.cl
===
--- /dev/null
+++ clang/test/SemaOpenCL/builtins-amdgcn-error-wave32.cl
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx900 -verify -S -o - %s
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -target-feature +wavefrontsize64 -verify -S -o - %s
+// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -target-feature -wavefrontsize32 -verify -S -o - %s
+
+typedef unsigned int uint;
+
+void test_ballot_wave32(global uint* out, int a, int b) {
+  *out = __builtin_amdgcn_ballot_wave32(a == b);  // expected-error {{'__builtin_amdgcn_ballot_wave32' needs target feature wavefrontsize32}}
+}
Index: clang/test/CodeGenOpenCL/builtins-amdgcn-wave64.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/builtins-amdgcn-wave64.cl
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck -enable-var-scope %s
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -target-feature +wavefrontsize64 -S -emit-llvm -o - %s | FileCheck -enable-var-scope %s
+// XUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -target-feature -wavefrontsize32 -S -emit-llvm -o - %s | FileCheck -enable-var-scope %s
+
+typedef unsigned long ulong;
+
+// CHECK-LABEL: @test_ballot_wave64(
+// CHECK: call i64 @llvm.amdgcn.ballot.i64(i1 %{{.+}})
+void test_ballot_wave64(global ulong* out, int a, int b)
+{
+  *out = __builtin_amdgcn_ballot_wave64(a == b);
+}
+
Index: clang/test/CodeGenOpenCL/builtins-amdgcn-wave32.cl
===
--- /dev/null
+++ clang/test/CodeGenOpenCL/builtins-amdgcn-wave32.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -S -emit-llvm -o - %s | FileCheck -enable-var-scope %s
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -target-feature +wavefrontsize32 -S -emit-llvm -o - %s | FileCheck -enable-var-scope %s
+
+typedef unsigned int uint;
+
+// CHECK-LABEL: @test_ballot_wave32(
+// CHECK: call i32 @llvm.amdgcn.ballot.i32(i1 %{{.+}})
+void test_ballot_wave32(global uint* out, int a, int b)
+{
+  *out = __builtin_amdgcn_ballot_wave32(a == b);
+}
+
Index: clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
===
--- clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
+++ clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
@@ -22,3 +22,10 @@
 void test_mov_dpp8(global uint* out, uint a) {
   *out = __builtin_amdgcn_mov_dpp8(a, 1);
 }
+
+// CHECK-LABEL: @test_bal

[PATCH] D82029: [Coroutines] Ensure co_await promise.final_suspend() does not throw

2020-06-18 Thread Brian Gesiak via Phabricator via cfe-commits
modocache added a reviewer: junparser.
modocache added a subscriber: junparser.
modocache added a comment.

Excellent, thank you! The test failures on the diff appear to be legitimate, 
they reproduce for me when I apply this patch to my local checkout and run 
`ninja check-clang`. Could you take a look?

This LGTM otherwise! Also adding @junparser in case they have any thoughts, if 
not I'll accept after the test failures are addressed, Thanks!




Comment at: clang/lib/Sema/SemaExceptionSpec.cpp:1051
+FT = S.ResolveExceptionSpec(Loc.isInvalid() ? E->getBeginLoc() : Loc, FT);
+  }
   if (!FT)

Small nit-pick: Omit the `{` and `}` here, as that's the convention in the 
surrounding lines of this file and in the LLVM project in general.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82029



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


[PATCH] D82086: [AST][RecoveryExpr] Fix a crash: don't attach error-type base specifiers.

2020-06-18 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added a project: clang.
hokein edited the summary of this revision.

otherwise we'll run into code path which expects a good base specifiers,
and lead to crashes.

The crash only occurs in template instantiations (in non-template case,
the bad base specifiers are dropped during parsing.)

crash stacktrace:

  clang: llvm-project/clang/lib/Sema/SemaInit.cpp:7864: clang::ExprResult 
clang::InitializationSequence::Perform(clang::Sema &, const 
clang::InitializedEntity &, const clang::InitializationKind &, 
clang::MultiExprArg, clang::QualType *): Assertion `Kind.getKind() == 
InitializationKind::IK_Copy || Kind.isExplicitCast() || Kind.getKind() == 
InitializationKind::IK_DirectList' failed.
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash 
backtrace, preprocessed source, and associated run script.
  Stack dump:
  #14 clang::InitializationSequence::Perform(clang::Sema&, 
clang::InitializedEntity const&, clang::InitializationKind const&, 
llvm::MutableArrayRef, clang::QualType*) 
llvm-project/clang/lib/Sema/SemaInit.cpp:7889:12
  #15 BuildImplicitBaseInitializer(clang::Sema&, clang::CXXConstructorDecl*, 
ImplicitInitializerKind, clang::CXXBaseSpecifier*, bool, 
clang::CXXCtorInitializer*&) llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:4563:24
  #16 clang::Sema::SetCtorInitializers(clang::CXXConstructorDecl*, bool, 
llvm::ArrayRef) 
llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:5090:11
  #17 clang::Sema::ActOnMemInitializers(clang::Decl*, clang::SourceLocation, 
llvm::ArrayRef, bool) 
llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:5404:3
  #18 llvm::SmallVectorTemplateCommon::isSmall() const llvm-project/llvm/include/llvm/ADT/SmallVector.h:124:39
  #19 llvm::SmallVectorImpl::~SmallVectorImpl() 
llvm-project/llvm/include/llvm/ADT/SmallVector.h:381:16
  #20 llvm::SmallVector::~SmallVector() 
llvm-project/llvm/include/llvm/ADT/SmallVector.h:891:3
  #21 clang::Sema::InstantiateMemInitializers(clang::CXXConstructorDecl*, 
clang::CXXConstructorDecl const*, clang::MultiLevelTemplateArgumentList const&) 
llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5391:1
  #22 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, 
clang::FunctionDecl*, bool, bool, bool) 
llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4699:13
  #23 clang::FunctionDecl::isDefined() const 
llvm-project/clang/include/clang/AST/Decl.h:2035:12
  #24 clang::Sema::PerformPendingInstantiations(bool) 
llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5956:23
  #25 llvm::TimeTraceScope::~TimeTraceScope() 
llvm-project/llvm/include/llvm/Support/TimeProfiler.h:86:9
  #26 
clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) 
llvm-project/clang/lib/Sema/Sema.cpp:958:3
  #27 clang::Sema::ActOnEndOfTranslationUnit() 
llvm-project/clang/lib/Sema/Sema.cpp:999:9
  #28 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&, 
bool) llvm-project/clang/lib/Parse/Parser.cpp:657:15


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82086

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/invalid-template-base-specifier.cpp


Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/invalid-template-base-specifier.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -frecovery-ast -verify %s
+
+bool Foo(int *); // expected-note {{candidate function not viable}}
+
+template 
+struct Crash : decltype(Foo(T())) { // expected-error {{no matching function 
for call to 'Foo'}}
+  Crash(){};
+};
+
+void test() { Crash(); } // expected-note {{in instantiation of template 
class}}
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -2426,7 +2426,11 @@
  TypeSourceInfo *TInfo,
  SourceLocation EllipsisLoc) {
   QualType BaseType = TInfo->getType();
-
+  if (BaseType->containsErrors()) {
+// FIXME: should we emit a diagnostic here? We already emit a diagnostic
+// when parsing the error type.
+return nullptr;
+  }
   // C++ [class.union]p1:
   //   A union shall not have base classes.
   if (Class->isUnion()) {


Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/invalid-template-base-specifier.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -frecovery-ast -verify %s
+
+bool Foo(int *); // expected-note {{candidate function not viable}}
+
+template 
+struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}}
+  Crash(){};
+};
+
+void test() { Crash(); } // expected-note {{in instantiation of template class}}
Index: clang/lib/Sema/SemaDeclCXX.cpp
=

[PATCH] D81787: [clang] Fix the serialization of LambdaExpr and the bogus mutation in LambdaExpr::getBody

2020-06-18 Thread Bruno Ricci via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
riccibruno marked an inline comment as done.
Closed by commit rG05843dc6ab97: [clang] Fix the serialization of LambdaExpr 
and the bogus mutation in… (authored by riccibruno).

Changed prior to commit:
  https://reviews.llvm.org/D81787?vs=270572&id=271687#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81787

Files:
  clang/include/clang/AST/ExprCXX.h
  clang/lib/AST/ExprCXX.cpp
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/AST/ast-dump-lambda.cpp

Index: clang/test/AST/ast-dump-lambda.cpp
===
--- clang/test/AST/ast-dump-lambda.cpp
+++ clang/test/AST/ast-dump-lambda.cpp
@@ -8,7 +8,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu++17 \
 // RUN:-x c++ -include-pch %t -ast-dump-all | FileCheck -strict-whitespace %s
 
-// XFAIL: *
+
 
 template  void test(Ts... a) {
   struct V {
@@ -64,7 +64,7 @@
 // CHECK-NEXT:   |   | | `-FieldDecl {{.*}}  col:8{{( imported)?}} implicit 'V *'
 // CHECK-NEXT:   |   | |-ParenListExpr {{.*}}  'NULL TYPE'
 // CHECK-NEXT:   |   | | `-CXXThisExpr {{.*}}  'V *' this
-// CHECK-NEXT:   |   | `-<<>>
+// CHECK-NEXT:   |   | `-CompoundStmt {{.*}} 
 // CHECK-NEXT:   |   `-LambdaExpr {{.*}}  '(lambda at {{.*}}ast-dump-lambda.cpp:17:7)'
 // CHECK-NEXT:   | |-CXXRecordDecl {{.*}}  col:7{{( imported)?}} implicit{{( )?}} class definition
 // CHECK-NEXT:   | | |-DefinitionData lambda standard_layout trivially_copyable can_const_default_init
@@ -80,7 +80,7 @@
 // CHECK-NEXT:   | |-ParenListExpr {{.*}}  'NULL TYPE'
 // CHECK-NEXT:   | | `-UnaryOperator {{.*}}  '' prefix '*' cannot overflow
 // CHECK-NEXT:   | |   `-CXXThisExpr {{.*}}  'V *' this
-// CHECK-NEXT:   | `-<<>>
+// CHECK-NEXT:   | `-CompoundStmt {{.*}} 
 // CHECK-NEXT:   |-DeclStmt {{.*}} 
 // CHECK-NEXT:   | |-VarDecl {{.*}}  col:7{{( imported)?}} referenced b 'int'
 // CHECK-NEXT:   | `-VarDecl {{.*}}  col:10{{( imported)?}} referenced c 'int'
@@ -97,7 +97,7 @@
 // CHECK-NEXT:   | | | `-CompoundStmt {{.*}} 
 // CHECK-NEXT:   | | |-CXXConversionDecl {{.*}}  col:3{{( imported)?}} implicit constexpr operator auto (*)() 'auto (*() const noexcept)()' inline
 // CHECK-NEXT:   | | `-CXXMethodDecl {{.*}}  col:3{{( imported)?}} implicit __invoke 'auto ()' static inline
-// CHECK-NEXT:   | `-<<>>
+// CHECK-NEXT:   | `-CompoundStmt {{.*}} 
 // CHECK-NEXT:   |-LambdaExpr {{.*}}  '(lambda at {{.*}}ast-dump-lambda.cpp:22:3)'
 // CHECK-NEXT:   | |-CXXRecordDecl {{.*}}  col:3{{( imported)?}} implicit{{( )?}} class definition
 // CHECK-NEXT:   | | |-DefinitionData lambda empty standard_layout trivially_copyable literal can_const_default_init
@@ -113,7 +113,7 @@
 // CHECK-NEXT:   | | |-CXXConversionDecl {{.*}}  col:3{{( imported)?}} implicit constexpr operator auto (*)(int, ...) 'auto (*() const noexcept)(int, ...)' inline
 // CHECK-NEXT:   | | `-CXXMethodDecl {{.*}}  col:3{{( imported)?}} implicit __invoke 'auto (int, ...)' static inline
 // CHECK-NEXT:   | |   `-ParmVarDecl {{.*}}  col:10{{( imported)?}} a 'int'
-// CHECK-NEXT:   | `-<<>>
+// CHECK-NEXT:   | `-CompoundStmt {{.*}} 
 // CHECK-NEXT:   |-LambdaExpr {{.*}}  '(lambda at {{.*}}ast-dump-lambda.cpp:23:3)'
 // CHECK-NEXT:   | |-CXXRecordDecl {{.*}}  col:3{{( imported)?}} implicit{{( )?}} class definition
 // CHECK-NEXT:   | | |-DefinitionData lambda standard_layout trivially_copyable can_const_default_init
@@ -128,7 +128,7 @@
 // CHECK-NEXT:   | | `-FieldDecl {{.*}}  col:4{{( imported)?}} implicit 'Ts...'
 // CHECK-NEXT:   | |-ParenListExpr {{.*}}  'NULL TYPE'
 // CHECK-NEXT:   | | `-DeclRefExpr {{.*}}  'Ts...' lvalue ParmVar {{.*}} 'a' 'Ts...'
-// CHECK-NEXT:   | `-<<>>
+// CHECK-NEXT:   | `-CompoundStmt {{.*}} 
 // CHECK-NEXT:   |-LambdaExpr {{.*}}  '(lambda at {{.*}}ast-dump-lambda.cpp:24:3)'
 // CHECK-NEXT:   | |-CXXRecordDecl {{.*}}  col:3{{( imported)?}} implicit{{( )?}} class definition
 // CHECK-NEXT:   | | |-DefinitionData lambda empty standard_layout trivially_copyable literal can_const_default_init
@@ -140,7 +140,7 @@
 // CHECK-NEXT:   | | | `-Destructor simple irrelevant trivial needs_implicit
 // CHECK-NEXT:   | | `-CXXMethodDecl {{.*}}  col:3{{( imported)?}} operator() 'auto () const -> auto' inline
 // CHECK-NEXT:   | |   `-CompoundStmt {{.*}} 
-// CHECK-NEXT:   | `-<<>>
+// CHECK-NEXT:   | `-CompoundStmt {{.*}} 
 // CHECK-NEXT:   |-LambdaExpr {{.*}}  '(lambda at {{.*}}ast-dump-lambda.cpp:25:3)'
 // CHECK-NEXT:   | |-CXXRecordDecl {{.*}}  col:3{{( imported)?}} 

[PATCH] D81713: [HIP] Fix rocm not found on rocm3.5

2020-06-18 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92d8ad02e92f: [HIP] Fix rocm not found on rocm3.5 (authored 
by yaxunl).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D81713?vs=270298&id=271689#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81713

Files:
  clang/lib/Driver/ToolChains/AMDGPU.cpp


Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -25,6 +25,7 @@
   assert(!LibDevicePath.empty());
 
   const StringRef Suffix(".bc");
+  const StringRef Suffix2(".amdgcn.bc");
 
   std::error_code EC;
   for (llvm::vfs::directory_iterator
@@ -36,7 +37,11 @@
 if (!FileName.endswith(Suffix))
   continue;
 
-StringRef BaseName = FileName.drop_back(Suffix.size());
+StringRef BaseName;
+if (FileName.endswith(Suffix2))
+  BaseName = FileName.drop_back(Suffix2.size());
+else if (FileName.endswith(Suffix))
+  BaseName = FileName.drop_back(Suffix.size());
 
 if (BaseName == "ocml") {
   OCML = FilePath;


Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -25,6 +25,7 @@
   assert(!LibDevicePath.empty());
 
   const StringRef Suffix(".bc");
+  const StringRef Suffix2(".amdgcn.bc");
 
   std::error_code EC;
   for (llvm::vfs::directory_iterator
@@ -36,7 +37,11 @@
 if (!FileName.endswith(Suffix))
   continue;
 
-StringRef BaseName = FileName.drop_back(Suffix.size());
+StringRef BaseName;
+if (FileName.endswith(Suffix2))
+  BaseName = FileName.drop_back(Suffix2.size());
+else if (FileName.endswith(Suffix))
+  BaseName = FileName.drop_back(Suffix.size());
 
 if (BaseName == "ocml") {
   OCML = FilePath;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81786: [clang][utils] Modify make-ast-dump-check.sh to generate AST serialization dump tests

2020-06-18 Thread Bruno Ricci via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc7350a3bab14: [clang][utils] Modify make-ast-dump-check.sh 
to generate AST serialization dump… (authored by riccibruno).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81786

Files:
  clang/utils/make-ast-dump-check.sh


Index: clang/utils/make-ast-dump-check.sh
===
--- clang/utils/make-ast-dump-check.sh
+++ clang/utils/make-ast-dump-check.sh
@@ -3,12 +3,21 @@
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
 #
-# Usage:
+# Usage (to generate normal AST dump tests):
 #
 # $ lit -DFileCheck=$PWD/utils/make-ast-dump-check.sh 
test/AST/ast-dump-openmp-*
+#
+# Usage (to generate serialization AST dump tests):
+#
+# $ lit -DFileCheck="generate_serialization_test=1 
$PWD/utils/make-ast-dump-check.sh"
+# test/AST/ast-dump-openmp-*
 
 prefix=CHECK
 
+if [ -z ${generate_serialization_test+x} ];
+  then generate_serialization_test=0;
+fi
+
 while [[ "$#" -ne 0 ]]; do
   case "$1" in
   --check-prefix)
@@ -54,6 +63,10 @@
   s = \$0
   gsub("0x[0-9a-fA-F]+", "{{.*}}", s)
   gsub("$testdir/", "{{.*}}", s)
+  if ($generate_serialization_test == 1) {
+gsub(" imported", "{{( imported)?}}", s)
+gsub(" ", "{{( )?}}", s)
+  }
 }
 
 matched_last_line == 0 {


Index: clang/utils/make-ast-dump-check.sh
===
--- clang/utils/make-ast-dump-check.sh
+++ clang/utils/make-ast-dump-check.sh
@@ -3,12 +3,21 @@
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
 #
-# Usage:
+# Usage (to generate normal AST dump tests):
 #
 # $ lit -DFileCheck=$PWD/utils/make-ast-dump-check.sh test/AST/ast-dump-openmp-*
+#
+# Usage (to generate serialization AST dump tests):
+#
+# $ lit -DFileCheck="generate_serialization_test=1 $PWD/utils/make-ast-dump-check.sh"
+# test/AST/ast-dump-openmp-*
 
 prefix=CHECK
 
+if [ -z ${generate_serialization_test+x} ];
+  then generate_serialization_test=0;
+fi
+
 while [[ "$#" -ne 0 ]]; do
   case "$1" in
   --check-prefix)
@@ -54,6 +63,10 @@
   s = \$0
   gsub("0x[0-9a-fA-F]+", "{{.*}}", s)
   gsub("$testdir/", "{{.*}}", s)
+  if ($generate_serialization_test == 1) {
+gsub(" imported", "{{( imported)?}}", s)
+gsub(" ", "{{( )?}}", s)
+  }
 }
 
 matched_last_line == 0 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 89ea0b0 - [MC] Pass down argv0 & cc1 cmd-line to the back-end and store in MCTargetOptions

2020-06-18 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-06-18T09:17:14-04:00
New Revision: 89ea0b05207d45c145fb525df554b3b986ae379b

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

LOG: [MC] Pass down argv0 & cc1 cmd-line to the back-end and store in 
MCTargetOptions

When targetting CodeView, the goal is to store argv0 & cc1 cmd-line in the 
emitted .OBJ, in order to allow a reproducer from the .OBJ alone.

This patch is to simplify https://reviews.llvm.org/D80833

Added: 


Modified: 
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Frontend/CompilerInvocation.h
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
clang/lib/Tooling/Tooling.cpp
clang/tools/driver/cc1_main.cpp
clang/tools/driver/driver.cpp
llvm/include/llvm/MC/MCTargetOptions.h

Removed: 




diff  --git a/clang/include/clang/Basic/CodeGenOptions.h 
b/clang/include/clang/Basic/CodeGenOptions.h
index 864ccd5e276d..b14a088d77b2 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -332,6 +332,11 @@ class CodeGenOptions : public CodeGenOptionsBase {
   /// coverage pass should actually not be instrumented.
   std::vector SanitizeCoverageBlacklistFiles;
 
+  /// Executable and command-line used to create a given CompilerInvocation.
+  /// Most of the time this will be the full -cc1 command.
+  const char *Argv0 = nullptr;
+  ArrayRef CommandLineArgs;
+
 public:
   // Define accessors/mutators for code generation options of enumeration type.
 #define CODEGENOPT(Name, Bits, Default)

diff  --git a/clang/include/clang/Frontend/CompilerInvocation.h 
b/clang/include/clang/Frontend/CompilerInvocation.h
index 25476f78a6a0..e63408da8f5e 100644
--- a/clang/include/clang/Frontend/CompilerInvocation.h
+++ b/clang/include/clang/Frontend/CompilerInvocation.h
@@ -155,7 +155,8 @@ class CompilerInvocation : public CompilerInvocationBase {
   /// \param [out] Res - The resulting invocation.
   static bool CreateFromArgs(CompilerInvocation &Res,
  ArrayRef CommandLineArgs,
- DiagnosticsEngine &Diags);
+ DiagnosticsEngine &Diags,
+ const char *Argv0 = nullptr);
 
   /// Get the directory where the compiler headers
   /// reside, relative to the compiler binary (found by the passed in

diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 603f1c9adf54..e810bb23f347 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -537,6 +537,8 @@ static void initTargetOptions(DiagnosticsEngine &Diags,
  Entry.Group == frontend::IncludeDirGroup::System))
   Options.MCOptions.IASSearchPaths.push_back(
   Entry.IgnoreSysRoot ? Entry.Path : HSOpts.Sysroot + Entry.Path);
+  Options.MCOptions.Argv0 = CodeGenOpts.Argv0;
+  Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs;
 }
 static Optional getGCOVOptions(const CodeGenOptions &CodeGenOpts) 
{
   if (CodeGenOpts.DisableGCov)

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 4c05717a24f2..1af4153c4423 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3627,7 +3627,8 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList 
&Args,
 
 bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
 ArrayRef CommandLineArgs,
-DiagnosticsEngine &Diags) {
+DiagnosticsEngine &Diags,
+const char *Argv0) {
   bool Success = true;
 
   // Parse the arguments.
@@ -3747,6 +3748,11 @@ bool 
CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
 Res.getCodeGenOpts().FineGrainedBitfieldAccesses = false;
 Diags.Report(diag::warn_drv_fine_grained_bitfield_accesses_ignored);
   }
+
+  // Store the command-line for using in the CodeView backend.
+  Res.getCodeGenOpts().Argv0 = Argv0;
+  Res.getCodeGenOpts().CommandLineArgs = CommandLineArgs;
+
   return Success;
 }
 

diff  --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp 
b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
index 18c4814bbd5c..1d5a6c06b34f 100644
--- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
+++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
@@ -93,7 +93,7 @@ std::unique_ptr 
clang::createInvocationFromCommandLine(
   if (CC1Args)
 *CC1Args = {CCArgs.begin(), CCArgs.end()};
   auto CI = std::make_unique();
-  if (!CompilerInvocation::CreateFromArgs(*C

[clang] a45409d - [Clang] Move clang::Job::printArg to llvm::sys::printArg. NFCI.

2020-06-18 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-06-18T09:17:13-04:00
New Revision: a45409d8855a1e4538990507ef25e9b51c090193

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

LOG: [Clang] Move clang::Job::printArg to llvm::sys::printArg. NFCI.

This patch is to support/simplify https://reviews.llvm.org/D80833

Added: 


Modified: 
clang/include/clang/Driver/Job.h
clang/lib/Driver/Driver.cpp
clang/lib/Driver/Job.cpp
llvm/include/llvm/Support/Program.h
llvm/lib/Support/Program.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Job.h 
b/clang/include/clang/Driver/Job.h
index 9a3cad23363b..1c6ea6971919 100644
--- a/clang/include/clang/Driver/Job.h
+++ b/clang/include/clang/Driver/Job.h
@@ -128,9 +128,6 @@ class Command {
 
   const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
 
-  /// Print a command argument, and optionally quote it.
-  static void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote);
-
 protected:
   /// Optionally print the filenames to be compiled
   void PrintFileNames() const;

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index a8442d2cd0af..a48761af400f 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1167,7 +1167,7 @@ static void printArgList(raw_ostream &OS, const 
llvm::opt::ArgList &Args) {
   for (auto I = ASL.begin(), E = ASL.end(); I != E; ++I) {
 if (I != ASL.begin())
   OS << ' ';
-Command::printArg(OS, *I, true);
+llvm::sys::printArg(OS, *I, true);
   }
   OS << '\n';
 }

diff  --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index 6d1e7e61ba1d..274bda9dc9f1 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -100,24 +100,6 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, 
int &SkipNum,
   return false;
 }
 
-void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) {
-  const bool Escape = Arg.find_first_of(" \"\\$") != StringRef::npos;
-
-  if (!Quote && !Escape) {
-OS << Arg;
-return;
-  }
-
-  // Quote and escape. This isn't really complete, but good enough.
-  OS << '"';
-  for (const auto c : Arg) {
-if (c == '"' || c == '\\' || c == '$')
-  OS << '\\';
-OS << c;
-  }
-  OS << '"';
-}
-
 void Command::writeResponseFile(raw_ostream &OS) const {
   // In a file list, we only write the set of inputs to the response file
   if (Creator.getResponseFilesSupport() == Tool::RF_FileList) {
@@ -217,7 +199,7 @@ void Command::Print(raw_ostream &OS, const char 
*Terminator, bool Quote,
 CrashReportInfo *CrashInfo) const {
   // Always quote the exe.
   OS << ' ';
-  printArg(OS, Executable, /*Quote=*/true);
+  llvm::sys::printArg(OS, Executable, /*Quote=*/true);
 
   ArrayRef Args = Arguments;
   SmallVector ArgsRespFile;
@@ -245,7 +227,7 @@ void Command::Print(raw_ostream &OS, const char 
*Terminator, bool Quote,
 if (!NewIncFlags.empty()) {
   for (auto &F : NewIncFlags) {
 OS << ' ';
-printArg(OS, F.c_str(), Quote);
+llvm::sys::printArg(OS, F.c_str(), Quote);
   }
   i += NumArgs - 1;
   continue;
@@ -259,20 +241,20 @@ void Command::Print(raw_ostream &OS, const char 
*Terminator, bool Quote,
 // Replace the input file name with the crashinfo's file name.
 OS << ' ';
 StringRef ShortName = llvm::sys::path::filename(CrashInfo->Filename);
-printArg(OS, ShortName.str(), Quote);
+llvm::sys::printArg(OS, ShortName.str(), Quote);
 continue;
   }
 }
 
 OS << ' ';
-printArg(OS, Arg, Quote);
+llvm::sys::printArg(OS, Arg, Quote);
   }
 
   if (CrashInfo && HaveCrashVFS) {
 OS << ' ';
-printArg(OS, "-ivfsoverlay", Quote);
+llvm::sys::printArg(OS, "-ivfsoverlay", Quote);
 OS << ' ';
-printArg(OS, CrashInfo->VFSPath.str(), Quote);
+llvm::sys::printArg(OS, CrashInfo->VFSPath.str(), Quote);
 
 // The leftover modules from the crash are stored in
 //  .cache/vfs/modules
@@ -287,7 +269,7 @@ void Command::Print(raw_ostream &OS, const char 
*Terminator, bool Quote,
 ModCachePath.append(RelModCacheDir.c_str());
 
 OS << ' ';
-printArg(OS, ModCachePath, Quote);
+llvm::sys::printArg(OS, ModCachePath, Quote);
   }
 
   if (ResponseFile != nullptr) {

diff  --git a/llvm/include/llvm/Support/Program.h 
b/llvm/include/llvm/Support/Program.h
index ff4777ebecee..ce0b6db5705f 100644
--- a/llvm/include/llvm/Support/Program.h
+++ b/llvm/include/llvm/Support/Program.h
@@ -210,6 +210,9 @@ namespace sys {
   /// stored.
   );
 
+  /// Print a command argument, and optionally quote it.
+  void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote);
+
 #if defined(_WIN32)
   /// Given a lis

[clang] 403f953 - [CodeView] Add full repro to LF_BUILDINFO record

2020-06-18 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-06-18T09:17:15-04:00
New Revision: 403f9537924b8910ed4f741ed96c61f5e657915b

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

LOG: [CodeView] Add full repro to LF_BUILDINFO record

This patch adds some missing information to the LF_BUILDINFO which allows for 
rebuilding an .OBJ without any external dependency but the .OBJ itself (other 
than the compiler executable).

Some tools need this information to reproduce a build without any knowledge of 
the build system. The LF_BUILDINFO therefore stores a full path to the 
compiler, the PWD (which is the CWD at program startup), a relative or absolute 
path to the TU, and the full CC1 command line. The command line needs to be 
freestanding (not depend on any environment variable). In the same way, MSVC 
doesn't store the provided command-line, but an expanded version (somehow their 
equivalent of CC1) which is also freestanding.

For more information see PR36198 and D43002.

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

Added: 
clang/test/CodeGen/debug-info-codeview-buildinfo.c

Modified: 
lld/COFF/PDB.cpp
lld/test/COFF/Inputs/pdb_lines_1_relative.yaml
lld/test/COFF/Inputs/pdb_lines_2_relative.yaml
lld/test/COFF/pdb-relative-source-lines.test
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

Removed: 




diff  --git a/clang/test/CodeGen/debug-info-codeview-buildinfo.c 
b/clang/test/CodeGen/debug-info-codeview-buildinfo.c
new file mode 100644
index ..d08fadbbf1a9
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-codeview-buildinfo.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cl /c /Z7 /Fo%t.obj -- %s
+// RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s
+// RUN: %clang_cl /c /Z7 %s /Fo%t.obj -fdebug-compilation-dir .
+// RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix RELATIVE
+
+int main() { return 42; }
+
+// CHECK:   Types (.debug$T)
+// CHECK: 
+// CHECK: 0x[[PWD:.+]] | LF_STRING_ID [size = {{.+}}] ID: , String: 
[[PWDVAL:.+]]
+// CHECK: 0x[[FILEPATH:.+]] | LF_STRING_ID [size = {{.+}}] ID: , 
String: [[FILEPATHVAL:.+[\\/]debug-info-codeview-buildinfo.c]]
+// CHECK: 0x[[TOOL:.+]] | LF_STRING_ID [size = {{.+}}] ID: , String: 
[[TOOLVAL:.+[\\/]clang.*]]
+// CHECK: 0x[[CMDLINE:.+]] | LF_STRING_ID [size = {{.+}}] ID: , 
String: "-cc1
+// CHECK: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
+// CHECK:  0x[[PWD]]: `[[PWDVAL]]`
+// CHECK:  0x[[TOOL]]: `[[TOOLVAL]]`
+// CHECK:  0x[[FILEPATH]]: `[[FILEPATHVAL]]`
+// CHECK:  : ``
+// CHECK:  0x[[CMDLINE]]: `"-cc1
+
+// RELATIVE:   Types (.debug$T)
+// RELATIVE: 
+// RELATIVE: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
+// RELATIVE:  0x{{.+}}: `.`

diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index be6af13f3647..75884ed11308 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -250,6 +250,72 @@ static void addTypeInfo(pdb::TpiStreamBuilder &tpiBuilder,
   });
 }
 
+// LF_BUILDINFO records might contain relative paths, and we want to make them
+// absolute. We do this remapping only after the type records were merged,
+// because the full types graph isn't known during merging. In addition, we 
plan
+// to multi-thread the type merging, and the change below needs to be done
+// atomically, single-threaded.
+
+// A complication could arise when a LF_STRING_ID record already exists with 
the
+// same content as the new absolutized path. In that case, we simply redirect
+// LF_BUILDINFO's CurrentDirectory index to reference the existing LF_STRING_ID
+// record.
+
+static void remapBuildInfo(TypeCollection &idTable) {
+  SimpleTypeSerializer s;
+  idTable.ForEachRecord([&](TypeIndex ti, const CVType &type) {
+if (type.kind() != LF_BUILDINFO)
+  return;
+BuildInfoRecord bi;
+cantFail(TypeDeserializer::deserializeAs(const_cast(type), bi));
+
+auto makeAbsoluteRecord =
+[&](BuildInfoRecord::BuildInfoArg recordType) -> Optional {
+  TypeIndex recordTi = bi.getArgs()[recordType];
+  if (recordTi.isNoneType())
+return None;
+  CVType recordRef = idTable.getType(recordTi);
+
+  StringIdRecord record;
+  cantFail(TypeDeserializer::deserializeAs(recordRef, record));
+
+  SmallString<128> abolutizedPath(record.getString());
+  pdbMakeAbsolute(abolutizedPath);
+
+  if (abolutizedPath == record.getString())
+return None; // The path is already absolute.
+
+  record.String = abolutizedPath;
+  ArrayRef recordData = s.serialize(record);
+
+  // Replace the previous LF_STRING_ID record
+  if (!idTable.replaceType(recordTi, CVType(recor

[PATCH] D79477: [clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics

2020-06-18 Thread hyd-dev via Phabricator via cfe-commits
hyd-dev added a comment.

**Ping?**


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

https://reviews.llvm.org/D79477



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


[PATCH] D82089: [clang-tidy] modernize-loop-convert reverse iteration support

2020-06-18 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: alexfh, Eugene.Zelenko, angelgarcia, aaron.ballman, 
klimek.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

Enables support for transforming loops of the form

  for (auto I = Cont.rbegin(), E = Cont.rend(); I != E;++I)

This is done automatically in C++20 mode using `std::ranges::reverse_view` but 
there are options to specify a different function to reverse iterator over a 
container.
This is the first step, down the line I'd like to possibly extend this support 
for array based loops

  for (unsigned I = Arr.size() - 1;I >=0;--I) Arr[I]...

Currently if you pass a reversing function with no header in the options it 
will just assume that the function exists, however as we have the ASTContext it 
may be as wise to check before applying, or at least lower the confidence level 
if we can't find it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82089

Files:
  clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
  clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.h
  clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst
  clang-tools-extra/test/clang-tidy/checkers/modernize-loop-convert-reverse.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize-loop-convert-reverse.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/modernize-loop-convert-reverse.cpp
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy -std=c++20 -check-suffix=RANGES %s modernize-loop-convert %t
+
+// RUN: %check_clang_tidy -check-suffix=CUSTOM %s modernize-loop-convert %t -- \
+// RUN:   -config="{CheckOptions: [ \
+// RUN:   {key: modernize-loop-convert.MakeReverseRangeFunction, value: 'llvm::reverse'}, \
+// RUN:   {key: modernize-loop-convert.MakeReverseRangeHeader, value: 'llvm/ADT/STLExtras.h'}]}"
+
+// Ensure the check doesn't transform reverse loops when not in c++20 mode or
+// when UseCxx20ReverseRanges has been disabled
+// RUN: clang-tidy %s -checks=-*,modernize-loop-convert -- -std=c++17 | count 0
+
+// RUN: clang-tidy %s -checks=-*,modernize-loop-convert -config="{CheckOptions: \
+// RUN: [{key: modernize-loop-convert.UseCxx20ReverseRanges, value: 'false'}] \
+// RUN: }" -- -std=c++20 | count 0
+
+// RUN: %check_clang_tidy -check-suffix=CUSTOM-NO-HEADER %s modernize-loop-convert %t -- \
+// RUN:   -config="{CheckOptions: [ \
+// RUN:   {key: modernize-loop-convert.MakeReverseRangeFunction, value: 'globalReverse'}]}"
+
+// Ensure we get a warning if we only supply one of the required reverse range arguments.
+// RUN: %check_clang_tidy -check-suffix=BAD-CUSTOM %s modernize-loop-convert %t -- \
+// RUN:   -config="{CheckOptions: [ \
+// RUN:   {key: modernize-loop-convert.MakeReverseRangeHeader, value: 'ranges/v3/views/reverse.hpp'}]}"
+
+// CHECK-MESSAGES-BAD-CUSTOM: warning: modernize-loop-convert: 'MakeReverseRangeHeader' is set but 'MakeReverseRangeFunction' is not, Disabling reverse loop transformation
+
+// Make sure appropiate headers are included
+// CHECK-FIXES-RANGES: #include 
+// CHECK-FIXES-CUSTOM: #include "llvm/ADT/STLExtras.h"
+
+// Make sure no header is included in this example
+// CHECK-FIXES-CUSTOM-NO-HEADER-NOT: #include
+
+template 
+struct reversable {
+  using iterator = T *;
+  using const_iterator = const T *;
+
+  iterator begin();
+  iterator end();
+  iterator rbegin();
+  iterator rend();
+
+  const_iterator begin() const;
+  const_iterator end() const;
+  const_iterator rbegin() const;
+  const_iterator rend() const;
+
+  const_iterator cbegin() const;
+  const_iterator cend() const;
+  const_iterator crbegin() const;
+  const_iterator crend() const;
+};
+
+template 
+void observe(const T &);
+template 
+void mutate(T &);
+
+void constContainer(const reversable &Numbers) {
+  // CHECK-MESSAGES-RANGES: :[[@LINE+3]]:3: warning: use range-based for loop instead
+  // CHECK-MESSAGES-CUSTOM: :[[@LINE+2]]:3: warning: use range-based for loop instead
+  // CHECK-MESSAGES-CUSTOM-NO-HEADER: :[[@LINE+1]]:3: warning: use range-based for loop instead
+  for (auto I = Numbers.rbegin(), E = Numbers.rend(); I != E; ++I) {
+observe(*I);
+//  CHECK-FIXES-RANGES: for (int Number : std::ranges::reverse_view(Numbers)) {
+// CHECK-FIXES-RANGES-NEXT: observe(Number);
+//  CHECK-FIXES-CUSTOM: for (int Number : llvm::reverse(Numbers)) {
+// CHECK-FIXES-CUSTOM-NEXT: observe(Number);
+//  CHECK-FIXES-CUSTOM-NO-HEADER: for (int Number : globalReverse(Numbers)) {
+// CHECK-FIXES-CUSTOM-NO-HEADER-NEXT: observe(Number);
+  }
+  // CHECK-MESSAGES-RANGES: :[[@LINE+3]]:3: warning: use range-based for loop instead
+  // CHECK-MESSAGES-CUSTOM: :[[@LINE+2]]:3: warning: use range-based for loop instead
+  // CHECK-MESSAGES-CUSTOM-NO-HEADER: :[[@LINE+1]]:3: warning:

[PATCH] D82086: [AST][RecoveryExpr] Fix a crash: don't attach error-type base specifiers.

2020-06-18 Thread Haojian Wu via Phabricator via cfe-commits
hokein marked an inline comment as done.
hokein added inline comments.



Comment at: clang/test/SemaCXX/invalid-template-base-specifier.cpp:6
+template 
+struct Crash : decltype(Foo(T())) { // expected-error {{no matching function 
for call to 'Foo'}}
+  Crash(){};

to explain what's happening here:

- when parsing this primary template class decl, we'll keep this base specifier 
(whose type is a normal dependent type, `DecltypeType 'decltype(Foo(T()))' 
dependent`)
- later clang instantiates `Crash` (creating a 
ClassTemplateSpecializationDecl), which will subst the base specifier with an 
instantiated base specifier (the type is `DecltypeType 
decltype((Foo, int()))` ), and the instantiated specifier is 
passed the sanity checks (`CheckBaseSpecifier`), and gets attached to the 
ClassTemplateSpecializationDecl.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82086



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


[PATCH] D82085: [TRE] markTails marks call sites as tailcalls though some of them are not.

2020-06-18 Thread Jay Foad via Phabricator via cfe-commits
foad added a comment.

> markTails function set IsTailcall bit for functions which are not
>  last calls:

It's OK to set "tail" on any call that satisfies these requirements (from 
https://llvm.org/docs/LangRef.html#call-instruction): "Both markers [tail and 
musttail] imply that the callee does not access allocas from the caller. The 
tail marker additionally implies that the callee does not access varargs from 
the caller."

"tail" does not mean that the call *must* be generated as a tail call. It just 
means that it's safe to generate it as a tail call if it turns out to be 
possible (e.g. if the compiler can prove that @noarg doesn't return, or if it 
can prove that all the code after the call to @noarg has no effect, or so on).

So I don't think there is a bug here that needs to be fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82085



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


[PATCH] D79755: Implement constexpr BinaryOperator for vector types

2020-06-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:2699
+RHSValue.getInt(), Result);
+  assert(LHSValue.getKind() == APValue::Float && "SHhuld be no other options");
+  return handleLogicalOpForVector(LHSValue.getFloat(), Opcode,

typo: Should



Comment at: clang/lib/AST/ExprConstant.cpp:2741
+  RHSValue.getInt(), Result);
+  assert(LHSValue.getKind() == APValue::Float && "SHhuld be no other options");
+  return handleCompareOpForVectorHelper(LHSValue.getFloat(), Opcode,

Typo: Should



Comment at: clang/lib/AST/ExprConstant.cpp:2754
+
+  const VectorType *VT = E->getType()->castAs();
+  unsigned NumElements = VT->getNumElements();

`const auto *`



Comment at: clang/lib/AST/ExprConstant.cpp:2778
+if (EltTy->isIntegerType()) {
+
+  APSInt EltResult{Info.Ctx.getIntWidth(EltTy),

Might as well remove the spurious whitespace.



Comment at: clang/lib/AST/ExprConstant.cpp:2782
+
+  if (BinaryOperator::isLogicalOp(Opcode)) {
+if (!handleLogicalOpForVector(LHSElt, Opcode, RHSElt, EltResult)) {

How about:
```
bool Success = true;
if (BinaryOperator::isLogicalOp(Opcode))
  Success = handleLogicalOpForVector(...);
else if (BinaryOperator::isComparisonOp(Opcode))
  Success = handleCompareOpForVector(...);
else
  Success = handleIntIntBinOp(...);

if (!Success) {
  Info.FFDiag(E);
  return false;
}
ResultElements.push_back(...);
```



Comment at: clang/lib/AST/ExprConstant.cpp:2799
+  }
+  ResultElements.push_back(APValue(EltResult));
+

`emplace_back()` instead?



Comment at: clang/lib/AST/ExprConstant.cpp:2800
+  ResultElements.push_back(APValue(EltResult));
+
+} else if (EltTy->isFloatingType()) {

Spurious newline?



Comment at: clang/lib/AST/ExprConstant.cpp:2813
+
+  ResultElements.push_back(APValue(LHSFloat));
+}

`emplace_back()` instead?



Comment at: clang/lib/AST/ExprConstant.cpp:9688
+bool VisitBinaryOperator(const BinaryOperator *E);
+// FIXME: Missing: unary -, unary ~,
 // conditional operator (for GNU conditional select),

Can you re-flow the rest of the comment now that it's been changed?


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

https://reviews.llvm.org/D79755



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


[PATCH] D81972: [NFC] Cleanup of EmitCXXGlobalInitFunc() and EmitCXXGlobalDtorFunc()

2020-06-18 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.

LGTM; thanks.


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

https://reviews.llvm.org/D81972



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


[PATCH] D80833: [CodeView] Add full repro to LF_BUILDINFO record

2020-06-18 Thread Alexandre Ganea via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG403f9537924b: [CodeView] Add full repro to LF_BUILDINFO 
record (authored by aganea).

Changed prior to commit:
  https://reviews.llvm.org/D80833?vs=268906&id=271698#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80833

Files:
  clang/test/CodeGen/debug-info-codeview-buildinfo.c
  lld/COFF/PDB.cpp
  lld/test/COFF/Inputs/pdb_lines_1_relative.yaml
  lld/test/COFF/Inputs/pdb_lines_2_relative.yaml
  lld/test/COFF/pdb-relative-source-lines.test
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -77,6 +77,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/Program.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
@@ -831,6 +832,30 @@
   return TypeTable.writeLeafType(SIR);
 }
 
+static std::string flattenCommandLine(ArrayRef Args,
+  StringRef MainFilename) {
+  std::string FlatCmdLine;
+  raw_string_ostream OS(FlatCmdLine);
+  StringRef LastArg;
+  for (StringRef Arg : Args) {
+if (Arg.empty())
+  continue;
+// The command-line shall not contain the file to compile.
+if (Arg == MainFilename && LastArg != "-main-file-name")
+  continue;
+// Also remove the output file.
+if (Arg == "-o" || LastArg == "-o") {
+  LastArg = Arg;
+  continue;
+}
+if (!LastArg.empty())
+  FlatCmdLine += " ";
+llvm::sys::printArg(OS, Arg, /*Quote=*/true);
+LastArg = Arg;
+  }
+  return FlatCmdLine;
+}
+
 void CodeViewDebug::emitBuildInfo() {
   // First, make LF_BUILDINFO. It's a sequence of strings with various bits of
   // build info. The known prefix is:
@@ -851,8 +876,14 @@
   getStringIdTypeIdx(TypeTable, MainSourceFile->getDirectory());
   BuildInfoArgs[BuildInfoRecord::SourceFile] =
   getStringIdTypeIdx(TypeTable, MainSourceFile->getFilename());
-  // FIXME: Path to compiler and command line. PDB is intentionally blank unless
-  // we implement /Zi type servers.
+  if (Asm->TM.Options.MCOptions.Argv0 != nullptr) {
+BuildInfoArgs[BuildInfoRecord::BuildTool] =
+getStringIdTypeIdx(TypeTable, Asm->TM.Options.MCOptions.Argv0);
+BuildInfoArgs[BuildInfoRecord::CommandLine] = getStringIdTypeIdx(
+TypeTable, flattenCommandLine(Asm->TM.Options.MCOptions.CommandLineArgs,
+  MainSourceFile->getFilename()));
+  }
+  // FIXME: PDB is intentionally blank unless we implement /Zi type servers.
   BuildInfoRecord BIR(BuildInfoArgs);
   TypeIndex BuildInfoIndex = TypeTable.writeLeafType(BIR);
 
Index: lld/test/COFF/pdb-relative-source-lines.test
===
--- lld/test/COFF/pdb-relative-source-lines.test
+++ lld/test/COFF/pdb-relative-source-lines.test
@@ -15,7 +15,9 @@
 void bar(void) {
 }
 
-$ clang-cl -Xclang -fdebug-compilation-dir -Xclang . -c -Z7 pdb_lines*.c
+$ clang-cl -fdebug-compilation-dir . -no-canonical-prefixes -c -Z7 pdb_lines*.c
+$ obj2yaml pdb_lines_1.obj > pdb_lines_1_relative.yaml
+$ obj2yaml pdb_lines_2.obj > pdb_lines_2_relative.yaml
 
 /pdbsourcepath: only sets the directory that relative paths are considered
 relative to, so this test needs to pass relative paths to lld-link for:
@@ -33,9 +35,20 @@
 RUN: yaml2obj %S/Inputs/pdb_lines_1_relative.yaml -o %t/pdb_lines_1_relative.obj
 RUN: yaml2obj %S/Inputs/pdb_lines_2_relative.yaml -o %t/pdb_lines_2_relative.obj
 RUN: ./lld-link -debug "-pdbsourcepath:c:\src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
-RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck %s
+RUN: llvm-pdbutil pdb2yaml -ipi-stream -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck %s
 RUN: ./lld-link -debug "-pdbsourcepath:/usr/src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
-RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=POSIX %s
+RUN: llvm-pdbutil pdb2yaml -ipi-stream -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=POSIX %s
+
+Also test the convoluted case at the end of remapBuildInfo() in lld/COFF/PDB.cpp
+The only drawback right now is that this edge case will create LF_BUILDINFO
+records with front references in the IPI stream. However the Visual Studio
+debugger takes the .PDB thusly created without any prob

Re: [clang] eb4c758 - [Matrix] Pass darwin tripe to SeamObjc test to fix windows bot failure.

2020-06-18 Thread Hans Wennborg via cfe-commits
Thanks! I see it also fails on ARM
(http://lab.llvm.org:8011/builders/clang-cmake-armv8-lld/builds/4438),
so my sneaky change to fix the test
(d8c612b7eabcc7ec399fad533d5beefa4ae08ac9) was not enough.

On Thu, Jun 18, 2020 at 2:36 PM Florian Hahn via cfe-commits
 wrote:
>
>
> Author: Florian Hahn
> Date: 2020-06-18T13:35:03+01:00
> New Revision: eb4c758fe4b60ae3779d3e9401d00ee1450ae41b
>
> URL: 
> https://github.com/llvm/llvm-project/commit/eb4c758fe4b60ae3779d3e9401d00ee1450ae41b
> DIFF: 
> https://github.com/llvm/llvm-project/commit/eb4c758fe4b60ae3779d3e9401d00ee1450ae41b.diff
>
> LOG: [Matrix] Pass darwin tripe to SeamObjc test to fix windows bot failure.
>
> Without the triple, the test fails on a windows bot
> (http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/16531/steps/stage%201%20check/logs/stdio)
>
> because of different full type widths (unsigned long long vs unsigned long)
>
> Added:
>
>
> Modified:
> clang/test/SemaObjC/matrix-type-builtins.m
>
> Removed:
>
>
>
> 
> diff  --git a/clang/test/SemaObjC/matrix-type-builtins.m 
> b/clang/test/SemaObjC/matrix-type-builtins.m
> index 8187bffae525..dc18905963e4 100644
> --- a/clang/test/SemaObjC/matrix-type-builtins.m
> +++ b/clang/test/SemaObjC/matrix-type-builtins.m
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -fsyntax-only -verify -fenable-matrix %s
> +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify 
> -fenable-matrix %s
>
>  typedef double double4x4 __attribute__((matrix_type(4, 4)));
>  typedef unsigned u4x4 __attribute__((matrix_type(4, 4)));
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79477: [clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics

2020-06-18 Thread Nathan James via Phabricator via cfe-commits
njames93 accepted this revision.
njames93 added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D79477



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


[PATCH] D82059: [clang-tidy] RenamerClangTidy group redecls into 1 warning.

2020-06-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!




Comment at: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp:383
 
+{
+  const auto *Canonical = cast(Decl->getCanonicalDecl());

No need to introduce a new local scope here (there's no RAII for it to matter).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82059



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


[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

> Balázs, could you please add the checker option within this patch?

I'd rather have this decision made globally. Like, for all //leaks//, or 
something like that. Our behavior should be consistent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81407



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


[PATCH] D82089: [clang-tidy] modernize-loop-convert reverse iteration support

2020-06-18 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

It'll be interesting to run improved check over LLVM code base.




Comment at: clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp:983
+const LangOptions &LangOpts)
+: IsEnabled(false), UseCxx20IfAvailable(UseCxx20IfAvailable),
+  Function(FunctionName), Header(HeaderName) {

I think //IsEnabled// should be initialized as member or in constructor body 
because of non-trivial logic.



Comment at: clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp:989
+<< "' is set but '" << MakeReverseRangeFunction
+<< "' is not, Disabling reverse loop transformation\n";
+return;

Something need to be changed in:  //not, Disabling// - comma to dot or 
capitalization.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst:123
+
+The converter is also capable of transforming iterator loops which use 
+``rbegin`` and ``rend`` for looping backwards over a container. Out of the box 

Please separate with empty line.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst:141
+   class with ``begin`` and ``end`` methods methods that call the ``rbegin`` 
and
+   ``rend`` methods respectively. Common examples are ranges::reverse_view and 
+   llvm::reverse.

Please highlight ranges::reverse_view and llvm::reverse with double back-ticks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82089



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


[PATCH] D81930: [AArch64] Add -mbti flag.

2020-06-18 Thread Daniel Kiss via Phabricator via cfe-commits
danielkiss planned changes to this revision.
danielkiss added a comment.

I got some comment internally, the -mbti might suggest it enables the bti 
feature so I'm going to rename the flag to -mmark-bti-property.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81930



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


[PATCH] D82081: [z/OS] Add binary format goff and operating system zos to the triple

2020-06-18 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:258
 return CGOpts.DataSections && !CGOpts.DisableIntegratedAS;
+  case Triple::GOFF:
+llvm::report_fatal_error("ASan not implemented for GOFF.");

Minor nit: GOFF appears after XCOFF in most of the "unsorted" lists.



Comment at: llvm/include/llvm/Support/TargetRegistry.h:518
+case Triple::GOFF:
+  report_fatal_error("GOFF MCObjectStreamer not implemented yet."); 
 }

The coding guidelines have been updated to clarify the formatting of 
`report_fatal_error` messages:
https://llvm.org/docs/CodingStandards.html#id14



Comment at: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:4731
 return ".llvmbc";
+  case Triple::GOFF:
+llvm_unreachable("GOFF is not yet implemented");

Minor nit: GOFF appears after XCOFF in most of the "unsorted" lists.



Comment at: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:4749
 return ".llvmcmd";
+  case Triple::GOFF:
+llvm_unreachable("GOFF is not yet implemented");

Minor nit: GOFF appears after XCOFF in most of the "unsorted" lists.



Comment at: llvm/lib/Support/Triple.cpp:657
   case Triple::XCOFF: return "xcoff";
+  case Triple::GOFF:  return "goff";
   }

Minor nit: Maintain alphabetical order for lists that are already sorted.



Comment at: llvm/lib/Support/Triple.cpp:726
+  case Triple::systemz:
+if (T.getOS() == Triple::ZOS)
+  return Triple::GOFF;

Is it beneficial to express the check this way instead of with `isOSzOS`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82081



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


[PATCH] D82092: [analyzer] Handle `\l` symbol in Windows specific file paths in exploded-graph-rewriter

2020-06-18 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision.
ASDenysPetrov added reviewers: NoQ, vsavchenko.
ASDenysPetrov added a project: clang.
Herald added subscribers: cfe-commits, Charusso, dkrupp, donat.nagy, Szelethus, 
mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.

Handle `\l` separately for Windows, because macros `__FILE__` produces Windows 
specific delimiters `\` and sometimes it happens when directory name starts 
from the letter `l`.

Fix: Use regex on Windows for replacing all `\l` (like `,\l`, `}\l`, `[\l`) 
except `\\l`, because `__FILE__` containes multiple `\` before `\l` and it 
helps to distinguish this case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82092

Files:
  
clang/test/Analysis/exploded-graph-rewriter/l_directory_from_l/win_file_macros.cpp
  clang/utils/analyzer/exploded-graph-rewriter.py


Index: clang/utils/analyzer/exploded-graph-rewriter.py
===
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -368,8 +368,7 @@
 self.root_id = node_id
 # Note: when writing tests you don't need to escape everything,
 # even though in a valid dot file everything is escaped.
-node_label = result.group(2).replace('\\l', '') \
-.replace(' ', '') \
+node_label = result.group(2).replace(' ', '') \
 .replace('\\"', '"') \
 .replace('\\{', '{') \
 .replace('\\}', '}') \
@@ -378,6 +377,15 @@
 .replace('\\<', '<') \
 .replace('\\>', '>') \
 .rstrip(',')
+# Handle `\l` separately for Windows, because macros __FILE__ 
produces
+# Windows specific delimiters `\` and sometimes it happens
+# when directory name starts with the letter `l`.
+if sys.platform == 'win32':
+# Find all `\l` (like `,\l`, `}\l`, `[\l`) except `\\l`,
+# because __FILE__ containes multiple `\` before `\l`.
+node_label = re.sub(r'(?Index: clang/utils/analyzer/exploded-graph-rewriter.py
===
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -368,8 +368,7 @@
 self.root_id = node_id
 # Note: when writing tests you don't need to escape everything,
 # even though in a valid dot file everything is escaped.
-node_label = result.group(2).replace('\\l', '') \
-.replace(' ', '') \
+node_label = result.group(2).replace(' ', '') \
 .replace('\\"', '"') \
 .replace('\\{', '{') \
 .replace('\\}', '}') \
@@ -378,6 +377,15 @@
 .replace('\\<', '<') \
 .replace('\\>', '>') \
 .rstrip(',')
+# Handle `\l` separately for Windows, because macros __FILE__ produces
+# Windows specific delimiters `\` and sometimes it happens
+# when directory name starts with the letter `l`.
+if sys.platform == 'win32':
+# Find all `\l` (like `,\l`, `}\l`, `[\l`) except `\\l`,
+# because __FILE__ containes multiple `\` before `\l`.
+node_label = re.sub(r'(?___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77062: [analyzer] Added check for unacceptable equality operation between Loc and NonLoc types

2020-06-18 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.

Ok, this simplification is obviously correct. I don't mind landing it 
regardless of the crash. If it gets rid of the crash, even better.

I'm still worried about the root cause of the crash though. I recommend to add 
an assertion into `CStringChecker::assumeZero()` that's equivalent to whatever 
assertion was previously crashing, and continue debugging from there to see if 
it uncovers more bugs in the checker.


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

https://reviews.llvm.org/D77062



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


[PATCH] D78903: [Driver] Add option -fproc-stat-report

2020-06-18 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff marked 2 inline comments as done.
sepavloff added inline comments.



Comment at: clang/lib/Driver/Driver.cpp:3814
+  llvm::raw_fd_ostream OS(StatReportFile, EC, 
llvm::sys::fs::OF_Append);
+  if (!EC) {
+if (auto L = OS.tryToLock())

aganea wrote:
> sepavloff wrote:
> > aganea wrote:
> > > If the goal is to report accurate information, maybe it's worth looping 
> > > here a bit in case of an error, to give the chance to other clang.exe 
> > > instances to release the file lock? What do you think? (same for 
> > > `tryToLock`)
> > Actually this method makes blocking request and waits infinitely.
> > 
> > There is long discussion of how this lock helper must be implemented: 
> > https://reviews.llvm.org/D79066. Finally the variant with timeout was 
> > removed, only blocking one remained. The method has prefix `try` because it 
> > requires handling result value.
> > 
> > If you think the name or interface might be better, you can participate in 
> > the discussion in D79066, that patch isn't committed yet.
> Thanks!
> 
> In the same way as above, I think the code will read better if it did early 
> exits. Also, I don't think you need `handleAllErrors`, you could replace it 
> with `toString` and report the error code the user:
> ```
> if (EC)
>   return;
> auto L=OS.tryToLock();
> if (!L) {
>   llvm::errs() ... << toString(L.takeError());
>   return;
> }
> OS << Buffer;
> ```
It becomes better. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78903



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


[clang] cab3fc5 - Fix linker error in clang-fuzzer following 89ea0b05207d45c145fb525df554b3b986ae379b.

2020-06-18 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-06-18T10:07:31-04:00
New Revision: cab3fc53d2e173243a462e9c8e914af58ddbeaba

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

LOG: Fix linker error in clang-fuzzer following 
89ea0b05207d45c145fb525df554b3b986ae379b.

This fixes:
tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o:handle_cxx.cpp:function
 clang_fuzzer::HandleCXX(std::__cxx11::basic_string, std::allocator > const&, char const*, 
std::vector > const&): error: 
undefined reference to 
'clang::tooling::newInvocation(clang::DiagnosticsEngine*, 
llvm::SmallVector const&)'

Added: 


Modified: 
clang/include/clang/Tooling/Tooling.h
clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp

Removed: 




diff  --git a/clang/include/clang/Tooling/Tooling.h 
b/clang/include/clang/Tooling/Tooling.h
index ced2405f6e83..4fb0c18be95e 100644
--- a/clang/include/clang/Tooling/Tooling.h
+++ b/clang/include/clang/Tooling/Tooling.h
@@ -505,7 +505,8 @@ void 
addTargetAndModeForProgramName(std::vector &CommandLine,
 
 /// Creates a \c CompilerInvocation.
 CompilerInvocation *newInvocation(DiagnosticsEngine *Diagnostics,
-  const llvm::opt::ArgStringList &CC1Args);
+  const llvm::opt::ArgStringList &CC1Args,
+  const char *const BinaryName);
 
 } // namespace tooling
 

diff  --git a/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp 
b/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
index 32d351f4c3e9..14204021d262 100644
--- a/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
+++ b/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
@@ -37,7 +37,7 @@ void clang_fuzzer::HandleCXX(const std::string &S,
   IntrusiveRefCntPtr(new DiagnosticIDs()), 
&*DiagOpts,
   &Diags, false);
   std::unique_ptr Invocation(
-  tooling::newInvocation(&Diagnostics, CC1Args));
+  tooling::newInvocation(&Diagnostics, CC1Args, /*BinaryName=*/nullptr));
   std::unique_ptr Input =
   llvm::MemoryBuffer::getMemBuffer(S);
   Invocation->getPreprocessorOpts().addRemappedFile(FileName,



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


[clang] 8374bf4 - [CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 'pdb' entry which was previously a null reference, now an empty string.

2020-06-18 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2020-06-18T10:07:30-04:00
New Revision: 8374bf43634725dc02a262a77b5f940fca25938c

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

LOG: [CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 
'pdb' entry which was previously a null reference, now an empty string.

Previously, the DIA SDK didn't like the empty reference in the 'pdb' entry.

Added: 


Modified: 
clang/test/CodeGen/debug-info-codeview-buildinfo.c
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/test/DebugInfo/COFF/build-info.ll
llvm/test/DebugInfo/COFF/global-type-hashes.ll
llvm/test/DebugInfo/COFF/types-basic.ll
llvm/test/DebugInfo/COFF/types-data-members.ll

Removed: 




diff  --git a/clang/test/CodeGen/debug-info-codeview-buildinfo.c 
b/clang/test/CodeGen/debug-info-codeview-buildinfo.c
index d08fadbbf1a9..5d37162b7325 100644
--- a/clang/test/CodeGen/debug-info-codeview-buildinfo.c
+++ b/clang/test/CodeGen/debug-info-codeview-buildinfo.c
@@ -1,6 +1,6 @@
 // RUN: %clang_cl /c /Z7 /Fo%t.obj -- %s
 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s
-// RUN: %clang_cl /c /Z7 %s /Fo%t.obj -fdebug-compilation-dir .
+// RUN: %clang_cl /c /Z7 /Fo%t.obj -fdebug-compilation-dir . -- %s
 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix RELATIVE
 
 int main() { return 42; }
@@ -9,13 +9,14 @@ int main() { return 42; }
 // CHECK: 
 // CHECK: 0x[[PWD:.+]] | LF_STRING_ID [size = {{.+}}] ID: , String: 
[[PWDVAL:.+]]
 // CHECK: 0x[[FILEPATH:.+]] | LF_STRING_ID [size = {{.+}}] ID: , 
String: [[FILEPATHVAL:.+[\\/]debug-info-codeview-buildinfo.c]]
+// CHECK: 0x[[ZIPDB:.+]] | LF_STRING_ID [size = {{.+}}] ID: , String:
 // CHECK: 0x[[TOOL:.+]] | LF_STRING_ID [size = {{.+}}] ID: , String: 
[[TOOLVAL:.+[\\/]clang.*]]
 // CHECK: 0x[[CMDLINE:.+]] | LF_STRING_ID [size = {{.+}}] ID: , 
String: "-cc1
 // CHECK: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
 // CHECK:  0x[[PWD]]: `[[PWDVAL]]`
 // CHECK:  0x[[TOOL]]: `[[TOOLVAL]]`
 // CHECK:  0x[[FILEPATH]]: `[[FILEPATHVAL]]`
-// CHECK:  : ``
+// CHECK:  0x[[ZIPDB]]: ``
 // CHECK:  0x[[CMDLINE]]: `"-cc1
 
 // RELATIVE:   Types (.debug$T)

diff  --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp 
b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 7f47849e3aa8..cf3c38c57f6d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -849,10 +849,11 @@ static std::string flattenCommandLine(ArrayRef Args,
   continue;
 }
 if (!LastArg.empty())
-  FlatCmdLine += " ";
+  OS << " ";
 llvm::sys::printArg(OS, Arg, /*Quote=*/true);
 LastArg = Arg;
   }
+  OS.flush();
   return FlatCmdLine;
 }
 
@@ -876,6 +877,9 @@ void CodeViewDebug::emitBuildInfo() {
   getStringIdTypeIdx(TypeTable, MainSourceFile->getDirectory());
   BuildInfoArgs[BuildInfoRecord::SourceFile] =
   getStringIdTypeIdx(TypeTable, MainSourceFile->getFilename());
+  // FIXME: PDB is intentionally blank unless we implement /Zi type servers.
+  BuildInfoArgs[BuildInfoRecord::TypeServerPDB] =
+  getStringIdTypeIdx(TypeTable, "");
   if (Asm->TM.Options.MCOptions.Argv0 != nullptr) {
 BuildInfoArgs[BuildInfoRecord::BuildTool] =
 getStringIdTypeIdx(TypeTable, Asm->TM.Options.MCOptions.Argv0);
@@ -883,7 +887,6 @@ void CodeViewDebug::emitBuildInfo() {
 TypeTable, 
flattenCommandLine(Asm->TM.Options.MCOptions.CommandLineArgs,
   MainSourceFile->getFilename()));
   }
-  // FIXME: PDB is intentionally blank unless we implement /Zi type servers.
   BuildInfoRecord BIR(BuildInfoArgs);
   TypeIndex BuildInfoIndex = TypeTable.writeLeafType(BIR);
 

diff  --git a/llvm/test/DebugInfo/COFF/build-info.ll 
b/llvm/test/DebugInfo/COFF/build-info.ll
index 94f006c3b093..983aa22214bc 100644
--- a/llvm/test/DebugInfo/COFF/build-info.ll
+++ b/llvm/test/DebugInfo/COFF/build-info.ll
@@ -5,7 +5,7 @@
 ; CHECK-NEXT:  0x{{.*}}: `D:\src\scopes\clang`
 ; CHECK-NEXT:  : ``
 ; CHECK-NEXT:  0x{{.*}}: `D:\src\scopes\foo.cpp`
-; CHECK-NEXT:  : ``
+; CHECK-NEXT:  0x{{.*}}: ``
 ; CHECK-NEXT:  : ``
 
 ; CHECK: {{.*}} | S_BUILDINFO [size = 8] BuildId = `[[INFO_IDX]]`

diff  --git a/llvm/test/DebugInfo/COFF/global-type-hashes.ll 
b/llvm/test/DebugInfo/COFF/global-type-hashes.ll
index 70f9df156a5b..3c6c27301b20 100644
--- a/llvm/test/DebugInfo/COFF/global-type-hashes.ll
+++ b/llvm/test/DebugInfo/COFF/global-type-hashes.ll
@@ -295,7 +295,8 @@ attributes #2 = { noinline nounwind optnone 
"correctly-rounded-divide-sqrt-fp-ma
 ; YAML: - 4470750F2E319329
 ; YAML:  

[PATCH] D81254: [analyzer] Produce symbolic values for C-array elements

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Here are some examples:

  void test1(int *a, int index1, int index2) {
int x = a[index1];
a[index2] = 0;
int y = a[index1];
  
// In reality we don't know but after your patch
// we're confident that this is "TRUE".
clang_analyzer_eval(x == y);
  }
  
  void foo(int *a); // Potentially modifies elements of 'a'.
  
  void test2(int *a, int index) {
int x = a[index];
foo(a);
int y = a[index];
  
// In reality we don't know but after your patch
// we're confident that this is "TRUE".
clang_analyzer_eval(x == y);
  }


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

https://reviews.llvm.org/D81254



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


[PATCH] D82026: [OPENMP50]Allow nonmonotonic modifier for all schedule kinds.

2020-06-18 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82026



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


[PATCH] D81478: [OPENMP50]Codegen for scan directives in parallel for regions.

2020-06-18 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM and cleaner than my sketch, thanks a lot :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81478



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


[PATCH] D78903: [Driver] Add option -fproc-stat-report

2020-06-18 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea accepted this revision.
aganea added a comment.
This revision is now accepted and ready to land.

Thanks again for the changes @sepavloff! Looks good to me!
You might wait a bit before commiting, if there are further comments.




Comment at: clang/lib/Driver/Driver.cpp:3806
+else
+  Command::printArg(Out, Cmd.getOutputFilenames().front(), true);
+Out << ','

Please note that I've just moved this function to `llvm::sys::printArg`, you 
will need to update before commit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78903



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


[PATCH] D81593: [analyzer] SATest: Make docker interfaces transparent

2020-06-18 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.

Yay transparency.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81593



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


[PATCH] D77658: [analyzer] StdLibraryFunctionsChecker: Add sanity checks for constraints

2020-06-18 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment.

In D77658#2065174 , @MaskRay wrote:

> `arc` adds many unneeded tags from Phabricator. You can drop `Reviewers:` 
> `Subscribers:` `Tags:` and the text `Summary:` with the following script:
>
>   arcfilter () {
> arc amend
> git log -1 --pretty=%B | awk '/Reviewers:|Subscribers:/{p=1} /Reviewed 
> By:|Differential Revision:/{p=0} !p && !/^Summary:$/ {sub(/^Summary: 
> /,"");print}' | git commit --amend --date=now -F -
>   }
>   
>
> `Reviewed By: ` is considered important by some people 
> (https://lists.llvm.org/pipermail/llvm-dev/2020-January/137889.html). You 
> should keep the tag. (I started to use `--date=now` because some people find 
> author date != committer date annoying. The committer date is usually what 
> people care.))


Thanks for pointing this out and for the script! I'll try to omit unnecessary 
tags from arc in the future.




Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:697
 if (auto *FD = dyn_cast(D)) {
-  if (S.matchesSignature(FD)) {
+  if (S.Sign.matches(FD) && S.validate(FD)) {
 auto Res = Map.insert({FD->getCanonicalDecl(), S});

balazske wrote:
> martong wrote:
> > balazske wrote:
> > > martong wrote:
> > > > Szelethus wrote:
> > > > > This looks a bit odd, we're checking whether the function matches, 
> > > > > and than we validate right after? Shouldn't we just not match the 
> > > > > `FD` if it isn't valid?
> > > > Yeah, ok, I moved the validation back into `matchesSignature`.
> > > I think these are not related, there should be signature match and 
> > > validness check, but it is natural to check first the signature, then the 
> > > validness.
> > @Szelethus, @balazske : I agree with both of you so I renamed 
> > `matchesSignature` to `matches`, which is a shorthand to the the signature 
> > match and then the validity check (and added a comment):
> > ```
> > // Returns true if the summary should be applied to the given function.
> > bool matches(const FunctionDecl *FD) const {
> >   return Sign.matches(FD) && validateByConstraints(FD);
> > }
> > ```
> Suggestion: Maybe we can have one function for `matches` and 
> `setFunctionDecl` (set it if matches). We do not want to change the function 
> decl later anyway, and not to something that does not match.
Alright, I renamed `matches` to `matchesAndSet` and we set the FD in this 
function now. Also `setFunctionDecl` is removed.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:68
   /// We avoid nesting types here because each additional qualifier
   /// would need to be repeated in every function spec.
+  class Summary;

balazske wrote:
> This text above is not the documentation of `Summary` (is it attached to 
> `Summary` by doxygen?). Probably not `///` is needed, only `//`. And it is 
> probably out of date now, at least I can not understand immediately what is 
> it about (what typedef's are these, what kind of "nesting types"). 
Ok, I removed this outdated comment.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:116
+
+/// Do sanity check on the constraint.
+bool checkValidity(const FunctionDecl *FD) const {

balazske wrote:
> We check here that a function is a suitable candidate to be used with the 
> constraint? (We select a function for the constraint, not a constraint for a 
> function.) Maybe a better description would help to clarify this.
We check here, whether the constraint is malformed or not. It is malformed if 
the specified argument has a mismatch with the given FunctionDecl (e.g. the arg 
number is out-of-range of the function's arguments list).

Added a comment in the code about that.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:571
   // Apply case/branch specifications.
-  for (const auto &VRS : Summary.CaseConstraints) {
+  for (const auto &VRS : Summary.getCaseConstraints()) {
 ProgramStateRef NewState = State;

balazske wrote:
> It may be better to see type of `VRS` instead of `auto` (and know what the 
> `VRS` abbrevation means, why not `CC` for case constraint and not `VC` for 
> `ValueConstraint`). Same for `VR` below.
Indeed, I agree. Removed `auto` and refreshed the outdated variable names.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77658



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


[PATCH] D81571: [analyzer] SATest: Add initial docker infrastructure

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/utils/analyzer/Dockerfile:10
+
+# newer CMake is required by LLVM
+RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 
2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg 
>/dev/null

Ouch. I'm pretty bad with docker but is it possible to simply take a newer 
ubuntu?



Comment at: clang/utils/analyzer/Dockerfile:15
+# test system dependencies
+RUN apt-get update && apt-get install -y \
+git \

Maybe put `apt-get update` on a separate line?

Also i think you mentioned offline that you want to freeze package versions 
here, can you add a FIXME?



Comment at: clang/utils/analyzer/entrypoint.py:31
+
+CMAKE_COMMAND = "cmake -G Ninja -DCMAKE_BUILD_TYPE=Release " \
+"-DCMAKE_INSTALL_PREFIX=/analyzer -DLLVM_TARGETS_TO_BUILD=X86 " \

`-DLLVM_ENABLE_ASSERTIONS=ON`???



Comment at: clang/utils/analyzer/entrypoint.py:35
+"-DLLVM_ENABLE_TERMINFO=OFF -DCLANG_ENABLE_ARCMT=OFF " \
+"-DCLANG_ENABLE_STATIC_ANALYZER=ON"
+

I think this one's on by default but i guess it wouldn't hurt^^


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81571



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


[PATCH] D81592: [analyzer] SATest: Add a set of initial projects for testing

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/utils/analyzer/.dockerignore:2
+./projects
\ No newline at end of file


NO NeWlINE At EnD oF fILE



Comment at: clang/utils/analyzer/projects/box2d/run_static_analyzer.cmd:1
+cmake . -DCMAKE_BUILD_TYPE=Release -Bbuild -GNinja
+cmake --build build

Is there a flag to enable assertions or something like that? Usually we 
recommend people to enable assertions during analysis. It's also valuable to 
test that assertions are actually working.

Disabling assertions is in fact relatively good for reference results testing 
because all the false positives that they suppress are suddenly visible, and 
therefore the signal we receive from such testing is amplified significantly. 
But i wouldn't force such workflow on our solution-for-everyone because that 
requires a certain level of masochism in order to distinguish between "my patch 
introduced a false positive and it's bad" and "my patch introduced a false 
positive but it would have been suppressed by assertions and we do actually 
want to emit the warning in absence of assertions so it's good".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81592



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


[PATCH] D81572: [analyzer] SATest: Add convenience 'docker' command

2020-06-18 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.

Yay!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81572



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


[PATCH] D79477: [clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics

2020-06-18 Thread hyd-dev via Phabricator via cfe-commits
hyd-dev added a comment.

I don't have commit access. @njames93 Could you please commit it for me 
(`hyd-dev `)? Thanks!


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

https://reviews.llvm.org/D79477



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


[PATCH] D82019: [OPENMP]Fix PR46357: Do not allow types declarations in pragmas.

2020-06-18 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

I agree it is not a good idea. Let's hope no one will complain :) LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82019



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


[PATCH] D81598: [analyzer] SATest: Add an easy option to connect to docker for debugging

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/utils/analyzer/entrypoint.py:23
+while True:
+sleep(3600)
+

I request comments (:


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81598



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


[PATCH] D82092: [analyzer] Handle `\l` symbol in Windows specific file paths in exploded-graph-rewriter

2020-06-18 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment.

Even though it doesn't seem that necessary, I would still vote to comply with 
`clang-format` in tests as well.
Other then that looks good to me!

Additionally, I want to make a note that we are not really working hard on 
keeping all the scripts and the analyzer itself to be fully functional on 
Windows.  It can limit the user base and also prevent new developers from 
participating in the project.  So, thank you for cleaning that up and for 
making it easier for other people to join our community :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82092



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


[PATCH] D81601: [analyzer] SATest: Use logger in single-threaded mode as well

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/utils/analyzer/SATestBuild.py:650
 
 Logger = logging.getLogger(test_info.project.name)
 LOCAL.stdout = StreamToLogger(Logger, logging.INFO)

Now that you have a global `Logger`, is this still relevant?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81601



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


[PATCH] D81596: [analyzer] SATest: Do not re-run CMake in Docker if not needed

2020-06-18 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.

Yeet!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81596



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


[PATCH] D81595: [analyzer] SATest: Make main script Python2 compatible

2020-06-18 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.

Woohoo!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81595



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


[PATCH] D81599: [analyzer] SATest: Add 5 more projects for testing

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Like in D81592 , we should take a look at 
enabling assertions. If this boils down to `-DCMAKE_BUILD_TYPE=Debug` then so 
be it(?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81599



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


[PATCH] D81571: [analyzer] SATest: Add initial docker infrastructure

2020-06-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/utils/analyzer/Dockerfile:15
+# test system dependencies
+RUN apt-get update && apt-get install -y \
+git \

NoQ wrote:
> Maybe put `apt-get update` on a separate line?
> 
> Also i think you mentioned offline that you want to freeze package versions 
> here, can you add a FIXME?
> can you add a FIXME?

Wait, you already did that in D81600, nvm.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81571



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


  1   2   3   >