[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2020-12-12 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D92409#2450550 , @thopre wrote:

> In D92409#2426196 , @thopre wrote:
>
>> Is there a way to disable it from the header? I've noticed this warning when 
>> compiling an application using libclang with g++. So I'm looking for a fix 
>> outside clang's build system which is not used in that case.
>
> Ping?

`#pragma GCC diagnostic ignored` 
(https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html) can do it. Now, we 
can't reasonably guarantee that Clang headers won't cause arbitrary broken 
warnings to fire, so there's a judgment call here on the extent to which we 
should carry changes to support use of such warning flags (versus expecting the 
code including the header to disable the warning). In this case, it's probably 
worth it, though, because the warning in question is part of GCC's `-Wall`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92409

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


[PATCH] D93084: [VE] Optimize toolchain regression test

2020-12-12 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Thanks. The tests still work fine on my machine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93084

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


LLVM buildmaster will be restarted tonight

2020-12-12 Thread Galina Kistanova via cfe-commits
 Hello everyone,

LLVM buildmaster will be restarted at 9PM PST today.

Thanks

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


[PATCH] D93084: [VE] Optimize toolchain regression test

2020-12-12 Thread Kazushi Marukawa via Phabricator via cfe-commits
kaz7 updated this revision to Diff 311423.
kaz7 added a comment.

Rebase and update following suggestions.  Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93084

Files:
  clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crt1.o
  clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crti.o
  clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crtn.o
  
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
  
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
  
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/libclang_rt.builtins-ve.a
  clang/test/Driver/ve-toolchain.c
  clang/test/Driver/ve-toolchain.cpp

Index: clang/test/Driver/ve-toolchain.cpp
===
--- clang/test/Driver/ve-toolchain.cpp
+++ clang/test/Driver/ve-toolchain.cpp
@@ -7,111 +7,125 @@
 // RUN: %clangxx -### -g -target ve %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
 // DWARF_VER: "-dwarf-version=4"
 
-///-
-/// Checking VE specific option
-
-// RUN: %clangxx -### -target ve %s 2>&1 | FileCheck -check-prefix=VENLDOPT %s
-// VENLDOPT: nld{{.*}} "-z" "max-page-size=0x400"
-
 ///-
 /// Checking include-path
 
-// RUN: %clangxx -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFINC %s
+// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
+// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: 2>&1 | FileCheck -check-prefix=DEFINC %s
 // DEFINC: clang{{.*}} "-cc1"
-// DEFINC: "-nostdsysteminc"
-// DEFINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include/c++/v1"
-// DEFINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
-// DEFINC: "-internal-isystem" "/opt/nec/ve/include"
-
-// RUN: %clangxx -### -target ve %s -nostdlibinc 2>&1 | \
-// RUN:FileCheck -check-prefix=NOSTDLIBINC %s
+// DEFINC-SAME: "-nostdsysteminc"
+// DEFINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// DEFINC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
+// DEFINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1"
+// DEFINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
+// DEFINC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include"
+
+// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
+// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: -nostdlibinc 2>&1 | FileCheck -check-prefix=NOSTDLIBINC %s
 // NOSTDLIBINC: clang{{.*}} "-cc1"
-// NOSTDLIBINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include/c++/v1"
-// NOSTDLIBINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
-// NOSTDLIBINC-NOT: "-internal-isystem" "/opt/nec/ve/include"
-
-// RUN: %clangxx -### -target ve %s -nobuiltininc 2>&1 | \
-// RUN:FileCheck -check-prefix=NOBUILTININC %s
+// NOSTDLIBINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// NOSTDLIBINC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
+// NOSTDLIBINC-NOT: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1"
+// NOSTDLIBINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
+// NOSTDLIBINC-NOT: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include"
+
+// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
+// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: -nobuiltininc 2>&1 | FileCheck -check-prefix=NOBUILTININC %s
 // NOBUILTININC: clang{{.*}} "-cc1"
-// NOBUILTININC: "-nobuiltininc"
-// NOBUILTININC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include/c++/v1"
-// NOBUILTININC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
-// NOBUILTININC: "-internal-isystem" "/opt/nec/ve/include"
-
-// RUN: %clangxx -### -target ve %s -nostdinc 2>&1 | \
-// RUN:FileCheck -check-prefix=NOSTDINC %s
+// NOBUILTININC-SAME: "-nobuiltininc"
+// NOBUILTININC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// NOBUILTININC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
+// NOBUILTININC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include/c++/v1"
+// NOBUILTININC-NOT: "-internal-isystem" "[[RESOURCE_DIR]]/include"
+// NOBUILTININC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include"
+
+// RUN: %clangxx -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
+// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: -nostdinc 2>&1 | FileCheck -check-prefix=NOSTDINC %s
 // NOSTDINC: clang{{.*}} "-cc1"
-// NOSTDINC: "-nobuiltininc"
-// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include/c++/v1"
-// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
-// NOSTDINC-NOT: "-internal-isystem" "/opt/nec/ve/include"
-
-// RUN: %clangxx -### -target ve %s -nostdinc++ 2>&1 | \
-// RUN:FileCheck -check-prefix=NOSTDINCXX %s
+// 

[PATCH] D93084: [VE] Optimize toolchain regression test

2020-12-12 Thread Kazushi Marukawa via Phabricator via cfe-commits
kaz7 added a comment.

Thank you for suggestions.




Comment at: clang/test/Driver/ve-toolchain.cpp:115
+// DEF-SAME: "-z" "max-page-size=0x400"
+// DEF-SAME: "crtbegin.o"
+// DEF-SAME: "-lc++" "-lc++abi" "-lunwind" "-lpthread" "-ldl"

MaskRay wrote:
> You probably should add an empty file in `basic_ve_tree` so that users who 
> don't have a system ve toolchain (most upstream developers) have 
> `"...basic_ve_tree/...crtbegin.o"` instead of `"crtbegin.o"`
Thank you for remainding it.  I've forgotten them.  We use crtbegin.o from 
compiler-rt, so I will add empty files to RESOURCE_DIR also.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93084

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


[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2020-12-12 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added a comment.

In D92409#2426196 , @thopre wrote:

> In D92409#2426188 , @rsmith wrote:
>
>> Let's just disable this broken GCC warning. IIRC, the corresponding clang 
>> warning covers the actual bugs caused by line continuation in comments, and 
>> doesn't warn if the next line begins with a `//`.
>
> Is there a way to disable it from the header? I've noticed this warning when 
> compiling an application using libclang with g++. So I'm looking for a fix 
> outside clang's build system which is not used in that case.

Ping?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92409

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


[PATCH] D93170: [clang-format][NFC] Expand BreakBeforeBraces examples

2020-12-12 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks created this revision.
HazardyKnusperkeks added a reviewer: MyDeveloperDay.
HazardyKnusperkeks added a project: clang-format.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93170

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h

Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -720,163 +720,427 @@
   enum BraceBreakingStyle {
 /// Always attach braces to surrounding context.
 /// \code
-///   try {
-/// foo();
-///   } catch () {
+///   namespace N {
+///   enum E {
+/// E1,
+/// E2,
+///   };
+///
+///   class C {
+///   public:
+/// C();
+///   };
+///
+///   bool baz(int i) {
+/// try {
+///   do {
+/// switch (i) {
+/// case 1: {
+///   foobar();
+///   break;
+/// }
+/// default: {
+///   break;
+/// }
+/// }
+///   } while (--i);
+///   return true;
+/// } catch (...) {
+///   handleError();
+///   return false;
+/// }
 ///   }
-///   void foo() { bar(); }
-///   class foo {};
-///   if (foo()) {
-///   } else {
+///
+///   void foo(bool b) {
+/// if (b) {
+///   baz(2);
+/// } else {
+///   baz(5);
+/// }
 ///   }
-///   enum X : int { A, B };
+///
+///   void bar() { foo(true); }
+///   } // namespace N
 /// \endcode
 BS_Attach,
 /// Like ``Attach``, but break before braces on function, namespace and
 /// class definitions.
 /// \code
-///   try {
-/// foo();
-///   } catch () {
-///   }
-///   void foo() { bar(); }
-///   class foo
+///   namespace N
 ///   {
+///   enum E {
+/// E1,
+/// E2,
 ///   };
-///   if (foo()) {
-///   } else {
+///
+///   class C
+///   {
+///   public:
+/// C();
+///   };
+///
+///   bool baz(int i)
+///   {
+/// try {
+///   do {
+/// switch (i) {
+/// case 1: {
+///   foobar();
+///   break;
+/// }
+/// default: {
+///   break;
+/// }
+/// }
+///   } while (--i);
+///   return true;
+/// } catch (...) {
+///   handleError();
+///   return false;
+/// }
+///   }
+///
+///   void foo(bool b)
+///   {
+/// if (b) {
+///   baz(2);
+/// } else {
+///   baz(5);
+/// }
 ///   }
-///   enum X : int { A, B };
+///
+///   void bar() { foo(true); }
+///   } // namespace N
 /// \endcode
 BS_Linux,
 /// Like ``Attach``, but break before braces on enum, function, and record
 /// definitions.
 /// \code
-///   try {
-/// foo();
-///   } catch () {
-///   }
-///   void foo() { bar(); }
-///   class foo
+///   namespace N {
+///   enum E
 ///   {
+/// E1,
+/// E2,
 ///   };
-///   if (foo()) {
-///   } else {
+///
+///   class C
+///   {
+///   public:
+/// C();
+///   };
+///
+///   bool baz(int i)
+///   {
+/// try {
+///   do {
+/// switch (i) {
+/// case 1: {
+///   foobar();
+///   break;
+/// }
+/// default: {
+///   break;
+/// }
+/// }
+///   } while (--i);
+///   return true;
+/// } catch (...) {
+///   handleError();
+///   return false;
+/// }
+///   }
+///
+///   void foo(bool b)
+///   {
+/// if (b) {
+///   baz(2);
+/// } else {
+///   baz(5);
+/// }
 ///   }
-///   enum X : int { A, B };
+///
+///   void bar() { foo(true); }
+///   } // namespace N
 /// \endcode
 BS_Mozilla,
 /// Like ``Attach``, but break before function definitions, ``catch``, and
 /// ``else``.
 /// \code
-///   try {
-/// foo();
-///   }
-///   catch () {
-///   }
-///   void foo() { bar(); }
-///   class foo {
+///   namespace N {
+///   enum E {
+/// E1,
+/// E2,
 ///   };
-///   if (foo()) {
+///
+///   class C {
+///   public:
+/// C();
+///   };
+///
+///   bool baz(int i)
+///   {
+/// try {
+///   do {
+/// switch (i) {
+///

[PATCH] D92782: [CodeGen][AMDGPU] Fix ICE for static initializer IR generation

2020-12-12 Thread Alexey Bader via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa500a4358789: [CodeGen][AMDGPU] Fix ICE for static 
initializer IR generation (authored by bader).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92782

Files:
  clang/lib/CodeGen/CGDecl.cpp
  clang/test/CodeGen/address-space.c


Index: clang/test/CodeGen/address-space.c
===
--- clang/test/CodeGen/address-space.c
+++ clang/test/CodeGen/address-space.c
@@ -59,3 +59,14 @@
 void_ptr_arithmetic_test(void __attribute__((address_space(1))) *arg) {
 return arg + 4;
 }
+
+// CHECK-LABEL: define i32* @test5(
+const unsigned *test5() {
+  // Intentionally leave a part of an array uninitialized. This triggers a
+  // different code path contrary to a fully initialized array.
+  // CHECK: ret i32* getelementptr inbounds ([256 x i32]
+  static const unsigned bars[256] = {
+  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+  11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
+  return &bars[0];
+}
Index: clang/lib/CodeGen/CGDecl.cpp
===
--- clang/lib/CodeGen/CGDecl.cpp
+++ clang/lib/CodeGen/CGDecl.cpp
@@ -353,12 +353,11 @@
   if (GV->getValueType() != Init->getType()) {
 llvm::GlobalVariable *OldGV = GV;
 
-GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(),
-  OldGV->isConstant(),
-  OldGV->getLinkage(), Init, "",
-  /*InsertBefore*/ OldGV,
-  OldGV->getThreadLocalMode(),
-   
CGM.getContext().getTargetAddressSpace(D.getType()));
+GV = new llvm::GlobalVariable(
+CGM.getModule(), Init->getType(), OldGV->isConstant(),
+OldGV->getLinkage(), Init, "",
+/*InsertBefore*/ OldGV, OldGV->getThreadLocalMode(),
+OldGV->getType()->getPointerAddressSpace());
 GV->setVisibility(OldGV->getVisibility());
 GV->setDSOLocal(OldGV->isDSOLocal());
 GV->setComdat(OldGV->getComdat());


Index: clang/test/CodeGen/address-space.c
===
--- clang/test/CodeGen/address-space.c
+++ clang/test/CodeGen/address-space.c
@@ -59,3 +59,14 @@
 void_ptr_arithmetic_test(void __attribute__((address_space(1))) *arg) {
 return arg + 4;
 }
+
+// CHECK-LABEL: define i32* @test5(
+const unsigned *test5() {
+  // Intentionally leave a part of an array uninitialized. This triggers a
+  // different code path contrary to a fully initialized array.
+  // CHECK: ret i32* getelementptr inbounds ([256 x i32]
+  static const unsigned bars[256] = {
+  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+  11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
+  return &bars[0];
+}
Index: clang/lib/CodeGen/CGDecl.cpp
===
--- clang/lib/CodeGen/CGDecl.cpp
+++ clang/lib/CodeGen/CGDecl.cpp
@@ -353,12 +353,11 @@
   if (GV->getValueType() != Init->getType()) {
 llvm::GlobalVariable *OldGV = GV;
 
-GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(),
-  OldGV->isConstant(),
-  OldGV->getLinkage(), Init, "",
-  /*InsertBefore*/ OldGV,
-  OldGV->getThreadLocalMode(),
-   CGM.getContext().getTargetAddressSpace(D.getType()));
+GV = new llvm::GlobalVariable(
+CGM.getModule(), Init->getType(), OldGV->isConstant(),
+OldGV->getLinkage(), Init, "",
+/*InsertBefore*/ OldGV, OldGV->getThreadLocalMode(),
+OldGV->getType()->getPointerAddressSpace());
 GV->setVisibility(OldGV->getVisibility());
 GV->setDSOLocal(OldGV->isDSOLocal());
 GV->setComdat(OldGV->getComdat());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a500a43 - [CodeGen][AMDGPU] Fix ICE for static initializer IR generation

2020-12-12 Thread Alexey Bader via cfe-commits

Author: Alexey Bader
Date: 2020-12-12T23:26:54+03:00
New Revision: a500a4358789d1794bc672421c55900ea2bbc938

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

LOG: [CodeGen][AMDGPU] Fix ICE for static initializer IR generation

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

Added: 


Modified: 
clang/lib/CodeGen/CGDecl.cpp
clang/test/CodeGen/address-space.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 478821665e45..a01638f0b67b 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -353,12 +353,11 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const 
VarDecl &D,
   if (GV->getValueType() != Init->getType()) {
 llvm::GlobalVariable *OldGV = GV;
 
-GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(),
-  OldGV->isConstant(),
-  OldGV->getLinkage(), Init, "",
-  /*InsertBefore*/ OldGV,
-  OldGV->getThreadLocalMode(),
-   
CGM.getContext().getTargetAddressSpace(D.getType()));
+GV = new llvm::GlobalVariable(
+CGM.getModule(), Init->getType(), OldGV->isConstant(),
+OldGV->getLinkage(), Init, "",
+/*InsertBefore*/ OldGV, OldGV->getThreadLocalMode(),
+OldGV->getType()->getPointerAddressSpace());
 GV->setVisibility(OldGV->getVisibility());
 GV->setDSOLocal(OldGV->isDSOLocal());
 GV->setComdat(OldGV->getComdat());

diff  --git a/clang/test/CodeGen/address-space.c 
b/clang/test/CodeGen/address-space.c
index c66dfc87c0c0..baefb4b983fc 100644
--- a/clang/test/CodeGen/address-space.c
+++ b/clang/test/CodeGen/address-space.c
@@ -59,3 +59,14 @@ void __attribute__((address_space(1)))*
 void_ptr_arithmetic_test(void __attribute__((address_space(1))) *arg) {
 return arg + 4;
 }
+
+// CHECK-LABEL: define i32* @test5(
+const unsigned *test5() {
+  // Intentionally leave a part of an array uninitialized. This triggers a
+  // 
diff erent code path contrary to a fully initialized array.
+  // CHECK: ret i32* getelementptr inbounds ([256 x i32]
+  static const unsigned bars[256] = {
+  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+  11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
+  return &bars[0];
+}



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


[clang] 956034c - [mac/arm] XFAIL two more tests on arm64-apple

2020-12-12 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-12-12T15:20:50-05:00
New Revision: 956034c6c894d1291306baed2e59e51c16e5df70

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

LOG: [mac/arm] XFAIL two more tests on arm64-apple

Part of PR46644

Added: 


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

Removed: 




diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index 6415f1d61b72..4418bcc42047 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -2,6 +2,9 @@
 /// Perform several driver tests for OpenMP offloading
 ///
 
+// https://PR46644
+// XFAIL: arm64-apple
+
 // REQUIRES: clang-driver
 // REQUIRES: x86-registered-target
 // REQUIRES: powerpc-registered-target

diff  --git a/clang/test/Driver/openmp-offload.c 
b/clang/test/Driver/openmp-offload.c
index a93ef24d7e0a..d32632059f58 100644
--- a/clang/test/Driver/openmp-offload.c
+++ b/clang/test/Driver/openmp-offload.c
@@ -2,6 +2,9 @@
 /// Perform several driver tests for OpenMP offloading
 ///
 
+// https://PR46644
+// XFAIL: arm64-apple
+
 // REQUIRES: clang-driver
 // REQUIRES: x86-registered-target
 // REQUIRES: powerpc-registered-target



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


[PATCH] D92155: Load plugins when creating a CompilerInvocation.

2020-12-12 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

In D92155#2419549 , @sammccall wrote:

> In D92155#2419346 , @psionic12 wrote:
>
>> Or, could you help to point out what's the difference between passing a 
>> plugin path through *clangd* startup command line and through clang flags?
>
> Sure. TL;DR is: clangd flags are configured by the user, user can be fully 
> responsible for security/stability.
> clang flags are configured by the project. If they're bad, we can e.g. give 
> bad diagnostics, but can't crash or compromise security.
>
> More detail:
>
> In the simplest possible case, clangd is configured as follows:
>
> 1. user downloads clangd binary
> 2. user installs an LSP plugin for their editor, and configures the plugin to 
> use /usr/bin/clangd for C++ files. clangd starts when the editor does
> 3. the build system for $PROJECT generates $PROJECT/compile_commands.json
> 4. when the user opens $PROJECT/src/foo.cpp in the editor, it notifies 
> clangd. clangd searches for $PROJECT/compile_commands.json, finds the clang 
> arguments, and uses them to parse foo.cpp
>
> *clangd* command-line flags would be added explicitly by the user at step 2. 
> We can reasonably ask the user to be aware/responsible for security/stability 
> implications of doing this, including with their particular clangd version. 
> We can also ask them to run `clangd --check` without the plugin flag to test 
> whether the plugin is causing a stability problem.
>
> *clang* command-line flags are added implicitly in step 3. Or they could 
> simply be checked into the repository - nothing ensures they were generated 
> locally by the build system. The point is in typical usage they are not 
> controlled by the user directly, and from a security perspective are not 
> trusted (as safely opening files from untrusted repos is a reasonable 
> expectation). So if we're loading plugins based on instructions in clang 
> command-line flags, clangd bears most of the responsibility for making sure 
> that's safe and correct (and I don't see a way to do that).

Something just occurred to me: can't clangd arguments also be controlled by the 
untrusted repository by having a `.vscode/settings.json` file with specific 
`"clangd.arguments"` checked in?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92155

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


[clang] a5c65de - mac/arm: XFAIL the last 3 failing tests

2020-12-12 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2020-12-12T15:09:17-05:00
New Revision: a5c65de2953e755532da2e171e452d11e80d4714

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

LOG: mac/arm: XFAIL the last 3 failing tests

We should fix them, but let's XFAIL them for now so that we can start
running check-clang on bots and lock in the passing tests.

Part of 46644.

Added: 


Modified: 
clang/test/CodeGen/2004-02-13-IllegalVararg.c
clang/test/Driver/aarch64-cpus.c
clang/test/Index/pch-from-libclang.c

Removed: 




diff  --git a/clang/test/CodeGen/2004-02-13-IllegalVararg.c 
b/clang/test/CodeGen/2004-02-13-IllegalVararg.c
index cbc9151ec631..b3acda1f9e72 100644
--- a/clang/test/CodeGen/2004-02-13-IllegalVararg.c
+++ b/clang/test/CodeGen/2004-02-13-IllegalVararg.c
@@ -1,5 +1,8 @@
 // RUN: %clang_cc1  %s -w -emit-llvm -o -
 
+// https://bugs.llvm.org/show_bug.cgi?id=46644#c6
+// XFAIL: arm64-apple
+
 float test(int X, ...) {
   __builtin_va_list ap;
   float F;

diff  --git a/clang/test/Driver/aarch64-cpus.c 
b/clang/test/Driver/aarch64-cpus.c
index 967a4902bd1c..0019e38efa62 100644
--- a/clang/test/Driver/aarch64-cpus.c
+++ b/clang/test/Driver/aarch64-cpus.c
@@ -1,5 +1,8 @@
 // Check target CPUs are correctly passed.
 
+// https://PR46644
+// XFAIL: arm64-apple
+
 // RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERIC %s
 // RUN: %clang -target aarch64 -mcpu=generic -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERIC %s
 // RUN: %clang -target aarch64 -mlittle-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=GENERIC %s

diff  --git a/clang/test/Index/pch-from-libclang.c 
b/clang/test/Index/pch-from-libclang.c
index ec6286da2ae3..5ad5ecb9157a 100644
--- a/clang/test/Index/pch-from-libclang.c
+++ b/clang/test/Index/pch-from-libclang.c
@@ -1,5 +1,8 @@
 // Check that clang can use a PCH created from libclang.
 
+// https://PR46644
+// XFAIL: arm64-apple
+
 // This test doesn't use -fdisable-module-hash and hence requires that
 // CompilerInvocation::getModuleHash() computes exactly the same hash
 // for c-index-test and clang, which in turn requires that the both use



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


[PATCH] D93018: [AMDGPU] Add missing targets to target-invalid-cpu-note.c

2020-12-12 Thread Tony Tye via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7beee561e23d: [AMDGPU] Add missing targets to 
target-invalid-cpu-note.c (authored by t-tye).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93018

Files:
  clang/test/Misc/target-invalid-cpu-note.c


Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -73,9 +73,9 @@
 
 // RUN: not %clang_cc1 -triple r600--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix R600
 // R600: error: unknown target CPU 'not-a-cpu'
-// R600: note: valid target CPU values are: r600, rv630, rv635, r630, rs780, 
-// R600-SAME: rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar, 
-// R600-SAME: palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts, 
+// R600: note: valid target CPU values are: r600, rv630, rv635, r630, rs780,
+// R600-SAME: rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar,
+// R600-SAME: palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts,
 // R600-SAME: caicos, aruba, cayman, turks
 
 
@@ -83,9 +83,11 @@
 // AMDGCN: error: unknown target CPU 'not-a-cpu'
 // AMDGCN: note: valid target CPU values are: gfx600, tahiti, gfx601, 
pitcairn, verde,
 // AMDGCN-SAME: gfx602, hainan, oland, gfx700, kaveri, gfx701, hawaii, gfx702,
-// AMDGCN-SAME: gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, 
carrizo, 
+// AMDGCN-SAME: gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, 
carrizo,
 // AMDGCN-SAME: gfx802, iceland, tonga, gfx803, fiji, polaris10, polaris11,
-// AMDGCN-SAME: gfx805, tongapro, gfx810, stoney, gfx900, gfx902
+// AMDGCN-SAME: gfx805, tongapro, gfx810, stoney, gfx900, gfx902, gfx904, 
gfx906,
+// AMDGCN-SAME: gfx908, gfx909, gfx90c, gfx1010, gfx1011, gfx1012, gfx1030, 
gfx1031,
+// AMDGCN-SAME: gfx1032, gfx1033
 
 // RUN: not %clang_cc1 -triple wasm64--- -target-cpu not-a-cpu -fsyntax-only 
%s 2>&1 | FileCheck %s --check-prefix WEBASM
 // WEBASM: error: unknown target CPU 'not-a-cpu'


Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -73,9 +73,9 @@
 
 // RUN: not %clang_cc1 -triple r600--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix R600
 // R600: error: unknown target CPU 'not-a-cpu'
-// R600: note: valid target CPU values are: r600, rv630, rv635, r630, rs780, 
-// R600-SAME: rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar, 
-// R600-SAME: palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts, 
+// R600: note: valid target CPU values are: r600, rv630, rv635, r630, rs780,
+// R600-SAME: rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar,
+// R600-SAME: palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts,
 // R600-SAME: caicos, aruba, cayman, turks
 
 
@@ -83,9 +83,11 @@
 // AMDGCN: error: unknown target CPU 'not-a-cpu'
 // AMDGCN: note: valid target CPU values are: gfx600, tahiti, gfx601, pitcairn, verde,
 // AMDGCN-SAME: gfx602, hainan, oland, gfx700, kaveri, gfx701, hawaii, gfx702,
-// AMDGCN-SAME: gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, carrizo, 
+// AMDGCN-SAME: gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, carrizo,
 // AMDGCN-SAME: gfx802, iceland, tonga, gfx803, fiji, polaris10, polaris11,
-// AMDGCN-SAME: gfx805, tongapro, gfx810, stoney, gfx900, gfx902
+// AMDGCN-SAME: gfx805, tongapro, gfx810, stoney, gfx900, gfx902, gfx904, gfx906,
+// AMDGCN-SAME: gfx908, gfx909, gfx90c, gfx1010, gfx1011, gfx1012, gfx1030, gfx1031,
+// AMDGCN-SAME: gfx1032, gfx1033
 
 // RUN: not %clang_cc1 -triple wasm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix WEBASM
 // WEBASM: error: unknown target CPU 'not-a-cpu'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93017: [AMDGPU] Add missing targets to amdgpu-features.cl

2020-12-12 Thread Tony Tye via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92ab6ed6672b: [AMDGPU] Add missing targets to 
amdgpu-features.cl (authored by t-tye).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93017

Files:
  clang/test/CodeGenOpenCL/amdgpu-features.cl


Index: clang/test/CodeGenOpenCL/amdgpu-features.cl
===
--- clang/test/CodeGenOpenCL/amdgpu-features.cl
+++ clang/test/CodeGenOpenCL/amdgpu-features.cl
@@ -7,7 +7,18 @@
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx601 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX601 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx602 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX602 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx700 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX700 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx701 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX701 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx702 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX702 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx703 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX703 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx704 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX704 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx705 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX705 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx801 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX801 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx802 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX802 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx803 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX803 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx805 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX805 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx810 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX810 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx900 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX900 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx902 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX902 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx904 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX904 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx906 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX906 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx908 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX908 %s


Index: clang/test/CodeGenOpenCL/amdgpu-features.cl
===
--- clang/test/CodeGenOpenCL/amdgpu-features.cl
+++ clang/test/CodeGenOpenCL/amdgpu-features.cl
@@ -7,7 +7,18 @@
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx601 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX601 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx602 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX602 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx700 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX700 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx701 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX701 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx702 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX702 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx703 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX703 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx704 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX704 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx705 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX705 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx801 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX801 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx802 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX802 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx803 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX803 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx805 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX805 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx810 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX810 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx900 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX900 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx902 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX902 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx904 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX904 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx906 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX906 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx908 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX908 %s
_

[clang] 7beee56 - [AMDGPU] Add missing targets to target-invalid-cpu-note.c

2020-12-12 Thread via cfe-commits

Author: Tony
Date: 2020-12-12T18:19:03Z
New Revision: 7beee561e23db56c7e24462a9870a3ba58a9b2b3

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

LOG: [AMDGPU] Add missing targets to target-invalid-cpu-note.c

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

Added: 


Modified: 
clang/test/Misc/target-invalid-cpu-note.c

Removed: 




diff  --git a/clang/test/Misc/target-invalid-cpu-note.c 
b/clang/test/Misc/target-invalid-cpu-note.c
index 3abf51b1c783..c61f17986ec5 100644
--- a/clang/test/Misc/target-invalid-cpu-note.c
+++ b/clang/test/Misc/target-invalid-cpu-note.c
@@ -73,9 +73,9 @@
 
 // RUN: not %clang_cc1 -triple r600--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix R600
 // R600: error: unknown target CPU 'not-a-cpu'
-// R600: note: valid target CPU values are: r600, rv630, rv635, r630, rs780, 
-// R600-SAME: rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar, 
-// R600-SAME: palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts, 
+// R600: note: valid target CPU values are: r600, rv630, rv635, r630, rs780,
+// R600-SAME: rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar,
+// R600-SAME: palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts,
 // R600-SAME: caicos, aruba, cayman, turks
 
 
@@ -83,9 +83,11 @@
 // AMDGCN: error: unknown target CPU 'not-a-cpu'
 // AMDGCN: note: valid target CPU values are: gfx600, tahiti, gfx601, 
pitcairn, verde,
 // AMDGCN-SAME: gfx602, hainan, oland, gfx700, kaveri, gfx701, hawaii, gfx702,
-// AMDGCN-SAME: gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, 
carrizo, 
+// AMDGCN-SAME: gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, 
carrizo,
 // AMDGCN-SAME: gfx802, iceland, tonga, gfx803, fiji, polaris10, polaris11,
-// AMDGCN-SAME: gfx805, tongapro, gfx810, stoney, gfx900, gfx902
+// AMDGCN-SAME: gfx805, tongapro, gfx810, stoney, gfx900, gfx902, gfx904, 
gfx906,
+// AMDGCN-SAME: gfx908, gfx909, gfx90c, gfx1010, gfx1011, gfx1012, gfx1030, 
gfx1031,
+// AMDGCN-SAME: gfx1032, gfx1033
 
 // RUN: not %clang_cc1 -triple wasm64--- -target-cpu not-a-cpu -fsyntax-only 
%s 2>&1 | FileCheck %s --check-prefix WEBASM
 // WEBASM: error: unknown target CPU 'not-a-cpu'



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


[clang] 92ab6ed - [AMDGPU] Add missing targets to amdgpu-features.cl

2020-12-12 Thread via cfe-commits

Author: Tony
Date: 2020-12-12T18:19:02Z
New Revision: 92ab6ed6672b99549f8fd63e3a442db47b1982fe

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

LOG: [AMDGPU] Add missing targets to amdgpu-features.cl

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

Added: 


Modified: 
clang/test/CodeGenOpenCL/amdgpu-features.cl

Removed: 




diff  --git a/clang/test/CodeGenOpenCL/amdgpu-features.cl 
b/clang/test/CodeGenOpenCL/amdgpu-features.cl
index 813b39d9ec7b..740521aa3bca 100644
--- a/clang/test/CodeGenOpenCL/amdgpu-features.cl
+++ b/clang/test/CodeGenOpenCL/amdgpu-features.cl
@@ -7,7 +7,18 @@
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx601 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX601 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx602 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX602 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx700 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX700 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx701 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX701 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx702 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX702 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx703 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX703 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx704 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX704 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx705 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX705 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx801 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX801 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx802 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX802 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx803 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX803 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx805 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX805 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx810 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX810 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx900 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX900 %s
+// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx902 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX902 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx904 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX904 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx906 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX906 %s
 // RUN: %clang_cc1 -triple amdgcn -target-cpu gfx908 -S -emit-llvm -o - %s | 
FileCheck --check-prefix=GFX908 %s



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


[PATCH] D93164: [AST] Add generator for source location introspection

2020-12-12 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 311398.
steveire added a comment.

Update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93164

Files:
  clang/lib/Tooling/CMakeLists.txt
  clang/lib/Tooling/DumpTool/APIData.h
  clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
  clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.h
  clang/lib/Tooling/DumpTool/CMakeLists.txt
  clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
  clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
  clang/unittests/CMakeLists.txt
  clang/unittests/Introspection/CMakeLists.txt
  clang/unittests/Introspection/IntrospectionTest.cpp

Index: clang/unittests/Introspection/IntrospectionTest.cpp
===
--- /dev/null
+++ clang/unittests/Introspection/IntrospectionTest.cpp
@@ -0,0 +1,89 @@
+//===- unittest/Introspection/IntrospectionTest.cpp - Introspection test -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// Tests for AST location API introspection.
+//
+//===--===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Tooling/NodeLocationIntrospection.h"
+#include "clang/Tooling/Tooling.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using namespace clang;
+using namespace clang::ast_matchers;
+
+#if SKIP_INTROSPECTION_GENERATION
+
+TEST(Introspection, NonFatalAPI) {
+  auto AST = tooling::buildASTFromCode(
+  "void foo() {} void bar() { foo(); }", "foo.cpp",
+  std::make_shared());
+  auto &Ctx = AST->getASTContext();
+  auto &TU = *Ctx.getTranslationUnitDecl();
+
+  auto BoundNodes = ast_matchers::match(
+  decl(hasDescendant(
+  callExpr(callee(functionDecl(hasName("foo".bind("fooCall"))),
+  TU, Ctx);
+
+  EXPECT_EQ(BoundNodes.size(), 1u);
+
+  auto FooCall = BoundNodes[0].getNodeAs("fooCall");
+
+  auto result = tooling::NodeLocationIntrospection::GetLocations(FooCall);
+
+  EXPECT_EQ(result.LocationAccessors.size(), 0);
+  EXPECT_EQ(result.RangeAccessors.size(), 0);
+}
+
+#else
+
+TEST(Introspection, SourceLocations) {
+  auto AST = tooling::buildASTFromCode(
+  "void foo() {} void bar() { foo(); }", "foo.cpp",
+  std::make_shared());
+  auto &Ctx = AST->getASTContext();
+  auto &TU = *Ctx.getTranslationUnitDecl();
+
+  auto BoundNodes = ast_matchers::match(
+  decl(hasDescendant(
+  callExpr(callee(functionDecl(hasName("foo".bind("fooCall"))),
+  TU, Ctx);
+
+  EXPECT_EQ(BoundNodes.size(), 1u);
+
+  auto FooCall = BoundNodes[0].getNodeAs("fooCall");
+
+  auto result = tooling::NodeLocationIntrospection::GetLocations(FooCall);
+
+  EXPECT_EQ(result.LocationAccessors.size(), 4u);
+
+  EXPECT_EQ(result.LocationAccessors.begin()->first, FooCall->getBeginLoc());
+  EXPECT_EQ(result.LocationAccessors.begin()->second, "getBeginLoc");
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 1)->first,
+FooCall->getExprLoc());
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 1)->second,
+"getExprLoc");
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 2)->first,
+FooCall->getEndLoc());
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 2)->second,
+"getEndLoc");
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 3)->first,
+FooCall->getRParenLoc());
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 3)->second,
+"getRParenLoc");
+
+  EXPECT_EQ(result.RangeAccessors.size(), 1u);
+  EXPECT_EQ(result.RangeAccessors.begin()->first, FooCall->getSourceRange());
+  EXPECT_EQ(result.RangeAccessors.begin()->second, "getSourceRange");
+}
+#endif
Index: clang/unittests/Introspection/CMakeLists.txt
===
--- /dev/null
+++ clang/unittests/Introspection/CMakeLists.txt
@@ -0,0 +1,22 @@
+set(LLVM_LINK_COMPONENTS
+  ${LLVM_TARGETS_TO_BUILD}
+  FrontendOpenMP
+  Support
+  )
+
+add_clang_unittest(IntrospectionTests
+  IntrospectionTest.cpp
+  )
+
+clang_target_link_libraries(IntrospectionTests
+  PRIVATE
+  clangAST
+  clangTooling
+  )
+target_compile_definitions(IntrospectionTests PRIVATE
+  SKIP_INTROSPECTION_GENERATION=$
+)
+target_link_libraries(IntrospectionTests
+  PRIVATE
+  LLVMTestingSupport
+)
Index: clang/unittests/CMakeLists.txt
===
--- clang/unittests/CMakeLists.txt
+++ clang/unittests/CMakeLists.txt
@@ -30,6 +30,7 @@
 add_subdirectory(AST)
 add_subdirectory(CrossTU)
 add_subdirectory(Tooling)
+add_subdirecto

[PATCH] D93164: [AST] Add generator for source location introspection

2020-12-12 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added reviewers: aaron.ballman, njames93.
Herald added a subscriber: mgorny.
steveire requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Generate a json file containing descriptions of AST classes and their
public accessors which return SourceLocation or SourceRange.

Use the JSON file to generate a C++ API and implementation for accessing
the source locations and method names for accessing them for a given AST
node.

This new API can be used to implement 'srcloc' output in clang-query:

  http://ce.steveire.com/z/m_kTIo

In this first version of this feature, only the accessors for Stmt
classes are generated, not Decls, TypeLocs etc.  Those can be added
after this change is reviewed, as this change is mostly about
infrastructure of these code generators.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93164

Files:
  clang/lib/Tooling/CMakeLists.txt
  clang/lib/Tooling/DumpTool/APIData.h
  clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
  clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.h
  clang/lib/Tooling/DumpTool/CMakeLists.txt
  clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
  clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
  clang/unittests/CMakeLists.txt
  clang/unittests/Introspection/CMakeLists.txt
  clang/unittests/Introspection/IntrospectionTest.cpp

Index: clang/unittests/Introspection/IntrospectionTest.cpp
===
--- /dev/null
+++ clang/unittests/Introspection/IntrospectionTest.cpp
@@ -0,0 +1,89 @@
+//===- unittest/Introspection/IntrospectionTest.cpp - Introspection test -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// Tests for AST location API introspection.
+//
+//===--===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Tooling/NodeLocationIntrospection.h"
+#include "clang/Tooling/Tooling.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using namespace clang;
+using namespace clang::ast_matchers;
+
+#if SKIP_INTROSPECTION_GENERATION
+
+TEST(Introspection, NonFatalAPI) {
+  auto AST = tooling::buildASTFromCode(
+  "void foo() {} void bar() { foo(); }", "foo.cpp",
+  std::make_shared());
+  auto &Ctx = AST->getASTContext();
+  auto &TU = *Ctx.getTranslationUnitDecl();
+
+  auto BoundNodes = ast_matchers::match(
+  decl(hasDescendant(
+  callExpr(callee(functionDecl(hasName("foo".bind("fooCall"))),
+  TU, Ctx);
+
+  EXPECT_EQ(BoundNodes.size(), 1u);
+
+  auto FooCall = BoundNodes[0].getNodeAs("fooCall");
+
+  auto result = tooling::NodeLocationIntrospection::GetLocations(FooCall);
+
+  EXPECT_EQ(result.LocationAccessors.size(), 0);
+  EXPECT_EQ(result.RangeAccessors.size(), 0);
+}
+
+#else
+
+TEST(Introspection, SourceLocations) {
+  auto AST = tooling::buildASTFromCode(
+  "void foo() {} void bar() { foo(); }", "foo.cpp",
+  std::make_shared());
+  auto &Ctx = AST->getASTContext();
+  auto &TU = *Ctx.getTranslationUnitDecl();
+
+  auto BoundNodes = ast_matchers::match(
+  decl(hasDescendant(
+  callExpr(callee(functionDecl(hasName("foo".bind("fooCall"))),
+  TU, Ctx);
+
+  EXPECT_EQ(BoundNodes.size(), 1u);
+
+  auto FooCall = BoundNodes[0].getNodeAs("fooCall");
+
+  auto result = tooling::NodeLocationIntrospection::GetLocations(FooCall);
+
+  EXPECT_EQ(result.LocationAccessors.size(), 4u);
+
+  EXPECT_EQ(result.LocationAccessors.begin()->first, FooCall->getBeginLoc());
+  EXPECT_EQ(result.LocationAccessors.begin()->second, "getBeginLoc");
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 1)->first,
+FooCall->getExprLoc());
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 1)->second,
+"getExprLoc");
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 2)->first,
+FooCall->getEndLoc());
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 2)->second,
+"getEndLoc");
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 3)->first,
+FooCall->getRParenLoc());
+  EXPECT_EQ(std::next(result.LocationAccessors.begin(), 3)->second,
+"getRParenLoc");
+
+  EXPECT_EQ(result.RangeAccessors.size(), 1u);
+  EXPECT_EQ(result.RangeAccessors.begin()->first, FooCall->getSourceRange());
+  EXPECT_EQ(result.RangeAccessors.begin()->second, "getSourceRange");
+}
+#endif
Index: clang/unittests/Introspection/CMakeLists.txt
===
--- /dev/null
+++ clang/unitt

[PATCH] D93017: [AMDGPU] Add missing targets to amdgpu-features.cl

2020-12-12 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
kzhuravl accepted this revision.
kzhuravl 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/D93017/new/

https://reviews.llvm.org/D93017

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


[PATCH] D93018: [AMDGPU] Add missing targets to target-invalid-cpu-note.c

2020-12-12 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
kzhuravl accepted this revision.
kzhuravl 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/D93018/new/

https://reviews.llvm.org/D93018

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


[PATCH] D92721: [PATCH] [clang] Create SPIRABIInfo to enable SPIR_FUNC calling convention

2020-12-12 Thread Melanie Blower via Phabricator via cfe-commits
mibintc added a comment.

Thanks for the review!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92721

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


[PATCH] D93163: [clang-format] Fix handling of ## comments in TextProto

2020-12-12 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: MyDeveloperDay, krasimir.
HazardyKnusperkeks added a project: clang-format.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

As @krasimir said in D92257  the old behavior 
is buggy.

- Added checks for `##`, `###`, and ``.
- Adapted the test.
- Removed the check for TextProto, which is already in 
`getLineCommentIndentPrefix`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93163

Files:
  clang/lib/Format/BreakableToken.cpp
  clang/unittests/Format/FormatTestTextProto.cpp


Index: clang/unittests/Format/FormatTestTextProto.cpp
===
--- clang/unittests/Format/FormatTestTextProto.cpp
+++ clang/unittests/Format/FormatTestTextProto.cpp
@@ -380,25 +380,29 @@
": 3849");
 }
 
-TEST_F(FormatTestTextProto, UnderstandsHashHashComments) {
+TEST_F(FormatTestTextProto, UnderstandsHashComments) {
   FormatStyle Style = getGoogleStyle(FormatStyle::LK_TextProto);
   Style.ColumnLimit = 60; // To make writing tests easier.
   EXPECT_EQ("aaa: 100\n"
-"##this is a double-hash comment.\n"
+"## this is a double-hash comment.\n"
 "bb: 100\n"
 "## another double-hash comment.\n"
 "### a triple-hash comment\n"
 "cc: 200\n"
+"### another triple-hash comment\n"
 " a quadriple-hash comment\n"
-"dd: 100\n",
+"dd: 100\n"
+" another quadriple-hash comment\n",
 format("aaa: 100\n"
"##this is a double-hash comment.\n"
"bb: 100\n"
"## another double-hash comment.\n"
-   "### a triple-hash comment\n"
+   "###a triple-hash comment\n"
"cc: 200\n"
-   " a quadriple-hash comment\n"
-   "dd: 100\n",
+   "### another triple-hash comment\n"
+   "a quadriple-hash comment\n"
+   "dd: 100\n"
+   " another quadriple-hash comment\n",
Style));
 }
 
Index: clang/lib/Format/BreakableToken.cpp
===
--- clang/lib/Format/BreakableToken.cpp
+++ clang/lib/Format/BreakableToken.cpp
@@ -789,9 +789,14 @@
   Prefix[i] = "///< ";
 else if (Prefix[i] == "//!<")
   Prefix[i] = "//!< ";
-else if (Prefix[i] == "#" &&
- Style.Language == FormatStyle::LK_TextProto)
+else if (Prefix[i] == "#")
   Prefix[i] = "# ";
+else if (Prefix[i] == "##")
+  Prefix[i] = "## ";
+else if (Prefix[i] == "###")
+  Prefix[i] = "### ";
+else if (Prefix[i] == "")
+  Prefix[i] = " ";
   }
 
   Tokens[i] = LineTok;


Index: clang/unittests/Format/FormatTestTextProto.cpp
===
--- clang/unittests/Format/FormatTestTextProto.cpp
+++ clang/unittests/Format/FormatTestTextProto.cpp
@@ -380,25 +380,29 @@
": 3849");
 }
 
-TEST_F(FormatTestTextProto, UnderstandsHashHashComments) {
+TEST_F(FormatTestTextProto, UnderstandsHashComments) {
   FormatStyle Style = getGoogleStyle(FormatStyle::LK_TextProto);
   Style.ColumnLimit = 60; // To make writing tests easier.
   EXPECT_EQ("aaa: 100\n"
-"##this is a double-hash comment.\n"
+"## this is a double-hash comment.\n"
 "bb: 100\n"
 "## another double-hash comment.\n"
 "### a triple-hash comment\n"
 "cc: 200\n"
+"### another triple-hash comment\n"
 " a quadriple-hash comment\n"
-"dd: 100\n",
+"dd: 100\n"
+" another quadriple-hash comment\n",
 format("aaa: 100\n"
"##this is a double-hash comment.\n"
"bb: 100\n"
"## another double-hash comment.\n"
-   "### a triple-hash comment\n"
+   "###a triple-hash comment\n"
"cc: 200\n"
-   " a quadriple-hash comment\n"
-   "dd: 100\n",
+   "### another triple-hash comment\n"
+   "a quadriple-hash comment\n"
+   "dd: 100\n"
+   " another quadriple-hash comment\n",
Style));
 }
 
Index: clang/lib/Format/BreakableToken.cpp
===
--- clang/lib/Format/BreakableToken.cpp
+++ clang/lib/Format/BreakableToken.cpp
@@ -789,9 +789,14 @@
   Prefix[i] = "///< ";
 else if (Prefix[i] == "//!<")

[PATCH] D92920: [clang-tidy] Add a diagnostic callback to parseConfiguration

2020-12-12 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 311391.
njames93 added a comment.

Fix up test case now bug in yaml error locations has been fixed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92920

Files:
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
  clang-tools-extra/clang-tidy/ClangTidyOptions.h
  clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
  clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp

Index: clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
===
--- clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
+++ clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
@@ -2,6 +2,9 @@
 #include "ClangTidyCheck.h"
 #include "ClangTidyDiagnosticConsumer.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Testing/Support/Annotations.h"
+#include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
 namespace clang {
@@ -123,6 +126,100 @@
   EXPECT_TRUE(*Options.UseColor);
 }
 
+namespace {
+class DiagCollecter {
+public:
+  struct Diag {
+  private:
+static size_t posToOffset(const llvm::SMLoc Loc,
+  const llvm::SourceMgr *Src) {
+  return Loc.getPointer() -
+ Src->getMemoryBuffer(Src->FindBufferContainingLoc(Loc))
+ ->getBufferStart();
+}
+
+  public:
+Diag(const llvm::SMDiagnostic &D)
+: Message(D.getMessage()), Kind(D.getKind()),
+  Pos(posToOffset(D.getLoc(), D.getSourceMgr())) {
+  if (!D.getRanges().empty()) {
+// Ranges are stored as column numbers on the line that has the error.
+unsigned Offset = Pos - D.getColumnNo();
+Range.emplace();
+Range->Begin = Offset + D.getRanges().front().first,
+Range->End = Offset + D.getRanges().front().second;
+  }
+}
+std::string Message;
+llvm::SourceMgr::DiagKind Kind;
+size_t Pos;
+Optional Range;
+
+friend void PrintTo(const Diag &D, std::ostream *OS) {
+  *OS << (D.Kind == llvm::SourceMgr::DK_Error ? "error: " : "warning: ")
+  << D.Message << "@" << llvm::to_string(D.Pos);
+  if (D.Range)
+*OS << ":[" << D.Range->Begin << ", " << D.Range->End << ")";
+}
+  };
+
+  DiagCollecter() = default;
+  DiagCollecter(const DiagCollecter &) = delete;
+
+  std::function
+  getCallback(bool Clear = true) & {
+if (Clear)
+  Diags.clear();
+return [&](const llvm::SMDiagnostic &Diag) { Diags.emplace_back(Diag); };
+  }
+
+  std::function
+  getCallback(bool Clear = true) && = delete;
+
+  llvm::ArrayRef getDiags() const { return Diags; }
+
+private:
+  std::vector Diags;
+};
+
+MATCHER_P(DiagMessage, M, "") { return arg.Message == M; }
+MATCHER_P(DiagKind, K, "") { return arg.Kind == K; }
+MATCHER_P(DiagPos, P, "") { return arg.Pos == P; }
+MATCHER_P(DiagRange, P, "") { return arg.Range && *arg.Range == P; }
+} // namespace
+
+using ::testing::AllOf;
+using ::testing::ElementsAre;
+
+TEST(ParseConfiguration, CollectDiags) {
+  DiagCollecter Collector;
+  auto ParseWithDiags = [&](llvm::StringRef Buffer) {
+return parseConfigurationWithDiags(llvm::MemoryBufferRef(Buffer, "Options"),
+   Collector.getCallback());
+  };
+  llvm::Annotations Options(R"(
+[[Check]]: llvm-include-order
+  )");
+  llvm::ErrorOr ParsedOpt = ParseWithDiags(Options.code());
+  EXPECT_TRUE(!ParsedOpt);
+  EXPECT_THAT(Collector.getDiags(),
+  testing::ElementsAre(AllOf(DiagMessage("unknown key 'Check'"),
+ DiagKind(llvm::SourceMgr::DK_Error),
+ DiagPos(Options.range().Begin),
+ DiagRange(Options.range();
+
+  Options = llvm::Annotations(R"(
+UseColor: [[NotABool]]
+  )");
+  ParsedOpt = ParseWithDiags(Options.code());
+  EXPECT_TRUE(!ParsedOpt);
+  EXPECT_THAT(Collector.getDiags(),
+  testing::ElementsAre(AllOf(DiagMessage("invalid boolean"),
+ DiagKind(llvm::SourceMgr::DK_Error),
+ DiagPos(Options.range().Begin),
+ DiagRange(Options.range();
+}
+
 namespace {
 class TestCheck : public ClangTidyCheck {
 public:
Index: clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS
   FrontendOpenMP
   Support
+  TestingSupport
   )
 
 get_filename_component(CLANG_LINT_SOURCE_DIR
Index: clang-tools-extra/clang-tidy/ClangTidyOptions.h
===
--- clang-tools-extra/clang-tidy/ClangTidyOpt

[PATCH] D92756: [clang-tidy] Support all YAML supported spellings for bools in CheckOptions.

2020-12-12 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 311388.
njames93 added a comment.

Fix test failures and added some to demonstrate this behaviour. Haven't added 
exhaustive cases as they are present in the YAML parser tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92756

Files:
  clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp


Index: clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
===
--- clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
+++ clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
@@ -195,8 +195,9 @@
   CheckOptions["test.BoolIFalseValue"] = "0";
   CheckOptions["test.BoolTrueValue"] = "true";
   CheckOptions["test.BoolFalseValue"] = "false";
+  CheckOptions["test.BoolTrueShort"] = "Y";
+  CheckOptions["test.BoolFalseShort"] = "N";
   CheckOptions["test.BoolUnparseable"] = "Nothing";
-  CheckOptions["test.BoolCaseMismatch"] = "True";
 
   ClangTidyContext Context(std::make_unique(
   ClangTidyGlobalOptions(), Options));
@@ -227,12 +228,11 @@
   CHECK_VAL(TestCheck.getIntLocal("BoolIFalseValue"), false);
   CHECK_VAL(TestCheck.getIntLocal("BoolTrueValue"), true);
   CHECK_VAL(TestCheck.getIntLocal("BoolFalseValue"), false);
+  CHECK_VAL(TestCheck.getIntLocal("BoolTrueShort"), true);
+  CHECK_VAL(TestCheck.getIntLocal("BoolFalseShort"), false);
   CHECK_ERROR_INT(TestCheck.getIntLocal("BoolUnparseable"),
   "invalid configuration value 'Nothing' for option "
   "'test.BoolUnparseable'; expected a bool");
-  CHECK_ERROR_INT(TestCheck.getIntLocal("BoolCaseMismatch"),
-  "invalid configuration value 'True' for option "
-  "'test.BoolCaseMismatch'; expected a bool");
 
 #undef CHECK_ERROR_INT
 }
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -73,6 +73,9 @@
   ` and
   :doc:`modernize-make-unique `.
 
+- CheckOptions that take boolean values now support all spellings supported in 
+  the `YAML format `_.
+
 New modules
 ^^^
 
Index: clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
===
--- clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
@@ -11,6 +11,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/WithColor.h"
+#include "llvm/Support/YAMLParser.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {
@@ -108,13 +109,14 @@
 
 static llvm::Expected getAsBool(StringRef Value,
   const llvm::Twine &LookupName) {
-  if (Value == "true")
-return true;
-  if (Value == "false")
-return false;
-  bool Result;
-  if (!Value.getAsInteger(10, Result))
-return Result;
+
+  if (llvm::Optional Parsed = llvm::yaml::parseBool(Value))
+return *Parsed;
+  // To maintain backwards compatability, we support parsing numbers as
+  // booleans, even though its not supported in YAML.
+  long long Number;
+  if (!Value.getAsInteger(10, Number))
+return Number != 0;
   return llvm::make_error(LookupName.str(),
  Value.str(), true);
 }


Index: clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
===
--- clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
+++ clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
@@ -195,8 +195,9 @@
   CheckOptions["test.BoolIFalseValue"] = "0";
   CheckOptions["test.BoolTrueValue"] = "true";
   CheckOptions["test.BoolFalseValue"] = "false";
+  CheckOptions["test.BoolTrueShort"] = "Y";
+  CheckOptions["test.BoolFalseShort"] = "N";
   CheckOptions["test.BoolUnparseable"] = "Nothing";
-  CheckOptions["test.BoolCaseMismatch"] = "True";
 
   ClangTidyContext Context(std::make_unique(
   ClangTidyGlobalOptions(), Options));
@@ -227,12 +228,11 @@
   CHECK_VAL(TestCheck.getIntLocal("BoolIFalseValue"), false);
   CHECK_VAL(TestCheck.getIntLocal("BoolTrueValue"), true);
   CHECK_VAL(TestCheck.getIntLocal("BoolFalseValue"), false);
+  CHECK_VAL(TestCheck.getIntLocal("BoolTrueShort"), true);
+  CHECK_VAL(TestCheck.getIntLocal("BoolFalseShort"), false);
   CHECK_ERROR_INT(TestCheck.getIntLocal("BoolUnparseable"),
   "invalid configuration value 'Nothing' for option "
   "'test.BoolUnparseable'; expected a bool");
-  CHECK_ERROR_INT(TestCheck.getIntLocal("BoolCaseMismatch"),
-  "invalid configuration value 'True' for option "
-  

[PATCH] D92721: [PATCH] [clang] Create SPIRABIInfo to enable SPIR_FUNC calling convention

2020-12-12 Thread Melanie Blower via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG320af6b13839: Create SPIRABIInfo to enable SPIR_FUNC calling 
convention. (authored by mibintc).

Changed prior to commit:
  https://reviews.llvm.org/D92721?vs=311005&id=311387#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92721

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/complex-math.c
  clang/test/CodeGenOpenCL/builtins.cl
  clang/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  clang/test/CodeGenOpenCL/to_addr_builtin.cl
  clang/test/CodeGenOpenCLCXX/atexit.cl

Index: clang/test/CodeGenOpenCLCXX/atexit.cl
===
--- clang/test/CodeGenOpenCLCXX/atexit.cl
+++ clang/test/CodeGenOpenCLCXX/atexit.cl
@@ -5,7 +5,7 @@
 };
 S s;
 
-//CHECK-LABEL: define internal void @__cxx_global_var_init()
-//CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.S addrspace(4)*)* @_ZNU3AS41SD1Ev to void (i8*)*), i8* null, i8 addrspace(1)* @__dso_handle)
+//CHECK-LABEL: define internal spir_func void @__cxx_global_var_init()
+//CHECK: call spir_func i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.S addrspace(4)*)* @_ZNU3AS41SD1Ev to void (i8*)*), i8* null, i8 addrspace(1)* @__dso_handle)
 
-//CHECK: declare i32 @__cxa_atexit(void (i8*)*, i8*, i8 addrspace(1)*)
+//CHECK: declare spir_func i32 @__cxa_atexit(void (i8*)*, i8*, i8 addrspace(1)*)
Index: clang/test/CodeGenOpenCL/to_addr_builtin.cl
===
--- clang/test/CodeGenOpenCL/to_addr_builtin.cl
+++ clang/test/CodeGenOpenCL/to_addr_builtin.cl
@@ -14,74 +14,74 @@
   generic int *gen;
 
   //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(1)* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to i32 addrspace(1)*
   glob = to_global(glob);
   
   //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(3)* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to i32 addrspace(1)*
   glob = to_global(loc);
  
   //CHECK: %[[ARG:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to i32 addrspace(1)*
   glob = to_global(priv);
  
   //CHECK: %[[ARG:.*]] = bitcast i32 addrspace(4)* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to i32 addrspace(1)*
   glob = to_global(gen);
   
   //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(1)* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(3)* %[[RET]] to i32 addrspace(3)*
   loc = to_local(glob);
 
   //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(3)* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(3)* %[[RET]] to i32 addrspace(3)*
   loc = to_local(loc);
 
   //CHECK: %[[ARG:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(3)* %[[RET]] to i32 addrspace(3)*
   loc = to_local(priv);
 
   //CHECK: %[[ARG:.*]] = bitcast i32 addrspace(4)* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
+  //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
   //CHECK: %{{.*}} = bitcast i8 addrspace(3)* %[[RET]] to i32 addrspace(3)*
   loc = to_local(gen);
 
   //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(1)* %{{.*}} to i8 addrspace(4)*
-  //CHECK: %[[RET:.*]] = call i8* @__to_private(i8 addrspace(4)* %[[ARG]]

[clang] 320af6b - Create SPIRABIInfo to enable SPIR_FUNC calling convention.

2020-12-12 Thread Melanie Blower via cfe-commits

Author: Melanie Blower
Date: 2020-12-12T05:48:20-08:00
New Revision: 320af6b138391d289fe70db39c51da92e8d3d9df

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

LOG: Create SPIRABIInfo to enable SPIR_FUNC calling convention.

Background: Call to library arithmetic functions for div is emitted by the
compiler and it set wrong “C” calling convention for calls to these functions,
whereas library functions are declared with `spir_function` calling convention.
InstCombine optimization replaces such calls with “unreachable” instruction.
It looks like clang lacks SPIRABIInfo class which should specify default
calling conventions for “system” function calls. SPIR supports only
SPIR_FUNC and SPIR_KERNEL calling convention.

Reviewers: Erich Keane, Anastasia

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

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/complex-math.c
clang/test/CodeGenOpenCL/builtins.cl
clang/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
clang/test/CodeGenOpenCL/to_addr_builtin.cl
clang/test/CodeGenOpenCLCXX/atexit.cl

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index db7ae582b1d6..316a60c31fd4 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -4313,8 +4313,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   Int32Ty, llvm::ArrayRef(ArgTys), false);
   Value *BCast = Builder.CreatePointerCast(Arg1, I8PTy);
   return RValue::get(
-  Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
- {Arg0, BCast, PacketSize, PacketAlign}));
+  EmitRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name),
+  {Arg0, BCast, PacketSize, PacketAlign}));
 } else {
   assert(4 == E->getNumArgs() &&
  "Illegal number of parameters to pipe function");
@@ -4332,9 +4332,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   // it to i32.
   if (Arg2->getType() != Int32Ty)
 Arg2 = Builder.CreateZExtOrTrunc(Arg2, Int32Ty);
-  return RValue::get(Builder.CreateCall(
-  CGM.CreateRuntimeFunction(FTy, Name),
-  {Arg0, Arg1, Arg2, BCast, PacketSize, PacketAlign}));
+  return RValue::get(
+  EmitRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name),
+  {Arg0, Arg1, Arg2, BCast, PacketSize, PacketAlign}));
 }
   }
   // OpenCL v2.0 s6.13.16 ,s9.17.3.5 - Built-in pipe reserve read and write
@@ -4375,9 +4375,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 // it to i32.
 if (Arg1->getType() != Int32Ty)
   Arg1 = Builder.CreateZExtOrTrunc(Arg1, Int32Ty);
-return RValue::get(
-Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
-   {Arg0, Arg1, PacketSize, PacketAlign}));
+return RValue::get(EmitRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name),
+   {Arg0, Arg1, PacketSize, PacketAlign}));
   }
   // OpenCL v2.0 s6.13.16, s9.17.3.5 - Built-in pipe commit read and write
   // functions
@@ -4413,9 +4412,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 llvm::FunctionType::get(llvm::Type::getVoidTy(getLLVMContext()),
 llvm::ArrayRef(ArgTys), false);
 
-return RValue::get(
-Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
-   {Arg0, Arg1, PacketSize, PacketAlign}));
+return RValue::get(EmitRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name),
+   {Arg0, Arg1, PacketSize, PacketAlign}));
   }
   // OpenCL v2.0 s6.13.16.4 Built-in pipe query functions
   case Builtin::BIget_pipe_num_packets:
@@ -4438,8 +4436,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 llvm::FunctionType *FTy = llvm::FunctionType::get(
 Int32Ty, llvm::ArrayRef(ArgTys), false);
 
-return RValue::get(Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name),
-  {Arg0, PacketSize, PacketAlign}));
+return RValue::get(EmitRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name),
+   {Arg0, PacketSize, PacketAlign}));
   }
 
   // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
@@ -4461,7 +4459,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   NewArg = Builder.CreateBitOrPointerCast(Arg0, NewArgT);
 auto NewName = std::string("__") + E->getDirectCallee()->getName().str();

[PATCH] D92837: [X86] Support tilezero intrinsic and c interface for AMX.

2020-12-12 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke updated this revision to Diff 311375.
LuoYuanke added a comment.

a. Change tilezero back to be chained.

1. It avoid copy if several tilezero are same. Copy is expensive in AMX.
2. To keep the original order of amx intrinsics.

b. Refactor __tilezero interface.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92837

Files:
  clang/include/clang/Basic/BuiltinsX86_64.def
  clang/lib/Headers/amxintrin.h
  clang/test/CodeGen/X86/amx_api.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86InstrAMX.td
  llvm/lib/Target/X86/X86PreTileConfig.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/lib/Target/X86/X86RegisterInfo.td
  llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll

Index: llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
@@ -0,0 +1,35 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-tile -verify-machineinstrs | FileCheck %s
+
+define void @test_amx(i8* %pointer, i8* %base, i64 %stride) {
+; CHECK-LABEL: test_amx:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:movb $1, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:ldtilecfg -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, %ax
+; CHECK-NEXT:tilezero %tmm0
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm1
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm2
+; CHECK-NEXT:tdpbssd %tmm2, %tmm1, %tmm0
+; CHECK-NEXT:tilestored %tmm0, (%rdi,%rdx)
+; CHECK-NEXT:tilerelease
+; CHECK-NEXT:retq
+  %c = call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
+  %a = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %b = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %d = call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
+  call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %pointer, i64 %stride, x86_amx %d)
+
+  ret void
+}
+
+declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
+declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, i8*, i64)
+declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
+declare void @llvm.x86.tilestored64.internal(i16, i16, i8*, i64, x86_amx)
Index: llvm/lib/Target/X86/X86RegisterInfo.td
===
--- llvm/lib/Target/X86/X86RegisterInfo.td
+++ llvm/lib/Target/X86/X86RegisterInfo.td
@@ -639,7 +639,7 @@
 let CopyCost = -1 in // Don't allow copying of tile registers
 def TILE : RegisterClass<"X86", [x86amx], 8192,
  (sequence "TMM%u", 0, 7)> {let Size = 8192;}
-def TILECFG : RegisterClass<"X86", [v512i1], 512, (add TMMCFG)> {
+def TILECFG : RegisterClass<"X86", [untyped], 512, (add TMMCFG)> {
   let CopyCost = -1;  // Don't allow copying of tile config registers.
   let isAllocatable = 1;
   let Size = 512;
Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
===
--- llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -873,6 +873,7 @@
   // We only collect the tile shape that is defined.
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand &MO1 = MI->getOperand(1);
 MachineOperand &MO2 = MI->getOperand(2);
 ShapeT Shape(&MO1, &MO2, MRI);
Index: llvm/lib/Target/X86/X86PreTileConfig.cpp
===
--- llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -132,6 +132,7 @@
 llvm_unreachable("Unexpected machine instruction on tile");
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand &MO1 = const_cast(MI.getOperand(1));
 MachineOperand &MO2 = const_cast(MI.getOperand(2));
 ShapeT Shape(&MO1, &MO2, MRI);
@@ -230,6 +231,7 @@
   case X86::PTILELOADDV:
   case X86::PTILESTOREDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 unsigned NumOperands = MI.getNumOperands();
 MI.RemoveOperand(NumOperands - 1);
 MI.addOperand(MF, MachineOperand::CreateReg(CFG, false));
Index: llvm/lib/Target/X86/X86InstrAMX.td
===
--- llvm/lib/Target/X86/X86InstrAMX.td
+++ llvm/lib/Target/X86/X86InstrAMX.td
@@ -62,6 +62,9 @@
 def PTILESTOREDV : PseudoI<(outs), (ins GR16:$src1,

[clang] adf3c27 - [clang][cli] Revert accidental access-control flag rename

2020-12-12 Thread Jan Svoboda via cfe-commits

Author: Jan Svoboda
Date: 2020-12-12T11:26:53+01:00
New Revision: adf3c27742ed272e0785a305995a70078eda6fe3

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

LOG: [clang][cli] Revert accidental access-control flag rename

This commit 
 
introduced an accidental change, which renames `-faccess-control` and 
`-fno-access-control` to `-fno-access-control` and `-fno-no-access-control`.

Reviewed By: dexonsmith, MaskRay

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 86760d0f400e..f7f5dd3547e3 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1000,7 +1000,7 @@ def fPIC : Flag<["-"], "fPIC">, Group;
 def fno_PIC : Flag<["-"], "fno-PIC">, Group;
 def fPIE : Flag<["-"], "fPIE">, Group;
 def fno_PIE : Flag<["-"], "fno-PIE">, Group;
-defm access_control : OptOutFFlag<"no-access-control", "", "Disable C++ access 
control">;
+defm access_control : OptOutFFlag<"access-control", "", "Disable C++ access 
control">;
 def falign_functions : Flag<["-"], "falign-functions">, Group;
 def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group;
 def fno_align_functions: Flag<["-"], "fno-align-functions">, Group;



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


[PATCH] D93104: [clang][cli] Revert accidental access-control flag rename

2020-12-12 Thread Jan Svoboda via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGadf3c27742ed: [clang][cli] Revert accidental access-control 
flag rename (authored by jansvoboda11).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93104

Files:
  clang/include/clang/Driver/Options.td


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1000,7 +1000,7 @@
 def fno_PIC : Flag<["-"], "fno-PIC">, Group;
 def fPIE : Flag<["-"], "fPIE">, Group;
 def fno_PIE : Flag<["-"], "fno-PIE">, Group;
-defm access_control : OptOutFFlag<"no-access-control", "", "Disable C++ access 
control">;
+defm access_control : OptOutFFlag<"access-control", "", "Disable C++ access 
control">;
 def falign_functions : Flag<["-"], "falign-functions">, Group;
 def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group;
 def fno_align_functions: Flag<["-"], "fno-align-functions">, Group;


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1000,7 +1000,7 @@
 def fno_PIC : Flag<["-"], "fno-PIC">, Group;
 def fPIE : Flag<["-"], "fPIE">, Group;
 def fno_PIE : Flag<["-"], "fno-PIE">, Group;
-defm access_control : OptOutFFlag<"no-access-control", "", "Disable C++ access control">;
+defm access_control : OptOutFFlag<"access-control", "", "Disable C++ access control">;
 def falign_functions : Flag<["-"], "falign-functions">, Group;
 def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group;
 def fno_align_functions: Flag<["-"], "fno-align-functions">, Group;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93104: [clang][cli] Revert accidental access-control flag rename

2020-12-12 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added a comment.

> (Or maybe OptOutFFLag could reject an option beginning with `"no-"`?)

I think this is reasonable. I'll reach out to the mailing list to see if 
there's a way to add assertions to TableGen that would catch this.

> Thanks! Sorry for the breakage.

No problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93104

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


[PATCH] D92775: [clang][cli] Add flexible TableGen multiclass for boolean options

2020-12-12 Thread Jan Svoboda via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6baa9769ed57: [clang][cli] Add flexible TableGen multiclass 
for boolean options (authored by jansvoboda11).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92775

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/unittests/Frontend/CompilerInvocationTest.cpp
  llvm/include/llvm/Option/OptParser.td

Index: llvm/include/llvm/Option/OptParser.td
===
--- llvm/include/llvm/Option/OptParser.td
+++ llvm/include/llvm/Option/OptParser.td
@@ -171,10 +171,12 @@
   code ValueExtractor = "(extractMaskValue)";
 }
 
-class MarshallingInfoBooleanFlag
+// Marshalling info for booleans. Applied to the flag setting keypath to false.
+class MarshallingInfoBooleanFlag
   : MarshallingInfoFlag {
-  code Normalizer = "makeBooleanFlagNormalizer(OPT_"#neg_name#")";
-  code Denormalizer = "makeBooleanFlagDenormalizer(\""#neg_spelling#"\")";
+  code Normalizer = "makeBooleanOptionNormalizer("#value#", "#other_value#", OPT_"#other_name#")";
+  code Denormalizer = "makeBooleanOptionDenormalizer("#value#", \""#other_spelling#"\")";
 }
 
 // Mixins for additional marshalling attributes.
Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -88,7 +88,9 @@
   ASSERT_FALSE(Diags->hasErrorOccurred());
   ASSERT_TRUE(Invocation.getCodeGenOpts().Autolink);
 
-  // TODO: Test argument generation.
+  Invocation.generateCC1CommandLine(GeneratedArgs, *this);
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fautolink";
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-autolink";
 }
 
 TEST_F(CommandLineTest, BoolOptionDefaultTruePresentNegChange) {
@@ -98,7 +100,9 @@
   ASSERT_FALSE(Diags->hasErrorOccurred());
   ASSERT_FALSE(Invocation.getCodeGenOpts().Autolink);
 
-  // TODO: Test argument generation.
+  Invocation.generateCC1CommandLine(GeneratedArgs, *this);
+  ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fno-autolink")));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fautolink";
 }
 
 TEST_F(CommandLineTest, BoolOptionDefaultTruePresentPosReset) {
@@ -120,7 +124,9 @@
   ASSERT_FALSE(Diags->hasErrorOccurred());
   ASSERT_FALSE(Invocation.getCodeGenOpts().NoInlineLineTables);
 
-  // TODO: Test argument generation.
+  Invocation.generateCC1CommandLine(GeneratedArgs, *this);
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-ginline-line-tables";
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-gno-inline-line-tables";
 }
 
 TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNegChange) {
@@ -130,7 +136,9 @@
   ASSERT_FALSE(Diags->hasErrorOccurred());
   ASSERT_TRUE(Invocation.getCodeGenOpts().NoInlineLineTables);
 
-  // TODO: Test argument generation.
+  Invocation.generateCC1CommandLine(GeneratedArgs, *this);
+  ASSERT_THAT(GeneratedArgs, Contains(StrEq("-gno-inline-line-tables")));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-ginline-line-tables";
 }
 
 TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentPosReset) {
@@ -152,7 +160,9 @@
   ASSERT_FALSE(Diags->hasErrorOccurred());
   ASSERT_FALSE(Invocation.getCodeGenOpts().CodeViewGHash);
 
-  // TODO: Test argument generation.
+  Invocation.generateCC1CommandLine(GeneratedArgs, *this);
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-gcodeview-ghash";
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-gno-codeview-ghash";
 }
 
 TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentPosChange) {
@@ -162,7 +172,9 @@
   ASSERT_FALSE(Diags->hasErrorOccurred());
   ASSERT_TRUE(Invocation.getCodeGenOpts().CodeViewGHash);
 
-  // TODO: Test argument generation.
+  Invocation.generateCC1CommandLine(GeneratedArgs, *this);
+  ASSERT_THAT(GeneratedArgs, Contains(StrEq("-gcodeview-ghash")));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-gno-codeview-ghash";
 }
 
 TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNegReset) {
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -185,20 +185,24 @@
   return FlagToValueNormalizer{std::move(Value)};
 }
 
-static auto makeBooleanFlagNormalizer(OptSpecifier NegOpt) {
-  return [NegOpt](OptSpecifier PosOpt, unsigned, const ArgList &Args,
-  DiagnosticsEngine &) -> Optional {
-if (const Arg *A = Args.getLastArg(PosOpt, NegOpt))
-  return A->getOption().matches(PosOpt);
+static auto makeBooleanOptionNormalizer(bool Value, bool OtherValue,
+OptSpecifier Oth

[clang] 6baa976 - [clang][cli] Add flexible TableGen multiclass for boolean options

2020-12-12 Thread Jan Svoboda via cfe-commits

Author: Jan Svoboda
Date: 2020-12-12T10:53:28+01:00
New Revision: 6baa9769ed573741290fb186d02df7cf676fc8de

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

LOG: [clang][cli] Add flexible TableGen multiclass for boolean options

This introduces more flexible multiclass for declaring two flags controlling 
the same boolean keypath.

Compared to existing Opt{In,Out}FFlag multiclasses, the new syntax makes it 
easier to read option declarations and reason about the keypath.

This also makes specifying common properties of both flags possible.

I'm open to suggestions on the class names. Not 100% sure the benefits are 
worth the added complexity.

Depends on D92774.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/unittests/Frontend/CompilerInvocationTest.cpp
llvm/include/llvm/Option/OptParser.td

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 725afc7e1bb3..86760d0f400e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -268,10 +268,234 @@ multiclass OptOutFFlag;
 }
 
-multiclass BooleanMarshalledFFlag {
-  def fno_#NAME : Flag<["-"], "fno-"#name>, HelpText;
-  def f#NAME : Flag<["-"], "f"#name>, HelpText,
-MarshallingInfoBooleanFlag;
+//===--===//
+// BoolOptionBase
+//===--===//
+
+// Default value of the keypath associated with a marshalled bool option.
+class Default { code Value = value; }
+
+class FlagPolarity { bit Value = value; }
+def PosFlag : FlagPolarity {}
+def NegFlag : FlagPolarity {}
+
+// Definition of a single command line flag.
+class FlagDef option_flags,
+  string help, list implied_by_options = []> {
+  // Negative polarity (false) implies a command line spelling prefixed with
+  // "no-" and a TableGen record whose name is prefixed with "no_".
+  FlagPolarity Polarity = polarity;
+
+  // The value assigned to keypath when the flag is present on the command 
line.
+  bit Value = value;
+
+  // List of OptionFlag records that control the visibility of the flag in
+  // 
diff erent scenarios.
+  list OptionFlags = option_flags;
+
+  // The help text associated with the flag.
+  string Help = help;
+
+  // List of options that imply this flag when present on command line.
+  list ImpliedBy = implied_by_options;
+}
+
+// Information extending a FlagDef.
+class FlagDefSuffix option_flags, string help> {
+  list OptionFlags = option_flags;
+  string Help = help;
+}
+
+// Extend the flag definition with a suffix.
+class ApplySuffix {
+  FlagDef Result
+= FlagDef;
+}
+
+// FlagDef extension. Convenient for creation of TableGen records.
+class FlagDefExpanded
+  : FlagDef {
+  // Name of the TableGen record.
+  string RecordName = prefix#!cond(flag.Polarity.Value : "", true : 
"no_")#name;
+
+  // Spelling of the flag.
+  string Spelling
+= prefix#!cond(flag.Polarity.Value : "", true : "no-")#spelling;
+
+  // Does the flag have CC1Option?
+  bit IsCC1 = !not(!empty(!filter(opt_flag, flag.OptionFlags,
+  !eq(opt_flag, CC1Option;
+
+  // Can the flag be implied by another flag?
+  bit CanBeImplied = !not(!empty(flag.ImpliedBy));
+
+  // C++ code that will be assigned to the keypath when the flag is present.
+  code ValueAsCode = !cond(flag.Value : "true", true: "false");
+}
+
+// Creates simple flag record.
+class BoolOptionFlag
+  : Flag<["-"], flag.Spelling>, Flags, HelpText {}
+
+// Creates marshalled flag record.
+class CC1BoolOptionFlag
+  : Flag<["-"], flag.Spelling>, Flags, HelpText,
+MarshallingInfoBooleanFlag,
+ImpliedByAnyOf {}
+
+// Generates TableGen records for two command line flags that control the same
+// keypath via the marshalling infrastructure.
+// Names of the records consist of the specified prefix, "no_" for the negative
+// flag, and NAME.
+// BoolOption is the API that should be used most of the time. Use this only
+// when you need more control (e.g. to represent a marshalled option whose
+// keypath defaults to an arbitrarily complex boolean expression).
+multiclass BoolOptionBase,
+  string prefix = ""> {
+  defvar flag1 = FlagDefExpanded.Result,
+ prefix, NAME, spelling_base>;
+
+  defvar flag2 = FlagDefExpanded.Result,
+ prefix, NAME, spelling_base>;
+
+  // TODO: Assert that the flags have 
diff erent polarity.
+  // TODO: Assert that the flags have 
diff erent value.
+  // TODO: Assert that 

[PATCH] D92775: [clang][cli] Add flexible TableGen multiclass for boolean options

2020-12-12 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added a comment.

I was, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92775

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


[clang] 10f4057 - [clang][cli] Don't always emit -f[no-]legacy-pass-manager

2020-12-12 Thread Jan Svoboda via cfe-commits

Author: Jan Svoboda
Date: 2020-12-12T10:11:23+01:00
New Revision: 10f40576f7b482dc55b9a0ba780c294c4e45817c

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

LOG: [clang][cli] Don't always emit -f[no-]legacy-pass-manager

We don't need to always generate `-f[no-]experimental-new-pass-manager`.

This patch does not change the behavior of any other command line flag. (For 
example `-triple` is still being always generated.)

Reviewed By: dexonsmith, Bigcheese

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

Added: 


Modified: 
clang/unittests/Frontend/CompilerInvocationTest.cpp
llvm/include/llvm/Option/OptParser.td

Removed: 




diff  --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp 
b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index c2dc35ce5d32..d5b5d15b1071 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -198,7 +198,7 @@ TEST_F(CommandLineTest, 
BoolOptionDefaultArbitraryTwoFlagsPresentNone) {
 
   Invocation.generateCC1CommandLine(GeneratedArgs, *this);
 
-  ASSERT_THAT(GeneratedArgs, Contains(StrEq(PassManagerResetByFlag)));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag;
   ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag;
 }
 
@@ -222,7 +222,7 @@ TEST_F(CommandLineTest, 
BoolOptionDefaultArbitraryTwoFlagsPresentReset) {
   ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, PassManagerDefault);
 
   Invocation.generateCC1CommandLine(GeneratedArgs, *this);
-  ASSERT_THAT(GeneratedArgs, Contains(StrEq(PassManagerResetByFlag)));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag;
   ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag;
 }
 

diff  --git a/llvm/include/llvm/Option/OptParser.td 
b/llvm/include/llvm/Option/OptParser.td
index 9a935b5d9e6e..f08dfd3ccf04 100644
--- a/llvm/include/llvm/Option/OptParser.td
+++ b/llvm/include/llvm/Option/OptParser.td
@@ -173,7 +173,6 @@ class MarshallingInfoBitfieldFlag
 
 class MarshallingInfoBooleanFlag
   : MarshallingInfoFlag {
-  bit ShouldAlwaysEmit = 1;
   code Normalizer = "makeBooleanFlagNormalizer(OPT_"#neg_name#")";
   code Denormalizer = "makeBooleanFlagDenormalizer(\""#neg_spelling#"\")";
 }



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


[PATCH] D92857: [clang][cli] Don't always emit -f[no-]legacy-pass-manager

2020-12-12 Thread Jan Svoboda via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG10f40576f7b4: [clang][cli] Don't always emit 
-f[no-]legacy-pass-manager (authored by jansvoboda11).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92857

Files:
  clang/unittests/Frontend/CompilerInvocationTest.cpp
  llvm/include/llvm/Option/OptParser.td


Index: llvm/include/llvm/Option/OptParser.td
===
--- llvm/include/llvm/Option/OptParser.td
+++ llvm/include/llvm/Option/OptParser.td
@@ -173,7 +173,6 @@
 
 class MarshallingInfoBooleanFlag
   : MarshallingInfoFlag {
-  bit ShouldAlwaysEmit = 1;
   code Normalizer = "makeBooleanFlagNormalizer(OPT_"#neg_name#")";
   code Denormalizer = "makeBooleanFlagDenormalizer(\""#neg_spelling#"\")";
 }
Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -198,7 +198,7 @@
 
   Invocation.generateCC1CommandLine(GeneratedArgs, *this);
 
-  ASSERT_THAT(GeneratedArgs, Contains(StrEq(PassManagerResetByFlag)));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag;
   ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag;
 }
 
@@ -222,7 +222,7 @@
   ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, PassManagerDefault);
 
   Invocation.generateCC1CommandLine(GeneratedArgs, *this);
-  ASSERT_THAT(GeneratedArgs, Contains(StrEq(PassManagerResetByFlag)));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag;
   ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag;
 }
 


Index: llvm/include/llvm/Option/OptParser.td
===
--- llvm/include/llvm/Option/OptParser.td
+++ llvm/include/llvm/Option/OptParser.td
@@ -173,7 +173,6 @@
 
 class MarshallingInfoBooleanFlag
   : MarshallingInfoFlag {
-  bit ShouldAlwaysEmit = 1;
   code Normalizer = "makeBooleanFlagNormalizer(OPT_"#neg_name#")";
   code Denormalizer = "makeBooleanFlagDenormalizer(\""#neg_spelling#"\")";
 }
Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -198,7 +198,7 @@
 
   Invocation.generateCC1CommandLine(GeneratedArgs, *this);
 
-  ASSERT_THAT(GeneratedArgs, Contains(StrEq(PassManagerResetByFlag)));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag;
   ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag;
 }
 
@@ -222,7 +222,7 @@
   ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, PassManagerDefault);
 
   Invocation.generateCC1CommandLine(GeneratedArgs, *this);
-  ASSERT_THAT(GeneratedArgs, Contains(StrEq(PassManagerResetByFlag)));
+  ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag;
   ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92774: [clang][cli] CompilerInvocationTest: add tests for boolean options

2020-12-12 Thread Jan Svoboda via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6f26a6de489e: Reland "[clang][cli] 
CompilerInvocationTest: add tests for boolean options" (authored by 
jansvoboda11).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92774

Files:
  clang/unittests/Frontend/CompilerInvocationTest.cpp

Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -77,6 +77,155 @@
   ASSERT_TRUE(Invocation.getFrontendOpts().UseTemporary);
 }
 
+// Boolean option with a keypath that defaults to true.
+// The flag with negative spelling can set the keypath to false.
+// The flag with positive spelling can reset the keypath to true.
+
+TEST_F(CommandLineTest, BoolOptionDefaultTruePresentNone) {
+  const char *Args[] = {""};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_TRUE(Invocation.getCodeGenOpts().Autolink);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultTruePresentNegChange) {
+  const char *Args[] = {"-fno-autolink"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_FALSE(Invocation.getCodeGenOpts().Autolink);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultTruePresentPosReset) {
+  const char *Args[] = {"-fautolink"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_TRUE(Diags->hasErrorOccurred()); // Driver-only flag.
+  ASSERT_TRUE(Invocation.getCodeGenOpts().Autolink);
+}
+
+// Boolean option with a keypath that defaults to false.
+// The flag with negative spelling can set the keypath to true.
+// The flag with positive spelling can reset the keypath to false.
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNone) {
+  const char *Args[] = {""};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_FALSE(Invocation.getCodeGenOpts().NoInlineLineTables);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNegChange) {
+  const char *Args[] = {"-gno-inline-line-tables"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_TRUE(Invocation.getCodeGenOpts().NoInlineLineTables);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentPosReset) {
+  const char *Args[] = {"-ginline-line-tables"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_TRUE(Diags->hasErrorOccurred()); // Driver-only flag.
+  ASSERT_FALSE(Invocation.getCodeGenOpts().NoInlineLineTables);
+}
+
+// Boolean option with a keypath that defaults to false.
+// The flag with positive spelling can set the keypath to true.
+// The flag with negative spelling can reset the keypath to false.
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNoneX) {
+  const char *Args[] = {""};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_FALSE(Invocation.getCodeGenOpts().CodeViewGHash);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentPosChange) {
+  const char *Args[] = {"-gcodeview-ghash"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_TRUE(Invocation.getCodeGenOpts().CodeViewGHash);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNegReset) {
+  const char *Args[] = {"-gno-codeview-ghash"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_TRUE(Diags->hasErrorOccurred()); // Driver-only flag.
+  ASSERT_FALSE(Invocation.getCodeGenOpts().CodeViewGHash);
+}
+
+// Boolean option with a keypath that defaults to an arbitrary expression.
+// The flag with positive spelling can set the keypath to true.
+// The flag with negative spelling can set the keypath to false.
+
+static constexpr unsigned PassManagerDefault =
+!static_cast(LLVM_ENABLE_NEW_PASS_MANAGER);
+
+static constexpr const char *PassManagerResetByFlag =
+LLVM_ENABLE_NEW_PASS_MANAGER ? "-fno-legacy-pass-manager"
+ : "-flegacy-pass-manager";
+
+static constexpr const char *PassManagerChangedByFlag =
+LLVM_ENABLE_NEW_PASS_MANAGER ? "-flegacy-pass-manager"
+ : "-fno-legacy-pass-manager";
+
+TEST_F(CommandLineTest, BoolOptionDefaultArbitraryTwoFlagsPresentNone) {
+  const char *Args = {""};
+
+  CompilerInvocat

[clang] 6f26a6d - Reland "[clang][cli] CompilerInvocationTest: add tests for boolean options"

2020-12-12 Thread Jan Svoboda via cfe-commits

Author: Jan Svoboda
Date: 2020-12-12T09:46:20+01:00
New Revision: 6f26a6de489e66830c3181b747f6b18e439f36be

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

LOG: Reland "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation 
instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/unittests/Frontend/CompilerInvocationTest.cpp

Removed: 




diff  --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp 
b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index c3bdd6bff65c..c2dc35ce5d32 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -77,6 +77,155 @@ TEST_F(CommandLineTest, 
BoolOptionDefaultTrueSingleFlagUnknownPresent) {
   ASSERT_TRUE(Invocation.getFrontendOpts().UseTemporary);
 }
 
+// Boolean option with a keypath that defaults to true.
+// The flag with negative spelling can set the keypath to false.
+// The flag with positive spelling can reset the keypath to true.
+
+TEST_F(CommandLineTest, BoolOptionDefaultTruePresentNone) {
+  const char *Args[] = {""};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_TRUE(Invocation.getCodeGenOpts().Autolink);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultTruePresentNegChange) {
+  const char *Args[] = {"-fno-autolink"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_FALSE(Invocation.getCodeGenOpts().Autolink);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultTruePresentPosReset) {
+  const char *Args[] = {"-fautolink"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_TRUE(Diags->hasErrorOccurred()); // Driver-only flag.
+  ASSERT_TRUE(Invocation.getCodeGenOpts().Autolink);
+}
+
+// Boolean option with a keypath that defaults to false.
+// The flag with negative spelling can set the keypath to true.
+// The flag with positive spelling can reset the keypath to false.
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNone) {
+  const char *Args[] = {""};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_FALSE(Invocation.getCodeGenOpts().NoInlineLineTables);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNegChange) {
+  const char *Args[] = {"-gno-inline-line-tables"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_TRUE(Invocation.getCodeGenOpts().NoInlineLineTables);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentPosReset) {
+  const char *Args[] = {"-ginline-line-tables"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_TRUE(Diags->hasErrorOccurred()); // Driver-only flag.
+  ASSERT_FALSE(Invocation.getCodeGenOpts().NoInlineLineTables);
+}
+
+// Boolean option with a keypath that defaults to false.
+// The flag with positive spelling can set the keypath to true.
+// The flag with negative spelling can reset the keypath to false.
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNoneX) {
+  const char *Args[] = {""};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_FALSE(Invocation.getCodeGenOpts().CodeViewGHash);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentPosChange) {
+  const char *Args[] = {"-gcodeview-ghash"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_FALSE(Diags->hasErrorOccurred());
+  ASSERT_TRUE(Invocation.getCodeGenOpts().CodeViewGHash);
+
+  // TODO: Test argument generation.
+}
+
+TEST_F(CommandLineTest, BoolOptionDefaultFalsePresentNegReset) {
+  const char *Args[] = {"-gno-codeview-ghash"};
+
+  CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+  ASSERT_TRUE(Diags->hasErrorOccurred()); // Driver-only flag.
+  ASSERT_FALSE(Invocation.getCodeGenOpts().CodeViewGHash);
+}
+
+// Boolean option with a keypath that defaults to an arbitrary expression.
+// The flag with positive spelling can set the keypath to true.
+// The flag with negative spelling can set the keypath to false.
+
+static constexpr unsigned PassManagerDefa