[clang-tools-extra] 5091357 - [clangd] Disable ScopedMemoryLimit on tsan builds

2023-01-17 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2023-01-17T09:09:08+01:00
New Revision: 5091357e1ba8bc709680c327fe71a90676f86197

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

LOG: [clangd] Disable ScopedMemoryLimit on tsan builds

This is causing flakiness, see 
https://lab.llvm.org/buildbot/#/builders/131/builds/39272

Added: 


Modified: 
clang-tools-extra/clangd/unittests/SerializationTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/SerializationTests.cpp 
b/clang-tools-extra/clangd/unittests/SerializationTests.cpp
index 38e8612e3803e..35a2e2ba77a65 100644
--- a/clang-tools-extra/clangd/unittests/SerializationTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SerializationTests.cpp
@@ -325,7 +325,7 @@ TEST(SerializationTest, CmdlTest) {
 // rlimit is part of POSIX. RLIMIT_AS does not exist in OpenBSD.
 // Sanitizers use a lot of address space, so we can't apply strict limits.
 #if LLVM_ON_UNIX && defined(RLIMIT_AS) && !LLVM_ADDRESS_SANITIZER_BUILD && 
\
-!LLVM_MEMORY_SANITIZER_BUILD
+!LLVM_MEMORY_SANITIZER_BUILD && !LLVM_THREAD_SANITIZER_BUILD
 class ScopedMemoryLimit {
   struct rlimit OriginalLimit;
   bool Succeeded = false;



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


[PATCH] D141389: [DFSAN] Add support for strnlen, strncat, strsep, sscanf and _tolower

2023-01-17 Thread Andrew via Phabricator via cfe-commits
browneee added inline comments.



Comment at: compiler-rt/lib/dfsan/dfsan_custom.cpp:213
+  char *res = strsep(s, delim);
+  s_label = dfsan_read_label(base, strlen(base));
+  if (res && (res != base)) {

tkuchta wrote:
> browneee wrote:
> > The `s_label` represents the taint label for `s` (the pointer).
> > 
> > This line would clobber the taint label of the pointer (`s`) with a taint 
> > label from `s[0][0..n]`.
> > 
> > I think this line should be deleted.
> Agree, s_label represents the taint associated with the **s pointer. However 
> I am now wondering if that is the taint wich we would like to return.
> For example, if we have
> if (flags().strict_data_dependencies) {
> *ret_label = res ? s_label : 0;
> 
> We would taint the return value with the value of the pointer, not the data. 
> It means that if we operate on a string for which the characters are tainted, 
> but the pointer itself isn't, we are likely going to return label 0. My 
> understanding was that we are more concerned with the taint of the data, not 
> the pointer, am I missing something?
> 
Yes, we are usually more concerned with the taint of the data, not the pointer.

With strict dependencies:
// If the input pointer is tainted, the output pointer would be tainted 
(because it is derived from the input pointer - maybe the same value).
taint(s[0]) == dfsan_read_label(s, sizeof(s)) > taint(ret) == ret_label[0]

// If the input data is tainted, the output data would be tainted (because it 
is derived from the input data).
taint(s[0][0]) == MEM_TO_SHADOW(s[0])[0] > taint(ret[0]) == 
MEM_TO_SHADOW(ret)[0]

Because s[0] == ret  (or ret==null), (for the non-null case) the output shadow 
bytes are the same bytes as input shadow bytes and so these taint labels for 
the string data in shadow memory do not need to be explicitly propagated in 
this function. 

I think the only case actually changing/copying string data is writing a 
delimiter byte to NULL, which you handled.


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

https://reviews.llvm.org/D141389

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


[PATCH] D141497: [clang][Interp] Record initialization via conditional operator

2023-01-17 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 489720.

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

https://reviews.llvm.org/D141497

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/ByteCodeExprGen.h
  clang/test/AST/Interp/records.cpp

Index: clang/test/AST/Interp/records.cpp
===
--- clang/test/AST/Interp/records.cpp
+++ clang/test/AST/Interp/records.cpp
@@ -335,3 +335,14 @@
   constexpr piecewise_construct_t piecewise_construct =
 piecewise_construct_t();
 };
+
+namespace ConditionalInit {
+  struct S { int a; };
+
+  constexpr S getS(bool b) {
+return b ? S{12} : S{13};
+  }
+
+  static_assert(getS(true).a == 12, "");
+  static_assert(getS(false).a == 13, "");
+};
Index: clang/lib/AST/Interp/ByteCodeExprGen.h
===
--- clang/lib/AST/Interp/ByteCodeExprGen.h
+++ clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -179,6 +179,9 @@
 return this->emitPopPtr(I);
   }
 
+  template 
+  bool visitConditional(const AbstractConditionalOperator *E, Visitor V);
+
   /// Creates a local primitive value.
   unsigned allocateLocalPrimitive(DeclTy &&Decl, PrimType Ty, bool IsMutable,
   bool IsExtended = false);
Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp
===
--- clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -589,32 +589,12 @@
 template 
 bool ByteCodeExprGen::VisitAbstractConditionalOperator(
 const AbstractConditionalOperator *E) {
-  const Expr *Condition = E->getCond();
-  const Expr *TrueExpr = E->getTrueExpr();
-  const Expr *FalseExpr = E->getFalseExpr();
-
-  LabelTy LabelEnd = this->getLabel();   // Label after the operator.
-  LabelTy LabelFalse = this->getLabel(); // Label for the false expr.
-
-  if (!this->visit(Condition))
-return false;
-  if (!this->jumpFalse(LabelFalse))
-return false;
-
-  if (!this->visit(TrueExpr))
-return false;
-  if (!this->jump(LabelEnd))
-return false;
-
-  this->emitLabel(LabelFalse);
-
-  if (!this->visit(FalseExpr))
-return false;
-
-  this->fallthrough(LabelEnd);
-  this->emitLabel(LabelEnd);
-
-  return true;
+  struct Visitor {
+ByteCodeExprGen *BEG;
+bool visit(const Expr *E) { return BEG->visit(E); }
+  };
+  Visitor V{this};
+  return this->visitConditional(E, V);
 }
 
 template 
@@ -929,6 +909,41 @@
   }
 }
 
+/// Visit a conditional operator, i.e. `A ? B : C`.
+/// \V determines what function to call for the B and C expressions.
+template 
+template 
+bool ByteCodeExprGen::visitConditional(
+const AbstractConditionalOperator *E, Visitor V) {
+
+  const Expr *Condition = E->getCond();
+  const Expr *TrueExpr = E->getTrueExpr();
+  const Expr *FalseExpr = E->getFalseExpr();
+
+  LabelTy LabelEnd = this->getLabel();   // Label after the operator.
+  LabelTy LabelFalse = this->getLabel(); // Label for the false expr.
+
+  if (!this->visit(Condition))
+return false;
+  if (!this->jumpFalse(LabelFalse))
+return false;
+
+  if (!V.visit(TrueExpr))
+return false;
+  if (!this->jump(LabelEnd))
+return false;
+
+  this->emitLabel(LabelFalse);
+
+  if (!V.visit(FalseExpr))
+return false;
+
+  this->fallthrough(LabelEnd);
+  this->emitLabel(LabelEnd);
+
+  return true;
+}
+
 template 
 bool ByteCodeExprGen::visitZeroInitializer(PrimType T, const Expr *E) {
   switch (T) {
@@ -1419,6 +1434,14 @@
 return this->visitInitializer(CE->getSubExpr());
   } else if (const auto *CE = dyn_cast(Initializer)) {
 return this->visitInitializer(CE->getSubExpr());
+  } else if (const auto *ACO =
+ dyn_cast(Initializer)) {
+struct Visitor {
+  ByteCodeExprGen *BEG;
+  bool visit(const Expr *E) { return BEG->visitRecordInitializer(E); }
+};
+Visitor V{this};
+return this->visitConditional(ACO, V);
   }
 
   // Explictly reject these. They only get generated for invalid code.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141497: [clang][Interp] Record initialization via conditional operator

2023-01-17 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments.



Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:200
+  using ExprVisitorFunc = std::function;
+  bool visitConditional(const AbstractConditionalOperator *E,
+ExprVisitorFunc VisitFunc);

tbaeder wrote:
> erichkeane wrote:
> > I'd probably rather make this a template taking a functor, rather than 
> > bringing in the atrocities that come with std::function.
> Alright, will look into that
Done. Not sure if this is exactly how you meant it to look. Feels a bit 
inelegant.


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

https://reviews.llvm.org/D141497

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


[PATCH] D139926: [clangd] Add semantic token for angle brackets

2023-01-17 Thread Christian Kandeler via Phabricator via cfe-commits
ckandeler updated this revision to Diff 489722.
ckandeler marked 2 inline comments as done.
ckandeler retitled this revision from "[clangd] Add semantic tokens for angle 
brackets" to "[clangd] Add semantic token for angle brackets".
ckandeler added a comment.

Added test cases, merged the two HighlightingKinds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139926

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/SemanticHighlighting.h
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -130,17 +130,17 @@
 )cpp",
   R"cpp(
   namespace $Namespace_decl[[abc]] {
-template
+template$AngleBracket[[<]]typename $TemplateParameter_def[[T]]$AngleBracket[[>]]
 struct $Class_def[[A]] {
   $TemplateParameter[[T]] $Field_decl[[t]];
 };
   }
-  template
-  struct $Class_def[[C]] : $Namespace[[abc]]::$Class[[A]]<$TemplateParameter[[T]]> {
+  template$AngleBracket[[<]]typename $TemplateParameter_def[[T]]$AngleBracket[[>]]
+  struct $Class_def[[C]] : $Namespace[[abc]]::$Class[[A]]$AngleBracket[[<]]$TemplateParameter[[T]]$AngleBracket[[>]] {
 typename $TemplateParameter[[T]]::$Type_dependentName[[A]]* $Field_decl[[D]];
   };
-  $Namespace[[abc]]::$Class[[A]] $Variable_def[[AA]];
-  typedef $Namespace[[abc]]::$Class[[A]] $Class_decl[[AAA]];
+  $Namespace[[abc]]::$Class[[A]]$AngleBracket[[<]]int$AngleBracket[[>]] $Variable_def[[AA]];
+  typedef $Namespace[[abc]]::$Class[[A]]$AngleBracket[[<]]int$AngleBracket[[>]] $Class_decl[[AAA]];
   struct $Class_def[[B]] {
 $Class_decl_constrDestr[[B]]();
 ~$Class_decl_constrDestr[[B]]();
@@ -243,36 +243,36 @@
   typedef float $Primitive_decl[[F]];
 )cpp",
   R"cpp(
-  template
+  template$AngleBracket[[<]]typename $TemplateParameter_def[[T]], typename = void$AngleBracket[[>]]
   class $Class_def[[A]] {
 $TemplateParameter[[T]] $Field_decl[[AA]];
 $TemplateParameter[[T]] $Method_decl[[foo]]();
   };
-  template
+  template$AngleBracket[[<]]class $TemplateParameter_def[[TT]]$AngleBracket[[>]]
   class $Class_def[[B]] {
-$Class[[A]]<$TemplateParameter[[TT]]> $Field_decl[[AA]];
+$Class[[A]]$AngleBracket[[<]]$TemplateParameter[[TT]]$AngleBracket[[>]] $Field_decl[[AA]];
   };
-  template
+  template$AngleBracket[[<]]class $TemplateParameter_def[[TT]], class $TemplateParameter_def[[GG]]$AngleBracket[[>]]
   class $Class_def[[BB]] {};
   template
   class $Class_def[[BB]]<$TemplateParameter[[T]], int> {};
   template
   class $Class_def[[BB]]<$TemplateParameter[[T]], $TemplateParameter[[T]]*> {};
 
-  template class $TemplateParameter_def[[T]], class $TemplateParameter_def[[C]]>
-  $TemplateParameter[[T]]<$TemplateParameter[[C]]> $Function_decl[[f]]();
+  template$AngleBracket[[<]]template$AngleBracket[[<]]class$AngleBracket[[>]] class $TemplateParameter_def[[T]], class $TemplateParameter_def[[C]]$AngleBracket[[>]]
+  $TemplateParameter[[T]]$AngleBracket[[<]]$TemplateParameter[[C]]$AngleBracket[[>]] $Function_decl[[f]]();
 
-  template
+  template$AngleBracket[[<]]typename$AngleBracket[[>]]
   class $Class_def[[Foo]] {};
 
-  template
+  template$AngleBracket[[<]]typename $TemplateParameter_def[[T]]$AngleBracket[[>]]
   void $Function_decl[[foo]]($TemplateParameter[[T]] ...);
 )cpp",
   R"cpp(
-  template 
+  template $AngleBracket[[<]]class $TemplateParameter_def[[T]]$AngleBracket[[>]]
   struct $Class_def[[Tmpl]] {$TemplateParameter[[T]] $Field_decl[[x]] = 0;};
-  extern template struct $Class_def[[Tmpl]];
-  template struct $Class_def[[Tmpl]];
+  extern template struct $Class_def[[Tmpl]]$AngleBracket[[<]]float$AngleBracket[[>]];
+  template struct $Class_def[[Tmpl]]$AngleBracket[[<]]double$AngleBracket[[>]];
 )cpp",
   // This test is to guard against highlightings disappearing when using
   // conversion operators as their behaviour in the clang AST differ from
@@ -335,17 +335,17 @@
 )cpp",
   R"cpp(
   class $Class_def[[G]] {};
-  template<$Class[[G]] *$TemplateParameter_def_readonly[[U]]>
+  template$AngleBracket[[<]]$Class[[G]] *$TemplateParameter_def_readonly[[U]]$AngleBracket[[>]]
   class $Class_def[[GP]] {};
-  template<$Class[[G]] &$TemplateParameter_def_readonly[[U]]>
+  template$AngleBracket[[<]]$Class[[G]] &$TemplateParameter_def_readonly[[U]]$AngleBracket[[>]]
   class $Class_def[[GR]] {};
-  template
+  template$An

[PATCH] D141422: [clang][sema][Matrix] Move code from try-cast to `TypeLocVisitor`. NFC intended.

2023-01-17 Thread Florian Hahn via Phabricator via cfe-commits
fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM ,thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141422

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


[clang] b164b04 - [Clang] Convert test to opaque pointers (NFC)

2023-01-17 Thread Nikita Popov via cfe-commits

Author: Nikita Popov
Date: 2023-01-17T10:08:57+01:00
New Revision: b164b047f2b41ff0c0a3ede3baa29c230c78cd32

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

LOG: [Clang] Convert test to opaque pointers (NFC)

Added: 


Modified: 
clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu

Removed: 




diff  --git a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu 
b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
index 4694d7e38c2f9..a5135ab01f0f3 100644
--- a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
+++ b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
@@ -1,9 +1,9 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: amdgpu-registered-target
 
-// RUN: %clang_cc1 -no-opaque-pointers -triple amdgcn-amd-amdhsa 
-fcuda-is-device -emit-llvm -x hip %s -o - | FileCheck 
--check-prefixes=COMMON,CHECK %s
-// RUN: %clang_cc1 -no-opaque-pointers -triple amdgcn-amd-amdhsa 
-fcuda-is-device -emit-llvm -x hip %s -disable-O0-optnone -o - | opt -S -O2 | 
FileCheck %s --check-prefixes=COMMON,OPT
-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu 
-emit-llvm -x hip %s -o - | FileCheck -check-prefix=HOST %s
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -emit-llvm -x 
hip %s -o - | FileCheck --check-prefixes=COMMON,CHECK %s
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -emit-llvm -x 
hip %s -disable-O0-optnone -o - | opt -S -O2 | FileCheck %s 
--check-prefixes=COMMON,OPT
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -x hip %s -o - 
| FileCheck -check-prefix=HOST %s
 
 #include "Inputs/cuda.h"
 
@@ -14,40 +14,40 @@
 // HOST-NOT: %struct.S.coerce
 // HOST-NOT: %struct.T.coerce
 
-// HOST: define{{.*}} void @_Z22__device_stub__kernel1Pi(i32* noundef %x)
-// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel1Pi(i32 
addrspace(1)*{{.*}} %x.coerce)
-// CHECK: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
-// CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
-// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, 
!amdgpu.noclobber ![[MD:[0-9]+]]
+// HOST: define{{.*}} void @_Z22__device_stub__kernel1Pi(ptr noundef %x)
+// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel1Pi(ptr 
addrspace(1){{.*}} %x.coerce)
+// CHECK: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr
+// CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr
+// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4, 
!amdgpu.noclobber ![[MD:[0-9]+]]
 // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1
-// OPT: store i32 [[INC]], i32 addrspace(1)* %x.coerce, align 4
+// OPT: store i32 [[INC]], ptr addrspace(1) %x.coerce, align 4
 // OPT: ret void
 __global__ void kernel1(int *x) {
   x[0]++;
 }
 
-// HOST: define{{.*}} void @_Z22__device_stub__kernel2Ri(i32* noundef nonnull 
align 4 dereferenceable(4) %x)
-// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel2Ri(i32 
addrspace(1)*{{.*}} nonnull align 4 dereferenceable(4) %x.coerce)
-// CHECK: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
-// CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
-// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, 
!amdgpu.noclobber ![[MD]]
+// HOST: define{{.*}} void @_Z22__device_stub__kernel2Ri(ptr noundef nonnull 
align 4 dereferenceable(4) %x)
+// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel2Ri(ptr 
addrspace(1){{.*}} nonnull align 4 dereferenceable(4) %x.coerce)
+// CHECK: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr
+// CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr
+// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4, 
!amdgpu.noclobber ![[MD]]
 // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1
-// OPT: store i32 [[INC]], i32 addrspace(1)* %x.coerce, align 4
+// OPT: store i32 [[INC]], ptr addrspace(1) %x.coerce, align 4
 // OPT: ret void
 __global__ void kernel2(int &x) {
   x++;
 }
 
-// HOST: define{{.*}} void @_Z22__device_stub__kernel3PU3AS2iPU3AS1i(i32 
addrspace(2)*  noundef %x, i32 addrspace(1)* noundef %y)
-// CHECK-LABEL: define{{.*}} amdgpu_kernel void  @_Z7kernel3PU3AS2iPU3AS1i(i32 
addrspace(2)*{{.*}} %x, i32 addrspace(1)*{{.*}} %y)
-// CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to 
[[TYPE]]*
+// HOST: define{{.*}} void @_Z22__device_stub__kernel3PU3AS2iPU3AS1i(ptr 
addrspace(2)  noundef %x, ptr addrspace(1) noundef %y)
+// CHECK-LABEL: define{{.*}} amdgpu_kernel void  @_Z7kernel3PU3AS2iPU3AS1i(ptr 
addrspace(2){{.*}} %x, ptr addrspace(1){{.*}} %y)
+// CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr
 __global__ void kernel3(__attribute__((a

[PATCH] D141855: [include-mapping] Parse zombie_names.html into a removed symbols map.

2023-01-17 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

Have you run the script on the zombie_names page? Does it work?




Comment at: clang/tools/include-mapping/gen_std.py:67
   required=True)
+  parser.add_argument('-output',
+  default='SymbolMap.inc',

instead adding two CLI flags, I'd suggest extending the existing `language` 
flag to something like `-symbols = {cpp_symbols, c_symbols, 
cpp_removed_symbols}`, it is easy to extend in the future (e.g. 
`c_removed_symbols`).



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141855

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


[clang] b3eb004 - [C++20] [Modules] Only diagnose the non-inline external variable

2023-01-17 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2023-01-17T17:48:09+08:00
New Revision: b3eb004ca78f522c91c0d83bafeab2ee753417c8

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

LOG: [C++20] [Modules] Only diagnose the non-inline external variable
definitions in header units

Address part of https://github.com/llvm/llvm-project/issues/60079.

Since the the declaration of a non-inline static data member in its
class definition is not a definition. The following form:

```
class A {
public:
static const int value = 43;
};
```

should be fine to appear in a header unit. From the perspective of
implementation, it looks like we simply forgot to check if the variable
is a definition...

Reviewed By: iains

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

Added: 


Modified: 
clang/lib/Sema/SemaDecl.cpp
clang/test/CXX/module/module.import/p6.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e3fd4045e8bb1..baadaf3210ee4 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -13088,6 +13088,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr 
*Init, bool DirectInit) {
   // C++ [module.import/6] external definitions are not permitted in header
   // units.
   if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() &&
+  VDecl->isThisDeclarationADefinition() &&
   VDecl->getFormalLinkage() == Linkage::ExternalLinkage &&
   !VDecl->isInline()) {
 Diag(VDecl->getLocation(), diag::err_extern_def_in_header_unit);

diff  --git a/clang/test/CXX/module/module.import/p6.cpp 
b/clang/test/CXX/module/module.import/p6.cpp
index 25c195038eb63..7d8632786d9ee 100644
--- a/clang/test/CXX/module/module.import/p6.cpp
+++ b/clang/test/CXX/module/module.import/p6.cpp
@@ -22,3 +22,9 @@ int ok_var_decl;
 
 int bad_var_definition = 3;  // expected-error {{non-inline external 
definitions are not permitted in C++ header units}}
 
+class A {
+public:
+// This is a declaration instead of definition.
+static const int value = 43; 
+};
+



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


[PATCH] D141905: [C++20] [Modules] Only diagnose the non-inline external variable definitions in header units

2023-01-17 Thread Chuanqi Xu 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 rGb3eb004ca78f: [C++20] [Modules] Only diagnose the non-inline 
external variable (authored by ChuanqiXu).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141905

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CXX/module/module.import/p6.cpp


Index: clang/test/CXX/module/module.import/p6.cpp
===
--- clang/test/CXX/module/module.import/p6.cpp
+++ clang/test/CXX/module/module.import/p6.cpp
@@ -22,3 +22,9 @@
 
 int bad_var_definition = 3;  // expected-error {{non-inline external 
definitions are not permitted in C++ header units}}
 
+class A {
+public:
+// This is a declaration instead of definition.
+static const int value = 43; 
+};
+
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -13088,6 +13088,7 @@
   // C++ [module.import/6] external definitions are not permitted in header
   // units.
   if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() &&
+  VDecl->isThisDeclarationADefinition() &&
   VDecl->getFormalLinkage() == Linkage::ExternalLinkage &&
   !VDecl->isInline()) {
 Diag(VDecl->getLocation(), diag::err_extern_def_in_header_unit);


Index: clang/test/CXX/module/module.import/p6.cpp
===
--- clang/test/CXX/module/module.import/p6.cpp
+++ clang/test/CXX/module/module.import/p6.cpp
@@ -22,3 +22,9 @@
 
 int bad_var_definition = 3;  // expected-error {{non-inline external definitions are not permitted in C++ header units}}
 
+class A {
+public:
+// This is a declaration instead of definition.
+static const int value = 43; 
+};
+
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -13088,6 +13088,7 @@
   // C++ [module.import/6] external definitions are not permitted in header
   // units.
   if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() &&
+  VDecl->isThisDeclarationADefinition() &&
   VDecl->getFormalLinkage() == Linkage::ExternalLinkage &&
   !VDecl->isInline()) {
 Diag(VDecl->getLocation(), diag::err_extern_def_in_header_unit);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141899: [IR][X86] Remove X86AMX type in LLVM IR instead of target extension

2023-01-17 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke added a comment.

@zixuan-wu, changing x86_amx would break our internal code. May I know the 
motivation to change the type?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141899

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


[PATCH] D140415: [flang] stack arrays pass

2023-01-17 Thread Jean Perier via Phabricator via cfe-commits
jeanPerier added inline comments.
Herald added a subscriber: sunshaoce.



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:104
+
+  bool operator!=(const InsertionPoint &rhs) const {
+return (location != rhs.location) ||

It's better to negate the `== operator` here so that the implementation logic 
cannot diverge.



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:120
+  // which operations we intend to rewrite before it calls the pattern rewriter
+  llvm::SmallDenseMap insertionPoints;
+

It is definitely weird to me to have this in the lattice points. It seems 
expensive to save this at every program point and to compute it every time a 
state changes on a maybe not final candiate.

Why not computing in StackArraysAnalysisWrapper::analyseFunction on the final 
candidates (the value in stateMap at that are freed on all return paths) ?



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:272
+// it gets freed by the time we return
+return AllocationState::Allocated;
+  }

This is still odd to me because this breaks the monocity requirement of join:

`join(join(freed, unknown), allocated) ) = join(unknown, allocated) = allocated`

while

`join(freed, join(unknown, allocated)) = join(freed, allocated) = unknown`

I still do not think you need anything special here given the fact that an 
allocation done on a path is considered in the end already seems accounted for 
in LatticePoint::join since the state is added even if not present in the other 
latice.



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:333
+  stateMap[value] = state;
+  addInsertionPoint(value, state);
+  return mlir::ChangeResult::Change;

As mentioned in my other comment above, I do not get why the insertion point is 
computed at that point while it seems the analysis (after computing the states, 
and using the lattice state at the func.return) is not over for the function (I 
would expect insertion to be computed only for the successfully identified 
allocmem at the end, not the one that may be candidate on one code path).



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:460
+  lattice->appendFreedValues(candidateOps);
+}
+  });

I think this is not correct: It seems this will consider every FreememOp that 
could be paired with an allocmem as candidate:

```
func.func @test(%cdt: i1) {
  %a = fir.allocmem !fir.array<1xi8>
  scf.if %cdt {
fir.freemem %a : !fir.heap>
  } else {
  }
  return
}
```

Why not considering the func.return lattice states instead ?

Note that it seems fir.if is not considered a branch operation, so the state of 
its blocks are reset on entry. That is why scf.if is needed to create a test 
exposing the issue. Maybe fir.if op should be given the right interface, but 
that is another topic.



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:509
+
+static bool isInLoop(mlir::Block *block) { return mlir::blockIsInLoop(block); }
+

Where is `blockIsInLoop` defined ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140415

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


[PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

2023-01-17 Thread LJC via Phabricator via cfe-commits
paperchalice created this revision.
paperchalice added reviewers: phosek, Ericson2314.
Herald added a subscriber: Enna1.
Herald added a project: All.
paperchalice requested review of this revision.
Herald added projects: clang, Sanitizers, LLDB, OpenMP, LLVM.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, 
Sanitizers, cfe-commits.

This patch ensures all resources are installed into `CLANG_RESOURCE_DIR`.
Fixes: https://github.com/llvm/llvm-project/issues/59726


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141907

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Tooling/CMakeLists.txt
  clang/runtime/CMakeLists.txt
  cmake/Modules/GetClangResourceDir.cmake
  compiler-rt/cmake/base-config-ix.cmake
  lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  lldb/unittests/Expression/ClangParserTest.cpp
  llvm/cmake/modules/LLVMExternalProjectUtils.cmake
  openmp/CMakeLists.txt

Index: openmp/CMakeLists.txt
===
--- openmp/CMakeLists.txt
+++ openmp/CMakeLists.txt
@@ -86,8 +86,8 @@
 if(${OPENMP_STANDALONE_BUILD})
   set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
 else()
-  string(REGEX MATCH "[0-9]+" CLANG_VERSION ${PACKAGE_VERSION})
-  set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
+  include(GetClangResourceDir)
+  get_clang_resource_dir(LIBOMP_HEADERS_INSTALL_PATH SUBDIR include)
 endif()
 
 # Build host runtime library, after LIBOMPTARGET variables are set since they are needed
Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -257,7 +257,11 @@
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR
  ${PACKAGE_VERSION})
-  set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION_MAJOR}")
+  if(DEFINED CLANG_RESOURCE_DIR AND NOT CLANG_RESOURCE_DIR STREQUAL "")
+set(resource_dir ${LLVM_TOOLS_BINARY_DIR}/${CLANG_RESOURCE_DIR})
+  else()
+set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION_MAJOR}")
+  endif()
   set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER)
   foreach(type ${flag_types})
 set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir})
Index: lldb/unittests/Expression/ClangParserTest.cpp
===
--- lldb/unittests/Expression/ClangParserTest.cpp
+++ lldb/unittests/Expression/ClangParserTest.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "clang/Basic/Version.h"
+#include "clang/Config/config.h"
 
 #include "Plugins/ExpressionParser/Clang/ClangHost.h"
 #include "TestingSupport/SubsystemRAII.h"
@@ -37,12 +38,16 @@
 TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
 #if !defined(_WIN32)
   std::string path_to_liblldb = "/foo/bar/lib/";
-  std::string path_to_clang_dir =
-  "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING;
+  std::string path_to_clang_dir = std::string(CLANG_RESOURCE_DIR).empty()
+  ? "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME
+"/clang/" CLANG_VERSION_MAJOR_STRING
+  : "/foo/bar/bin/" CLANG_RESOURCE_DIR;
 #else
   std::string path_to_liblldb = "C:\\foo\\bar\\lib";
   std::string path_to_clang_dir =
-  "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING;
+  std::string(CLANG_RESOURCE_DIR).empty()
+  ? "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING
+  : "C:\\foo\\bar\\bin\\" CLANG_RESOURCE_DIR;
 #endif
   EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -54,8 +54,11 @@
 
   static const llvm::StringRef kResourceDirSuffixes[] = {
   // LLVM.org's build of LLDB uses the clang resource directory placed
-  // in $install_dir/lib{,64}/clang/$clang_version.
-  CLANG_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING,
+  // in $install_dir/lib{,64}/clang/$clang_version or
+  // $install_dir/bin/$CLANG_RESOURCE_DIR
+  llvm::StringRef(CLANG_RESOURCE_DIR).empty()
+  ? CLANG_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING
+  : "bin/" CLANG_RESOURCE_DIR,
   // swift-lldb uses the clang resource directory copied from swift, which
   // by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places
   // it there, so we use LLDB_INSTALL_LIBDIR_

[PATCH] D140619: ExtractFunction: support extracting expressions and selected part of it

2023-01-17 Thread Kacper Kowalski via Phabricator via cfe-commits
KKoovalsky added a comment.

Hey! I can see that the build: 
https://reviews.llvm.org/harbormaster/build/311598/ failed, but I am not sure 
whether this is related to my change. Could someone take a look?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140619

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


[PATCH] D141908: [C++20][Modules] Handle defaulted and deleted functions in header units.

2023-01-17 Thread Iain Sandoe via Phabricator via cfe-commits
iains created this revision.
Herald added a project: All.
iains added a reviewer: ChuanqiXu.
iains published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Address part of https://github.com/llvm/llvm-project/issues/60079.

Deleted and Defaulted functions are implicitly inline, but that state
is not set at the point that we perform the diagnostic checks for externally-
visible non-inline functions; check the function body type explicitly in the
diagnostic.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141908

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CXX/module/module.import/p6.cpp


Index: clang/test/CXX/module/module.import/p6.cpp
===
--- clang/test/CXX/module/module.import/p6.cpp
+++ clang/test/CXX/module/module.import/p6.cpp
@@ -28,3 +28,11 @@
 static const int value = 43; 
 };
 
+void deleted_fn_ok (void) = delete;
+
+struct S {
+   ~S() noexcept(false) = default;
+private:
+  S(S&);
+};
+S::S(S&) = default;
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -15254,9 +15254,12 @@
   }
 
   // C++ [module.import/6] external definitions are not permitted in header
-  // units.
+  // units.  Deleted and Defaulted functions are implicitly inline (but the
+  // inline state is not set at this point, so check the BodyKind explicitly).
   if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() &&
-  FD->getFormalLinkage() == Linkage::ExternalLinkage && !FD->isInlined()) {
+  FD->getFormalLinkage() == Linkage::ExternalLinkage &&
+  !FD->isInvalidDecl() && BodyKind == FnBodyKind::Other &&
+  !FD->isInlined()) {
 Diag(FD->getLocation(), diag::err_extern_def_in_header_unit);
 FD->setInvalidDecl();
   }


Index: clang/test/CXX/module/module.import/p6.cpp
===
--- clang/test/CXX/module/module.import/p6.cpp
+++ clang/test/CXX/module/module.import/p6.cpp
@@ -28,3 +28,11 @@
 static const int value = 43; 
 };
 
+void deleted_fn_ok (void) = delete;
+
+struct S {
+   ~S() noexcept(false) = default;
+private:
+  S(S&);
+};
+S::S(S&) = default;
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -15254,9 +15254,12 @@
   }
 
   // C++ [module.import/6] external definitions are not permitted in header
-  // units.
+  // units.  Deleted and Defaulted functions are implicitly inline (but the
+  // inline state is not set at this point, so check the BodyKind explicitly).
   if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() &&
-  FD->getFormalLinkage() == Linkage::ExternalLinkage && !FD->isInlined()) {
+  FD->getFormalLinkage() == Linkage::ExternalLinkage &&
+  !FD->isInvalidDecl() && BodyKind == FnBodyKind::Other &&
+  !FD->isInlined()) {
 Diag(FD->getLocation(), diag::err_extern_def_in_header_unit);
 FD->setInvalidDecl();
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141892: Implement modernize-use-constraints

2023-01-17 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

In D141892#4057722 , @ccotter wrote:

> 2. replace the non `_v` templates to the `_v` variants `is_same` -> 
> `is_same_v` or the equivalent concept `same_as`

See D137302 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141892

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


[PATCH] D141910: [OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend

2023-01-17 Thread Dominik Adamski via Phabricator via cfe-commits
domada created this revision.
domada added reviewers: dpalermo, skatrak, kiranktp, RogerV-AMD, NimishMishra, 
jsjodin.
Herald added subscribers: pmatos, asb, guansong, kbarton, hiraditya, 
jgravelle-google, sbc100, yaxunl, nemanjai, dschuff.
Herald added a project: All.
domada requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, sstefan1, 
aheejin.
Herald added a reviewer: jdoerfert.
Herald added projects: clang, LLDB, LLVM.

Currently default simd alignment is defined by Clang specific TargetInfo class. 
This class cannot be reused for LLVM Flang. That's why default simd alignment 
calculation has been moved to OMPIRBuilder which is common for Flang and Clang.

Previous attempt: https://reviews.llvm.org/D138496 was wrong because the 
default alignment depended on the number of built LLVM targets.

If we wanted to calculate the default alignment for PPC and we hadn't specified 
PPC LLVM target to build, then we would get 0 as the alignment because 
OMPIRBuilder couldn't create PPCTargetMachine object and it returned 0 as the 
default value. If PPC LLVM target had been built earlier, then OMPIRBuilder 
could have created PPCTargetMachine object and it would have returned 128.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141910

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/Basic/Targets/WebAssembly.h
  clang/lib/Basic/Targets/X86.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3039,6 +3039,23 @@
   Builder.CreateBr(NewBlocks.front());
 }
 
+unsigned
+OpenMPIRBuilder::getOpenMPDefaultSimdAlign(const Triple &TargetTriple,
+   const StringMap &Features) {
+  if (TargetTriple.isX86()) {
+if (Features.lookup("avx512f"))
+  return 512;
+else if (Features.lookup("avx"))
+  return 256;
+return 128;
+  }
+  if (TargetTriple.isPPC())
+return 128;
+  if (TargetTriple.isWasm())
+return 128;
+  return 0;
+}
+
 void OpenMPIRBuilder::applySimd(CanonicalLoopInfo *CanonicalLoop,
 MapVector AlignedVars,
 Value *IfCond, OrderKind Order,
Index: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
===
--- llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -502,6 +502,13 @@
ArrayRef Loops,
InsertPointTy ComputeIP);
 
+  /// Get the default alignment value for given target
+  ///
+  /// \param TargetTriple   Target triple
+  /// \param Features   StringMap which describes extra CPU features
+  static unsigned getOpenMPDefaultSimdAlign(const Triple &TargetTriple,
+const StringMap &Features);
+
 private:
   /// Modifies the canonical loop to be a statically-scheduled workshare loop.
   ///
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -500,8 +500,6 @@
   auto target_info = TargetInfo::CreateTargetInfo(
   m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts);
   if (log) {
-LLDB_LOGF(log, "Using SIMD alignment: %d",
-  target_info->getSimdDefaultAlign());
 LLDB_LOGF(log, "Target datalayout string: '%s'",
   target_info->getDataLayoutString());
 LLDB_LOGF(log, "Target ABI: '%s'", target_info->getABI().str().c_str());
Index: clang/lib/Basic/Targets/X86.cpp
===
--- clang/lib/Basic/Targets/X86.cpp
+++ clang/lib/Basic/Targets/X86.cpp
@@ -400,9 +400,6 @@
 return false;
   }
 
-  SimdDefaultAlign =
-  hasFeature("avx512f") ? 512 : hasFeature("avx") ? 256 : 128;
-
   // FIXME: We should allow long double type on 32-bits to match with GCC.
   // This requires backend to be able to lower f80 without x87 first.
   if (!HasX87 && LongDoubleFormat == &llvm::APFloat::x87DoubleExtended())
Index: clang/lib/Basic/Targets/WebAssembly.h
===
--- clang/lib/Basic/Targets/WebAssembly.h
+++ clang/lib/Basic/Targets/WebAssembly.h
@@ -49,7 +49,6 @@
 SuitableAlign = 128;
 LargeArrayMinWidth = 128;
 LargeArrayAlign = 128;
-SimdDefaultAlign = 128;
 

[PATCH] D141798: Remove ZeroBehavior of countLeadingZeros and the like (NFC)

2023-01-17 Thread Jay Foad via Phabricator via cfe-commits
foad added a comment.
Herald added a subscriber: luke.

In D141798#4055050 , @barannikov88 
wrote:

> It would be nice to have comments reflecting the new behavior in the case of 
> 0 / max value.

+1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141798

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


[PATCH] D141381: [codegen] Store address of indirect arguments on the stack

2023-01-17 Thread Jeremy Morse via Phabricator via cfe-commits
jmorse added a comment.

Hi,

In D141381#4056661 , @fdeazeve wrote:

> While SROA will not touch this:
>
>   define @foo(ptr %arg) {
>  call void @llvm.dbg.declare(%arg, [...], metadata !DIExpression())
>
> It completely destroys the debug information provided by:
>
>   define @foo(ptr %arg) {
>  %ptr_storage = alloca ptr
>  store ptr %arg, ptr %ptr_storage
>  call void @llvm.dbg.declare(%ptr_storage, [...], metadata 
> !DIExpression(DW_OP_deref))

Curious -- that feels like the kind of thing we should be able to support, but 
adding more "special handling" to SROA isn't great.

One alternative line of investigation could be to keep the codegen changes 
you're adding, but leave the dbg.declare unmodified, i.e. referring to the 
argument value. The dbg.declare will become an indirect DBG_VALUE after isel, 
and if nothing optimises away the stack store, then LiveDebugValues (both 
flavours) might be able to track the store to stack and leave the variable 
homed there. I tried fiddling with 
llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll to make that happen, however 
LiveDebugValues didn't follow the store, probably because it's to an alloca not 
a spill slot, thus there might be aliasing stores.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141381

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


[PATCH] D140377: [clang][Interp] Compound assign operators for FP values

2023-01-17 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff accepted this revision.
sepavloff 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/D140377/new/

https://reviews.llvm.org/D140377

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


[PATCH] D140415: [flang] stack arrays pass

2023-01-17 Thread Tom Eccles via Phabricator via cfe-commits
tblah updated this revision to Diff 489753.
tblah marked 7 inline comments as done.
tblah added a comment.

- Implement operator!= as !(operator==)
- Move insertion point computation to 
StackArraysAnalysisWrapper::analyseFunction
- Remove special-casing for join(allocated, unknown)
- Add processing of fir.result to AllocationAnalysis::visitOperation so that 
lattices are propagated out of nested blocks
- Walk function returns not freememops
- Add a test checking that the data flow analysis gives correct results for 
scf.if


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140415

Files:
  clang/docs/tools/clang-formatted-files.txt
  flang/include/flang/Optimizer/Builder/MutableBox.h
  flang/include/flang/Optimizer/Dialect/FIRAttr.h
  flang/include/flang/Optimizer/Transforms/Passes.h
  flang/include/flang/Optimizer/Transforms/Passes.td
  flang/lib/Lower/Allocatable.cpp
  flang/lib/Optimizer/Builder/MutableBox.cpp
  flang/lib/Optimizer/Transforms/CMakeLists.txt
  flang/lib/Optimizer/Transforms/StackArrays.cpp
  flang/test/Lower/Intrinsics/c_loc.f90
  flang/test/Lower/Intrinsics/system_clock.f90
  flang/test/Transforms/stack-arrays.f90
  flang/test/Transforms/stack-arrays.fir

Index: flang/test/Transforms/stack-arrays.fir
===
--- /dev/null
+++ flang/test/Transforms/stack-arrays.fir
@@ -0,0 +1,242 @@
+// RUN: fir-opt --stack-arrays %s | FileCheck %s
+
+// Simplest transformation
+func.func @simple() {
+  %0 = fir.allocmem !fir.array<42xi32>
+  fir.freemem %0 : !fir.heap>
+  return
+}
+// CHECK: func.func @simple() {
+// CHECK-NEXT: fir.alloca !fir.array<42xi32>
+// CHECK-NEXT: return
+// CHECK-NEXT: }
+
+// Check fir.must_be_heap allocations are not moved
+func.func @must_be_heap() {
+  %0 = fir.allocmem !fir.array<42xi32> {fir.must_be_heap = true}
+  fir.freemem %0 : !fir.heap>
+  return
+}
+// CHECK:  func.func @must_be_heap() {
+// CHECK-NEXT:   %[[ALLOC:.*]] = fir.allocmem !fir.array<42xi32> {fir.must_be_heap = true}
+// CHECK-NEXT:   fir.freemem %[[ALLOC]] : !fir.heap>
+// CHECK-NEXT:   return
+// CHECK-NEXT: }
+
+// Check the data-flow-analysis can detect cases where we aren't sure if memory
+// is freed by the end of the function
+func.func @dfa1(%arg0: !fir.ref> {fir.bindc_name = "cond"}) {
+  %7 = arith.constant 42 : index
+  %8 = fir.allocmem !fir.array, %7 {uniq_name = "_QFdfa1Earr.alloc"}
+  %9 = fir.load %arg0 : !fir.ref>
+  %10 = fir.convert %9 : (!fir.logical<4>) -> i1
+  fir.if %10 {
+fir.freemem %8 : !fir.heap>
+  } else {
+  }
+  return
+}
+// CHECK:  func.func @dfa1(%arg0: !fir.ref> {fir.bindc_name = "cond"}) {
+// CHECK-NEXT:   %c42 = arith.constant 42 : index
+// CHECK-NEXT:   %0 = fir.allocmem !fir.array, %c42 {uniq_name = "_QFdfa1Earr.alloc"}
+// CHECK-NEXT:   %1 = fir.load %arg0 : !fir.ref>
+// CHECK-NEXT:   %2 = fir.convert %1 : (!fir.logical<4>) -> i1
+// CHECK-NEXT:   fir.if %2 {
+// CHECK-NEXT: fir.freemem %0 : !fir.heap>
+// CHECK-NEXT:   } else {
+// CHECK-NEXT:   }
+// CHECK-NEXT:   return
+// CHECK-NEXT: }
+
+// Check scf.if (fir.if is not considered a branch operation)
+func.func @dfa2(%arg0: i1) {
+  %a = fir.allocmem !fir.array<1xi8>
+  scf.if %arg0 {
+fir.freemem %a : !fir.heap>
+  } else {
+  }
+  return
+}
+// CHECK: func.func @dfa2(%arg0: i1) {
+// CHECK-NEXT:  %[[MEM:.*]] = fir.allocmem !fir.array<1xi8>
+// CHECK-NEXT:  scf.if %arg0 {
+// CHECK-NEXT:fir.freemem %[[MEM]] : !fir.heap>
+// CHECK-NEXT:  } else {
+// CHECK-NEXT:  }
+// CHECK-NEXT:  return
+// CHECK-NEXT:  }
+
+// check the alloca is placed after all operands become available
+func.func @placement1() {
+  // do some stuff with other ssa values
+  %1 = arith.constant 1 : index
+  %2 = arith.constant 2 : index
+  %3 = arith.addi %1, %2 : index
+  // operand is now available
+  %4 = fir.allocmem !fir.array, %3
+  // ...
+  fir.freemem %4 : !fir.heap>
+  return
+}
+// CHECK:  func.func @placement1() {
+// CHECK-NEXT:   %[[ONE:.*]] = arith.constant 1 : index
+// CHECK-NEXT:   %[[TWO:.*]] = arith.constant 2 : index
+// CHECK-NEXT:   %[[ARG:.*]] = arith.addi %[[ONE]], %[[TWO]] : index
+// CHECK-NEXT:   %[[MEM:.*]] = fir.alloca !fir.array, %[[ARG]]
+// CHECK-NEXT:   return
+// CHECK-NEXT: }
+
+// check that if there are no operands, then the alloca is placed early
+func.func @placement2() {
+  // do some stuff with other ssa values
+  %1 = arith.constant 1 : index
+  %2 = arith.constant 2 : index
+  %3 = arith.addi %1, %2 : index
+  %4 = fir.allocmem !fir.array<42xi32>
+  // ...
+  fir.freemem %4 : !fir.heap>
+  return
+}
+// CHECK:  func.func @placement2() {
+// CHECK-NEXT:   %[[MEM:.*]] = fir.alloca !fir.array<42xi32>
+// CHECK-NEXT:   %[[ONE:.*]] = arith.constant 1 : index
+// CHECK-NEXT:   %[[TWO:.*]] = arith.constant 2 : index
+// CHECK-NEXT:   %[[SUM:.*]] = arith.addi %[[ONE]], %[[TWO]] : index
+// CHECK-NEXT:   return
+// CHECK-N

[PATCH] D140415: [flang] stack arrays pass

2023-01-17 Thread Tom Eccles via Phabricator via cfe-commits
tblah added inline comments.



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:120
+  // which operations we intend to rewrite before it calls the pattern rewriter
+  llvm::SmallDenseMap insertionPoints;
+

jeanPerier wrote:
> It is definitely weird to me to have this in the lattice points. It seems 
> expensive to save this at every program point and to compute it every time a 
> state changes on a maybe not final candiate.
> 
> Why not computing in StackArraysAnalysisWrapper::analyseFunction on the final 
> candidates (the value in stateMap at that are freed on all return paths) ?
Good idea. Thanks!



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:460
+  lattice->appendFreedValues(candidateOps);
+}
+  });

jeanPerier wrote:
> I think this is not correct: It seems this will consider every FreememOp that 
> could be paired with an allocmem as candidate:
> 
> ```
> func.func @test(%cdt: i1) {
>   %a = fir.allocmem !fir.array<1xi8>
>   scf.if %cdt {
> fir.freemem %a : !fir.heap>
>   } else {
>   }
>   return
> }
> ```
> 
> Why not considering the func.return lattice states instead ?
> 
> Note that it seems fir.if is not considered a branch operation, so the state 
> of its blocks are reset on entry. That is why scf.if is needed to create a 
> test exposing the issue. Maybe fir.if op should be given the right interface, 
> but that is another topic.
Good spot! To get analysis working with this change I've had to add processing 
of fir.result operations. These will join the parent operation's lattice with 
the fir.result.



Comment at: flang/lib/Optimizer/Transforms/StackArrays.cpp:509
+
+static bool isInLoop(mlir::Block *block) { return mlir::blockIsInLoop(block); }
+

jeanPerier wrote:
> Where is `blockIsInLoop` defined ?
https://reviews.llvm.org/D141401


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140415

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


[PATCH] D141694: [clang-format] SortUsingDeclarations support lexicographic order

2023-01-17 Thread Zhikai Zeng via Phabricator via cfe-commits
Backl1ght added a comment.

ping


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

https://reviews.llvm.org/D141694

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


[clang] 6458218 - [docs] Add llvm & clang release notes for LoongArch

2023-01-17 Thread Weining Lu via cfe-commits

Author: Weining Lu
Date: 2023-01-17T20:56:57+08:00
New Revision: 64582189b3fc6a65f6dc2e5205da3b6ff71beb93

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

LOG: [docs] Add llvm & clang release notes for LoongArch

Reviewed By: rengolin

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index de038fe2d13ec..6315e2b626b24 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -802,6 +802,19 @@ CUDA Support in Clang
 - Clang now supports CUDA SDK up to 11.8
 - Added support for targeting sm_{87,89,90} GPUs.
 
+LoongArch Support in Clang
+--
+- Clang now supports LoongArch. Along with the backend, clang is able to build 
a
+  large corpus of Linux applications. Test-suite 100% pass.
+- Support basic option ``-march=`` which is used to select the target
+  architecture, i.e. the basic set of ISA modules to be enabled. Possible 
values
+  are ``loongarch64`` and ``la464``.
+- Support basic option ``-mabi=`` which is used to select the base ABI type.
+  Possible values are ``lp64d``, ``lp64f``, ``lp64s``, ``ilp32d``, ``ilp32f``
+  and ``ilp32s``.
+- Support extended options: ``-msoft-float``, ``-msingle-float``, 
``-mdouble-float`` and ``mfpu=``.
+  See `LoongArch toolchain conventions 
`_.
+
 RISC-V Support in Clang
 ---
 - ``sifive-7-rv32`` and ``sifive-7-rv64`` are no longer supported for 
``-mcpu``.

diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 36de570a839a8..71f445ca65fed 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,8 @@ Non-comprehensive list of changes in this release
is not a constant in coroutines. This decision may cause unnecessary
performance regressions and we plan to fix it in later versions.
 
+*  The LoongArch target is promoted to "official" (see below for more details).
+
 * ...
 
 Update on required toolchains to build LLVM
@@ -154,6 +156,19 @@ Changes to the Hexagon Backend
 
 * ...
 
+Changes to the LoongArch Backend
+
+
+* The LoongArch target is no longer "experimental"! It's now built by default,
+  rather than needing to be enabled with 
``LLVM_EXPERIMENTAL_TARGETS_TO_BUILD``.
+
+* The backend has full codegen support for the base (both integer and
+  floating-point) instruction set and it conforms to psABI v2. Testing has been
+  performed with Linux, including native compilation of a large corpus of Linux
+  applications.
+
+* Support GHC calling convention.
+
 Changes to the MIPS Backend
 ---
 
@@ -279,9 +294,13 @@ Changes to the LLVM tools
 Changes to LLDB
 -
 
+* Initial support for debugging Linux LoongArch 64-bit binaries.
+
 Changes to Sanitizers
 -
 
+* Many Sanitizers (asan, fuzzer, lsan, safestack, scudo, tsan, ubsan) have
+  support for Linux LoongArch 64-bit variant. Some of them may be rudimentary.
 
 Other Changes
 -



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


[PATCH] D141750: [docs] Add llvm & clang release notes for LoongArch

2023-01-17 Thread Lu Weining 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 rG64582189b3fc: [docs] Add llvm & clang release notes for 
LoongArch (authored by SixWeining).

Changed prior to commit:
  https://reviews.llvm.org/D141750?vs=489204&id=489773#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141750

Files:
  clang/docs/ReleaseNotes.rst
  llvm/docs/ReleaseNotes.rst


Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,8 @@
is not a constant in coroutines. This decision may cause unnecessary
performance regressions and we plan to fix it in later versions.
 
+*  The LoongArch target is promoted to "official" (see below for more details).
+
 * ...
 
 Update on required toolchains to build LLVM
@@ -154,6 +156,19 @@
 
 * ...
 
+Changes to the LoongArch Backend
+
+
+* The LoongArch target is no longer "experimental"! It's now built by default,
+  rather than needing to be enabled with 
``LLVM_EXPERIMENTAL_TARGETS_TO_BUILD``.
+
+* The backend has full codegen support for the base (both integer and
+  floating-point) instruction set and it conforms to psABI v2. Testing has been
+  performed with Linux, including native compilation of a large corpus of Linux
+  applications.
+
+* Support GHC calling convention.
+
 Changes to the MIPS Backend
 ---
 
@@ -279,9 +294,13 @@
 Changes to LLDB
 -
 
+* Initial support for debugging Linux LoongArch 64-bit binaries.
+
 Changes to Sanitizers
 -
 
+* Many Sanitizers (asan, fuzzer, lsan, safestack, scudo, tsan, ubsan) have
+  support for Linux LoongArch 64-bit variant. Some of them may be rudimentary.
 
 Other Changes
 -
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -802,6 +802,19 @@
 - Clang now supports CUDA SDK up to 11.8
 - Added support for targeting sm_{87,89,90} GPUs.
 
+LoongArch Support in Clang
+--
+- Clang now supports LoongArch. Along with the backend, clang is able to build 
a
+  large corpus of Linux applications. Test-suite 100% pass.
+- Support basic option ``-march=`` which is used to select the target
+  architecture, i.e. the basic set of ISA modules to be enabled. Possible 
values
+  are ``loongarch64`` and ``la464``.
+- Support basic option ``-mabi=`` which is used to select the base ABI type.
+  Possible values are ``lp64d``, ``lp64f``, ``lp64s``, ``ilp32d``, ``ilp32f``
+  and ``ilp32s``.
+- Support extended options: ``-msoft-float``, ``-msingle-float``, 
``-mdouble-float`` and ``mfpu=``.
+  See `LoongArch toolchain conventions 
`_.
+
 RISC-V Support in Clang
 ---
 - ``sifive-7-rv32`` and ``sifive-7-rv64`` are no longer supported for 
``-mcpu``.


Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,8 @@
is not a constant in coroutines. This decision may cause unnecessary
performance regressions and we plan to fix it in later versions.
 
+*  The LoongArch target is promoted to "official" (see below for more details).
+
 * ...
 
 Update on required toolchains to build LLVM
@@ -154,6 +156,19 @@
 
 * ...
 
+Changes to the LoongArch Backend
+
+
+* The LoongArch target is no longer "experimental"! It's now built by default,
+  rather than needing to be enabled with ``LLVM_EXPERIMENTAL_TARGETS_TO_BUILD``.
+
+* The backend has full codegen support for the base (both integer and
+  floating-point) instruction set and it conforms to psABI v2. Testing has been
+  performed with Linux, including native compilation of a large corpus of Linux
+  applications.
+
+* Support GHC calling convention.
+
 Changes to the MIPS Backend
 ---
 
@@ -279,9 +294,13 @@
 Changes to LLDB
 -
 
+* Initial support for debugging Linux LoongArch 64-bit binaries.
+
 Changes to Sanitizers
 -
 
+* Many Sanitizers (asan, fuzzer, lsan, safestack, scudo, tsan, ubsan) have
+  support for Linux LoongArch 64-bit variant. Some of them may be rudimentary.
 
 Other Changes
 -
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -802,6 +802,19 @@
 - Clang now supports CUDA SDK up to 11.8
 - Added support for targeting sm_{87,89,90} GPUs.
 
+LoongArch Support in Clang
+-

Re: [clang] f2d301f - Revert "[codegen] Store address of indirect arguments on the stack"

2023-01-17 Thread Felipe de Azevedo Piovezan via cfe-commits
Apologies, I’ll do it next time!

In the meantime, the reason was posted in D141381

> On Jan 16, 2023, at 13:59, Roman Lebedev  wrote:
> 
> Reminder to please always mention the reason for the revert/recommit
> in the commit message.
> 
> On Mon, Jan 16, 2023 at 7:05 PM Felipe de Azevedo Piovezan via
> cfe-commits  wrote:
>> 
>> 
>> Author: Felipe de Azevedo Piovezan
>> Date: 2023-01-16T13:05:22-03:00
>> New Revision: f2d301fe82869f881b86b51da7b4752972c66707
>> 
>> URL: 
>> https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/f2d301fe82869f881b86b51da7b4752972c66707.diff
>> 
>> LOG: Revert "[codegen] Store address of indirect arguments on the stack"
>> 
>> This reverts commit 7e4447a17db4a070f01c8f8a87505a4b2a1b0e3a.
>> 
>> Added:
>> 
>> 
>> Modified:
>>clang/docs/ReleaseNotes.rst
>>clang/lib/CodeGen/CGDebugInfo.cpp
>>clang/lib/CodeGen/CGDebugInfo.h
>>clang/lib/CodeGen/CGDecl.cpp
>>clang/test/CodeGen/aarch64-ls64.c
>>clang/test/CodeGen/atomic-arm64.c
>>clang/test/CodeGenCXX/amdgcn-func-arg.cpp
>>clang/test/CodeGenCXX/debug-info.cpp
>>clang/test/CodeGenCXX/derived-to-base-conv.cpp
>>clang/test/CodeGenCoroutines/coro-params-exp-namespace.cpp
>>clang/test/CodeGenCoroutines/coro-params.cpp
>>clang/test/OpenMP/for_firstprivate_codegen.cpp
>>clang/test/OpenMP/parallel_firstprivate_codegen.cpp
>>clang/test/OpenMP/sections_firstprivate_codegen.cpp
>>clang/test/OpenMP/single_firstprivate_codegen.cpp
>>clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
>>
>> clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
>>
>> clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
>>
>> clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp
>>clang/test/OpenMP/teams_firstprivate_codegen.cpp
>> 
>> Removed:
>> 
>> 
>> 
>> 
>> diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
>> index 731d10ac64a3f..3bbab951e8a8c 100644
>> --- a/clang/docs/ReleaseNotes.rst
>> +++ b/clang/docs/ReleaseNotes.rst
>> @@ -500,9 +500,6 @@ Non-comprehensive list of changes in this release
>> - Clang can now generate a PCH when using ``-fdelayed-template-parsing`` for
>>   code with templates containing loop hint pragmas, OpenMP pragmas, and
>>   ``#pragma unused``.
>> -- Clang now saves the address of ABI-indirect function parameters on the 
>> stack,
>> -  improving the debug information available in programs compiled without
>> -  optimizations.
>> 
>> 
>> New Compiler Flags
>> 
>> diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
>> b/clang/lib/CodeGen/CGDebugInfo.cpp
>> index f2d558456fde4..f53a9d00ae5fd 100644
>> --- a/clang/lib/CodeGen/CGDebugInfo.cpp
>> +++ b/clang/lib/CodeGen/CGDebugInfo.cpp
>> @@ -4822,10 +4822,9 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
>> 
>> llvm::DILocalVariable *
>> CGDebugInfo::EmitDeclareOfArgVariable(const VarDecl *VD, llvm::Value *AI,
>> -  unsigned ArgNo, CGBuilderTy &Builder,
>> -  const bool UsePointerValue) {
>> +  unsigned ArgNo, CGBuilderTy &Builder) 
>> {
>>   assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
>> -  return EmitDeclare(VD, AI, ArgNo, Builder, UsePointerValue);
>> +  return EmitDeclare(VD, AI, ArgNo, Builder);
>> }
>> 
>> namespace {
>> 
>> diff  --git a/clang/lib/CodeGen/CGDebugInfo.h 
>> b/clang/lib/CodeGen/CGDebugInfo.h
>> index 10660a2550b56..95484a060cd88 100644
>> --- a/clang/lib/CodeGen/CGDebugInfo.h
>> +++ b/clang/lib/CodeGen/CGDebugInfo.h
>> @@ -487,9 +487,10 @@ class CGDebugInfo {
>> 
>>   /// Emit call to \c llvm.dbg.declare for an argument variable
>>   /// declaration.
>> -  llvm::DILocalVariable *
>> -  EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, unsigned 
>> ArgNo,
>> -   CGBuilderTy &Builder, bool UsePointerValue = 
>> false);
>> +  llvm::DILocalVariable *EmitDeclareOfArgVariable(const VarDecl *Decl,
>> +  llvm::Value *AI,
>> +  unsigned ArgNo,
>> +  CGBuilderTy &Builder);
>> 
>>   /// Emit call to \c llvm.dbg.declare for the block-literal argument
>>   /// to a block invocation function.
>> 
>> diff  --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
>> index a70997f5b27b8..ceaddc4e694ac 100644
>> --- a/clang/li

[PATCH] D141380: [clang-repl] XFAIL riscv targets in simple-exception test case

2023-01-17 Thread Alex Bradbury via Phabricator via cfe-commits
asb added a comment.

In D141380#4053535 , @Hahnfeld wrote:

> Yes, this is correct: The JITLink backend for RISC-V doesn't (yet) register 
> the eh frames into libunwind, so throwing and catching exceptions through 
> JITted code doesn't work (yet). I know in principle how to make this happen 
> and it's on my list, but I couldn't give it priority before a talk on 
> Thursday. Sorry for not realizing we have a test for this in `clang-repl` - 
> does this mean we have bots running this natively on RISC-V?

Not yet, but hopefully soon.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141380

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


[PATCH] D141381: [codegen] Store address of indirect arguments on the stack

2023-01-17 Thread Felipe de Azevedo Piovezan via Phabricator via cfe-commits
fdeazeve added a comment.

In D141381#4058327 , @jmorse wrote:

> Curious -- that feels like the kind of thing we should be able to support, 
> but adding more "special handling" to SROA isn't great.

Agreed! I'll have a look to see how far SROA is from being able to support 
this. Maybe it's almost there :)

> and if nothing optimises away the stack store

This is the part that concerns me a bit, since SROA removes the alloca+store 
because they have no uses other than the dbg.declare.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141381

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


[PATCH] D141580: [clang] Don't consider a nullptr returned from ActOnTag() as a valid result in ParseClassSpecifier.

2023-01-17 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In D141580#4052496 , @sammccall wrote:

> To offer the opposing argument: if DeclResult is just a bad idea, then using 
> it consistently/right might be worse than using it as little as possible.
>
> FWIW, I find every piece of code that produces/consumes the `*Result` to be 
> extremely confusing (the semantics of the two different sentinel values are 
> never obvious) and use of the type in more APIs means more callers have to 
> deal with this tri-state logic and bugs like this one.
>
> So spreading DeclResult around where it's not strictly needed feels like the 
> wrong direction to be, and i find the original version of the patch easier to 
> understand. It may even be possible to switch entirely to pointers here.

`Sema::Act*` have a mixed usage of returning {*Result`, `void`, a pointer, 
`bool`}, unclear the common practice there. Changing `ActOnTemplatedFriendTag` 
and `ActOnTag` return-type seems be more aligned with the other `Sema::Act*` 
methods used in the `ParseClassSpecifier` context.  And these two APIs are not 
widely used, it is probably fine.

> (Aaron, this is your call, just wanted to make sure you're aware of the cost)

To me, I don't have a strong preference, I'm fine with either solution.




Comment at: clang/lib/Parse/ParseDeclCXX.cpp:2069-2078
+if (auto *TagDecl = Actions.ActOnTag(
+getCurScope(), TagType, TUK, StartLoc, SS, Name, NameLoc, attrs, 
AS,
+DS.getModulePrivateSpecLoc(), TParams, Owned, IsDependent,
+SourceLocation(), false, clang::TypeResult(),
+DSC == DeclSpecContext::DSC_type_specifier,
+DSC == DeclSpecContext::DSC_template_param ||
+DSC == DeclSpecContext::DSC_template_type_arg,

aaron.ballman wrote:
> hokein wrote:
> > hokein wrote:
> > > aaron.ballman wrote:
> > > > sammccall wrote:
> > > > > just so I understand:
> > > > > 
> > > > > initial state of TagOrTempResult is (null, invalid)
> > > > > if ActOnTag returns ptr, we set it to (ptr, valid)
> > > > > if ActOnTag returns null, then the old code would set it to (null, 
> > > > > valid) and the new code would leave it as (null, invalid)
> > > > > 
> > > > > ActOnTag returns null in error cases (diagnostic has been emitted).
> > > > > We check validity below when deciding whether to use the returned 
> > > > > pointer (so we're passing null around at that point).
> > > > > 
> > > > > I can't really infer what the invariants here were originally meant 
> > > > > to be, and obviously we're not crashing all over the place, and the 
> > > > > diagnostics look like a wash to me. But the new logic seems much more 
> > > > > sane.
> > > > I think this is the wrong approach to fixing the issue. None of the 
> > > > other assignments to `TagOrTempResult` test for nullptr first, such as: 
> > > > https://github.com/llvm/llvm-project/blob/main/clang/lib/Parse/ParseDeclCXX.cpp#L2037
> > > >  and 
> > > > https://github.com/llvm/llvm-project/blob/main/clang/lib/Parse/ParseDeclCXX.cpp#L2029.
> > > > 
> > > > An `ActionResult` can be both valid/invalid *and* usable/unusable (and 
> > > > a `DeclResult` is a kind of `ActionResult`). When it's assigned *any 
> > > > pointer value* (including nullptr), it's a valid `ActionResult` but 
> > > > it's not a usable `ActionResult` 
> > > > (https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Sema/Ownership.h#L166).
> > > > 
> > > > I think the correct fix is to find the places assuming a valid 
> > > > `ActionResult` means a nonnull pointer from `get()`, such as 
> > > > https://github.com/llvm/llvm-project/blob/main/clang/lib/Parse/ParseDeclCXX.cpp#L2121
> > > >  and switch them over to looking for a usable `ActionResult` instead.
> > > Thanks for the comment!
> > > 
> > > > None of the other assignments to TagOrTempResult test for nullptr first
> > > 
> > > I think the problem here is:
> > > - most of the `ActOn*` methods return a `DeclResult` (and inside these 
> > > method implementations, they return an Invalid `DeclResult` if the Decl 
> > > is nullptr), so `TagOrTempResult = Actions.ActOn*` is a fine pattern.
> > > - Only two exceptions `ActOnTagDecl` and `ActOnTemplatedFriendTag`, they 
> > > return a `Decl*`, so the `TagOrTempResult = Action.ActOn*` is a very 
> > > suspicious pattern. (IMO, they're not intentional, likely bugs).
> > > 
> > > > such as: 
> > > > https://github.com/llvm/llvm-project/blob/main/clang/lib/Parse/ParseDeclCXX.cpp#L2037
> > > >  and 
> > > > https://github.com/llvm/llvm-project/blob/main/clang/lib/Parse/ParseDeclCXX.cpp#L2029.
> > > 
> > > The first one is the other exception; the second one is not 
> > > (ActOnExplicitInstantiation returns a `DeclResult`).
> > > 
> > > > I think the correct fix is to find the places assuming a valid 
> > > > ActionResult means a nonnull pointer from get(), such as 
> > > > https://github.com/llvm/llvm-project/blob/main/clang/

[PATCH] D141899: [IR][X86] Remove X86AMX type in LLVM IR instead of target extension

2023-01-17 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D141899#4058173 , @LuoYuanke wrote:

> @zixuan-wu, changing x86_amx would break our internal code. May I know the 
> motivation to change the type?

I just want to point out that generally "causes [too much] churn downstream"
is not relevant concern upstream, as downstreams are considered to be on their 
own.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141899

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


[PATCH] D141899: [IR][X86] Remove X86AMX type in LLVM IR instead of target extension

2023-01-17 Thread Thorsten via Phabricator via cfe-commits
tschuett added a comment.

- Can "x86.AMX" be a named constant somewhere? I found a lot of copies.
- Release note?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141899

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


[PATCH] D141871: [Clang][OpenMP] Add parse and sema for iterator map modifier

2023-01-17 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
doru1004 updated this revision to Diff 489787.

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

https://reviews.llvm.org/D141871

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/OpenMPKinds.def
  clang/include/clang/Basic/OpenMPKinds.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/target_ast_print.cpp

Index: clang/test/OpenMP/target_ast_print.cpp
===
--- clang/test/OpenMP/target_ast_print.cpp
+++ clang/test/OpenMP/target_ast_print.cpp
@@ -1139,6 +1139,60 @@
 }
 #endif // OMP51
 
+#ifdef OMP52
+
+///==///
+// RUN: %clang_cc1 -DOMP52 -verify -fopenmp -fopenmp-version=52 -ast-print %s | FileCheck %s --check-prefix OMP52
+// RUN: %clang_cc1 -DOMP52 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -DOMP52 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix OMP52
+
+// RUN: %clang_cc1 -DOMP52 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s | FileCheck %s --check-prefix OMP52
+// RUN: %clang_cc1 -DOMP52 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -DOMP52 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix OMP52
+
+void foo() {}
+
+template 
+T tmain(T argc, T *argv) {
+  int N = 100;
+  int v[N];
+  #pragma omp target map(iterator(it = 0:N:2), to: v[it])
+  foo();
+  #pragma omp target map(iterator(it = 0:N:4), from: v[it])
+  foo();
+
+  return 0;
+}
+
+// OMP52: template  T tmain(T argc, T *argv) {
+// OMP52-NEXT: int N = 100;
+// OMP52-NEXT: int v[N];
+// OMP52-NEXT: #pragma omp target map(iterator(int it = 0:N:2),to: v[it])
+// OMP52-NEXT: foo()
+// OMP52-NEXT: #pragma omp target map(iterator(int it = 0:N:4),from: v[it])
+// OMP52-NEXT: foo()
+
+// OMP52-LABEL: int main(int argc, char **argv) {
+int main (int argc, char **argv) {
+  int i, j, a[20], always, close;
+// OMP52-NEXT: int i, j, a[20]
+#pragma omp target
+// OMP52-NEXT: #pragma omp target
+  foo();
+// OMP52-NEXT: foo();
+#pragma omp target map(iterator(it = 0:20:2), to: a[it])
+// OMP52-NEXT: #pragma omp target map(iterator(int it = 0:20:2),to: a[it])
+  foo();
+// OMP52-NEXT: foo();
+#pragma omp target map(iterator(it = 0:20:4), from: a[it])
+// OMP52-NEXT: #pragma omp target map(iterator(int it = 0:20:4),from: a[it])
+foo();
+// OMP52-NEXT: foo();
+
+  return tmain(argc, &argc) + tmain(argv[0][0], argv[0]);
+}
+#endif // OMP52
+
 #ifdef OMPX
 
 // RUN: %clang_cc1 -DOMPX -verify -fopenmp -fopenmp-extensions -ast-print %s | FileCheck %s --check-prefix=OMPX
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6792,6 +6792,8 @@
   for (unsigned I = 0; I < NumberOfOMPMapClauseModifiers; ++I) {
 Record.push_back(C->getMapTypeModifier(I));
 Record.AddSourceLocation(C->getMapTypeModifierLoc(I));
+if (C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
+  Record.AddStmt(C->getIteratorModifier());
   }
   Record.AddNestedNameSpecifierLoc(C->getMapperQualifierLoc());
   Record.AddDeclarationNameInfo(C->getMapperIdInfo());
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -10773,6 +10773,8 @@
 C->setMapTypeModifier(
 I, static_cast(Record.readInt()));
 C->setMapTypeModifierLoc(I, Record.readSourceLocation());
+if (C->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator)
+  C->setIteratorModifier(Record.readSubExpr());
   }
   C->setMapperQualifierLoc(Record.readNestedNameSpecifierLoc());
   C->setMapperIdInfo(Record.readDeclarationNameInfo());
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -1988,15 +1988,16 @@
   /// By default, performs semantic analysis to build the new OpenMP clause.
   /// Subclasses may override this routine to provide different behavior.
   OMPClause *RebuildOMPMapClause(
-  ArrayRef MapTypeModifiers,
+  Expr *IteratorModifier, ArrayRef MapTypeModifiers,
   ArrayRef MapTypeModifiersLoc,
   CXXScopeSpec MapperIdS

[PATCH] D141925: [ASTMatchers] Add `isDirectInit` matcher.

2023-01-17 Thread Clement Courbet via Phabricator via cfe-commits
courbet created this revision.
courbet added reviewers: hokein, alexfh.
Herald added a project: All.
courbet requested review of this revision.
Herald added a project: clang.

To match variables that are direct-initialized.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141925

Files:
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer is a direct-initializer.
+///
+/// Example matches i1, but not i2, i3 or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer is a direct-initializer.
+///
+/// Example matches i1, but not i2, i3 or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141899: [IR][X86] Remove X86AMX type in LLVM IR instead of target extension

2023-01-17 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke added a comment.

In D141899#4058683 , @lebedev.ri 
wrote:

> In D141899#4058173 , @LuoYuanke 
> wrote:
>
>> @zixuan-wu, changing x86_amx would break our internal code. May I know the 
>> motivation to change the type?
>
> I just want to point out that generally "causes [too much] churn downstream"
> is not relevant concern upstream, as downstreams are considered to be on 
> their own.

But we previously design the amx type and we follow the design to develop and 
maintain both the upsteam code and downstream code. I think we should respect 
the orginal author's effort for developing and maintaining the code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141899

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


[PATCH] D141925: [ASTMatchers] Add `isDirectInit` matcher.

2023-01-17 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 489790.
courbet added a comment.

fix ddoc


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141925

Files:
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer is a direct-initializer.
+///
+/// Example matches i3 and a2, but not i1, or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer is a direct-initializer.
+///
+/// Example matches i3 and a2, but not i1, or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141899: [IR][X86] Remove X86AMX type in LLVM IR instead of target extension

2023-01-17 Thread Thorsten via Phabricator via cfe-commits
tschuett added a comment.

The summary only says what you are doing. I am missing something about why.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141899

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


[PATCH] D141666: [RISCV] Proper support of extensions Zicsr and Zifencei

2023-01-17 Thread Alex Bradbury via Phabricator via cfe-commits
asb added a comment.
Herald added a subscriber: luke.

In D141666#4050692 , @eklepilkina 
wrote:

> We are interested in proper support for `Zicsr` and `Zifencei`. Could someone 
> look at patch or explain why these extensions were included by default?

As Jessica says, the reason they're not split out is that when the backend was 
first implemented, they were part of the I specification. I'm not at all a fan 
of how this happened, but we are where we are, and as noted GCC has made this 
change. The key aspect this patch misses right now is the versioning issue - I 
is still marked as 2.0. So really, this needs someone to propose a what the 
change will look like in full. A few misc thoughts (and all of these would need 
some more discussion with others active in the RISC-V backend). e.g. do we 
need/want -misa-version, or is there a proposal to just move to I 2.1 by 
default?

It might also be interesting to explore options that temporarly sidestep the 
versioning discussion and improve compatibility with GCC -march strings. e.g. 
an initial patch that adds zicsr and zifencei but enables it by default (or 
otherwise handles zicsr and zifencei as a no-op). I _think_ I'd be happy with 
something along those lines, but I can't speak for others involved in the 
RISC-V backend.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141666

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


[PATCH] D141925: [ASTMatchers] Add `isDirectInit` matcher.

2023-01-17 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 489794.
courbet added a comment.

fix doc


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141925

Files:
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer that is a direct-initializer.
+///
+/// Example matches i2 and i2, but not i1 or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer that is a direct-initializer.
+///
+/// Example matches i2 and i2, but not i1 or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141925: [ASTMatchers] Add `isDirectInit` matcher.

2023-01-17 Thread Clement Courbet via Phabricator via cfe-commits
courbet updated this revision to Diff 489796.
courbet added a comment.

Regenerate doc


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141925

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer that is a direct-initializer.
+///
+/// Example matches i2 and i2, but not i1 or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))
Index: clang/docs/LibASTMatchersReference.html
===
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -5446,6 +5446,20 @@
 
 
 
+MatcherVarDecl>isDirectInit
+Matches a variable 
initializer that is a direct-initializer.
+
+Example matches i2 and i2, but not i1 or i4
+(matcher = varDecl(isStaticLocal()))
+void f() {
+  int i1 = 3;
+  int i2(3);
+  int i3{3};
+  int i4;
+}
+
+
+
 MatcherVarDecl>isExceptionVariable
 Matches a 
variable declaration that is an exception variable from
 a C++ catch block, or an Objective-C statement.


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1439,6 +1439,20 @@
   EXPECT_TRUE(notMatches("int X;", M));
 }
 
+TEST_P(ASTMatchersTest, IsDirectInit) {
+  auto M = varDecl(isDirectInit());
+  EXPECT_TRUE(notMatches("int i1 = 3;", M));
+  if (!GetParam().isCXX()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i2(3);", M));
+  if (!GetParam().isCXX11OrLater()) {
+return;
+  }
+  EXPECT_TRUE(matches("int i3{3};", M));
+  EXPECT_TRUE(notMatches("int i4;", M));
+}
+
 TEST_P(ASTMatchersTest, StorageDuration) {
   StringRef T =
   "void f() { int x; static int y; } int a;static int b;extern int c;";
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4114,6 +4114,22 @@
   InnerMatcher.matches(*Initializer, Finder, Builder));
 }
 
+/// \brief Matches a variable initializer that is a direct-initializer.
+///
+/// Example matches i2 and i2, but not i1 or i4
+/// (matcher = varDecl(isStaticLocal()))
+/// \code
+/// void f() {
+///   int i1 = 3;
+///   int i2(3);
+///   int i3{3};
+///   int i4;
+/// }
+/// \endcode
+AST_MATCHER(VarDecl, isDirectInit) {
+  return Node.isDirectInit();
+}
+
 /// \brief Matches a static variable with local scope.
 ///
 /// Example matches y (matcher = varDecl(isStaticLocal()))
Index: clang/docs/LibASTMatchersReference.html
===
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -5446,6 +5446,20 @@
 
 
 
+MatcherVarDecl>isDirectInit
+Matches a variable initializer that is a direct-initializer.
+
+Example matches i2 and i2, but not i1 or i4
+(matcher = varDecl(isStaticLocal()))
+void f() {
+  int i1 = 3;
+  int i2(3);
+  int i3{3};
+  int i4;
+}
+
+
+
 MatcherVarD

[PATCH] D131858: [clang] Track the templated entity in type substitution.

2023-01-17 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D131858#4054348 , @v.g.vassilev 
wrote:

> In D131858#4052031 , @erichkeane 
> wrote:
>
>> In D131858#4052026 , @v.g.vassilev 
>> wrote:
>>
>>> Thanks a lot @rsmith for providing a fix and thanks a lot @aaron.ballman 
>>> and @erichkeane for the efforts saving @mizvekov work over the summer. I 
>>> believe he has sporadic access to internet and soon he will be back to 
>>> normal. Great example of team work here!!
>>
>> Note we don't yet have the evidence that this is savable yet, we should know 
>> in the next day or so.  At minimum, at least 1 of his patches needs to be 
>> reverted due to the memory regression.
>
> I see that https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/6584/ 
> picked up your revert and seems successful. Then the next build is green as 
> well and then starts failing for a reason that’s unrelated to this patch.

Yep!  So only 1 of the patches (D136566  
needs reverting/further attention).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131858

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


[PATCH] D131858: [clang] Track the templated entity in type substitution.

2023-01-17 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

In D131858#4058807 , @erichkeane 
wrote:

> In D131858#4054348 , @v.g.vassilev 
> wrote:
>
>> In D131858#4052031 , @erichkeane 
>> wrote:
>>
>>> In D131858#4052026 , 
>>> @v.g.vassilev wrote:
>>>
 Thanks a lot @rsmith for providing a fix and thanks a lot @aaron.ballman 
 and @erichkeane for the efforts saving @mizvekov work over the summer. I 
 believe he has sporadic access to internet and soon he will be back to 
 normal. Great example of team work here!!
>>>
>>> Note we don't yet have the evidence that this is savable yet, we should 
>>> know in the next day or so.  At minimum, at least 1 of his patches needs to 
>>> be reverted due to the memory regression.
>>
>> I see that https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/6584/ 
>> picked up your revert and seems successful. Then the next build is green as 
>> well and then starts failing for a reason that’s unrelated to this patch.
>
> Yep!  So only 1 of the patches (D136566  
> needs reverting/further attention).

Awesome!!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131858

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


[PATCH] D141929: Add support for clang-cl's option /Qfexcess-precision.

2023-01-17 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam created this revision.
zahiraam added reviewers: andrew.w.kaylor, mdtoguchi.
Herald added a project: All.
zahiraam requested review of this revision.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141929

Files:
  clang/include/clang/Driver/Options.td
  clang/test/Driver/cl-options.c


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -233,6 +233,14 @@
 // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck 
-check-prefix=showIncludes_E %s
 // showIncludes_E-NOT: warning: argument unused during compilation: 
'--show-includes'
 
+// Floating point excess precision
+// RUN: %clang_cl /Qfexcess-precision=fast -### -- %s 2>&1 | FileCheck 
-check-prefix=f16-prec-fast %s
+// f16-prec-fast: -ffloat16-excess-precision=fast
+// RUN: %clang_cl /Qfexcess-precision=standard -### -- %s 2>&1 | FileCheck 
-check-prefix=f16-prec-std %s
+// f16-prec-std: -ffloat16-excess-precision=standard
+// RUN: %clang_cl /Qfexcess-precision=16 -### -- %s 2>&1 | FileCheck 
-check-prefix=f16-prec-none %s
+// f16-prec-none: -ffloat16-excess-precision=none
+
 // /source-charset: should warn on everything except UTF-8.
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16' in '/source-charset:utf-16'
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6650,6 +6650,9 @@
 def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,
   Alias;
 
+def _SLASH_Qfexcess_precision_EQ : CLJoined<"Qfexcess-precision=">,
+  Alias;
+
 // The _SLASH_O option handles all the /O flags, but we also provide separate
 // aliased options to provide separate help messages.
 def _SLASH_O : CLDXCJoined<"O">,


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -233,6 +233,14 @@
 // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
 // showIncludes_E-NOT: warning: argument unused during compilation: '--show-includes'
 
+// Floating point excess precision
+// RUN: %clang_cl /Qfexcess-precision=fast -### -- %s 2>&1 | FileCheck -check-prefix=f16-prec-fast %s
+// f16-prec-fast: -ffloat16-excess-precision=fast
+// RUN: %clang_cl /Qfexcess-precision=standard -### -- %s 2>&1 | FileCheck -check-prefix=f16-prec-std %s
+// f16-prec-std: -ffloat16-excess-precision=standard
+// RUN: %clang_cl /Qfexcess-precision=16 -### -- %s 2>&1 | FileCheck -check-prefix=f16-prec-none %s
+// f16-prec-none: -ffloat16-excess-precision=none
+
 // /source-charset: should warn on everything except UTF-8.
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16' in '/source-charset:utf-16'
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6650,6 +6650,9 @@
 def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,
   Alias;
 
+def _SLASH_Qfexcess_precision_EQ : CLJoined<"Qfexcess-precision=">,
+  Alias;
+
 // The _SLASH_O option handles all the /O flags, but we also provide separate
 // aliased options to provide separate help messages.
 def _SLASH_O : CLDXCJoined<"O">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141775: [Clang] Export CanPassInRegisters as a type trait

2023-01-17 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/lib/Sema/SemaExprCXX.cpp:5387
+  return RD->canPassInRegisters();
+return true;
   }

Is there good reason to return true for all non-record types?  Should we 
instead be limiting the types that can make it this far?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141775

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


[PATCH] D137058: [Driver] [Modules] Support -fmodule-output (1/2)

2023-01-17 Thread Jake Egan via Phabricator via cfe-commits
Jake-Egan added a comment.

In D137058#4057424 , @ChuanqiXu wrote:

> In D137058#4056647 , @Jake-Egan 
> wrote:
>
>> Hi, this new test fails on AIX 
>> https://lab.llvm.org/buildbot/#/builders/214/builds/5351/steps/6/logs/FAIL__Clang__module-output_cppm
>> Could you take a look?
>
> I added `// REQUIRES: x86-registered-target`. Is it still failing?

It is still failing yes, I think it should restrict `system-aix` instead, like 
you did on windows.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137058

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


[clang] 123223a - [clang-repl] XFAIL riscv targets in simple-exception test case

2023-01-17 Thread Alex Bradbury via cfe-commits

Author: Alex Bradbury
Date: 2023-01-17T14:28:15Z
New Revision: 123223ab87ca50d1ce4f8c08128d0237b3d31c84

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

LOG: [clang-repl] XFAIL riscv targets in simple-exception test case

This test fails for RISC-V and Arm targets are already XFAILed, so add
RISC-V to the XFAIL list.

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

Added: 


Modified: 
clang/test/Interpreter/simple-exception.cpp

Removed: 




diff  --git a/clang/test/Interpreter/simple-exception.cpp 
b/clang/test/Interpreter/simple-exception.cpp
index 57e14e47a30a1..886b8ffd2d701 100644
--- a/clang/test/Interpreter/simple-exception.cpp
+++ b/clang/test/Interpreter/simple-exception.cpp
@@ -1,7 +1,7 @@
 // clang-format off
 // UNSUPPORTED: system-aix
-// XFAIL for arm and arm64, or running on Windows.
-// XFAIL: target=arm{{.*}}, system-windows
+// XFAIL for arm, arm64, riscv, or running on Windows.
+// XFAIL: target={{(arm|riscv).*}}, system-windows
 // RUN: cat %s | clang-repl | FileCheck %s
 extern "C" int printf(const char *, ...);
 
@@ -11,4 +11,4 @@ auto r1 = checkException();
 // CHECK: Running f()
 // CHECK-NEXT: Simple exception
 
-%quit
\ No newline at end of file
+%quit



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


[PATCH] D141380: [clang-repl] XFAIL riscv targets in simple-exception test case

2023-01-17 Thread Alex Bradbury via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG123223ab87ca: [clang-repl] XFAIL riscv targets in 
simple-exception test case (authored by asb).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141380

Files:
  clang/test/Interpreter/simple-exception.cpp


Index: clang/test/Interpreter/simple-exception.cpp
===
--- clang/test/Interpreter/simple-exception.cpp
+++ clang/test/Interpreter/simple-exception.cpp
@@ -1,7 +1,7 @@
 // clang-format off
 // UNSUPPORTED: system-aix
-// XFAIL for arm and arm64, or running on Windows.
-// XFAIL: target=arm{{.*}}, system-windows
+// XFAIL for arm, arm64, riscv, or running on Windows.
+// XFAIL: target={{(arm|riscv).*}}, system-windows
 // RUN: cat %s | clang-repl | FileCheck %s
 extern "C" int printf(const char *, ...);
 
@@ -11,4 +11,4 @@
 // CHECK: Running f()
 // CHECK-NEXT: Simple exception
 
-%quit
\ No newline at end of file
+%quit


Index: clang/test/Interpreter/simple-exception.cpp
===
--- clang/test/Interpreter/simple-exception.cpp
+++ clang/test/Interpreter/simple-exception.cpp
@@ -1,7 +1,7 @@
 // clang-format off
 // UNSUPPORTED: system-aix
-// XFAIL for arm and arm64, or running on Windows.
-// XFAIL: target=arm{{.*}}, system-windows
+// XFAIL for arm, arm64, riscv, or running on Windows.
+// XFAIL: target={{(arm|riscv).*}}, system-windows
 // RUN: cat %s | clang-repl | FileCheck %s
 extern "C" int printf(const char *, ...);
 
@@ -11,4 +11,4 @@
 // CHECK: Running f()
 // CHECK-NEXT: Simple exception
 
-%quit
\ No newline at end of file
+%quit
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D140423: [WIP][clang] Add PrintingPolicy callback for identifying default template arguments

2023-01-17 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D140423#4055722 , @Michael137 
wrote:

> In D140423#4052442 , @aaron.ballman 
> wrote:
>
>> In D140423#4052271 , @dblaikie 
>> wrote:
>>
>>> In D140423#4051262 , 
>>> @aaron.ballman wrote:
>>>
> Add something like a bool IsDefaulted somewhere in Clang, e.g., in 
> TemplateArgument and consult it from the TypePrinter. This would be much 
> simpler but requires adding a field on one of the Clang types

 I think this might be worth exploring as a cleaner solution to the 
 problem. `TemplateArgument` has a union of structures for the various 
 kinds of template arguments it represents 
 (https://github.com/llvm/llvm-project/blob/main/clang/include/clang/AST/TemplateBase.h#L140).
  All of the structures in that union start with an `unsigned Kind` field 
 to discriminate between the members. There are only 8 kinds currently 
 (https://github.com/llvm/llvm-project/blob/main/clang/include/clang/AST/TemplateBase.h#L63),
  so we could turn `Kind` into a bit-field and then steal a bit for 
 `IsDefaulted` without increasing memory overhead. Do you think that's a 
 reasonable approach to try instead?
>>>
>>> FWIW, I Think I discouraged @Michael137 from going down that direction 
>>> since it felt weird to me to add that sort of thing to the Clang ASTs for 
>>> an lldb-only use case, and a callback seemed more suitable. But this is 
>>> hardly my wheelhouse - if you reckon that's the better direction, carry on, 
>>> I expect @Michael137 will be on board with that.
>>
>> Adding in @erichkeane as templates code owner in case he has opinions.
>>
>> I agree it's a bit weird to modify the AST only for lldb only, but adding a 
>> callback to the printing policy is basically an lldb-only change as well (I 
>> don't imagine folks would use that callback all that often). So my thinking 
>> is that if we can encode the information in the AST for effectively zero 
>> cost, that helps every consumer of the AST (thinking about things like 
>> clang-tidy) and not just people printing. However, this is not a strongly 
>> held position, so if there's a preference for the current approach, it seems 
>> workable to me.
>
> Thanks for taking a look @aaron.ballman @erichkeane
>
> I prepared an alternative draft patch series with your suggestion of adding 
> an `IsDefaulted` bit to `TemplateArgument`:
>
> - https://reviews.llvm.org/D141826
> - https://reviews.llvm.org/D141827
>
> Is this what you had in mind?
>
> This *significantly* simplifies the LLDB support: 
> https://reviews.llvm.org/D141828
>
> So I'd prefer this over the callback approach TBH.
>
>> A Class template instantiation SHOULD have its link back to the class 
>> template, and should be able to calculate whether the template argument is 
>> defaulted, right? At least if it is the SAME as the default (that is, I'm 
>> not sure how well we can tell the difference between a defaulted arg, and a 
>> arg set to the default value).
>>
>> I wouldn't expect a bool to be necessary, and I see 
>> isSubstitutedDefaultArgument seems to do that work, right?
>
> As @dblaikie mentioned, unfortunately LLDB currently isn't able to construct 
> the `ClassTemplateDecl` in a way where `isSubstitutedDefaultArgument` would 
> correctly deduce whether a template instantiation has defaulted arguments. In 
> DWARF we only have info about a template instantiation (i.e., the structure 
> of the generic template parameters is not encoded). So we can't supply 
> `(Non)TypeTemplateParamDecl::setDefaultArgument` with the generic arguments 
> Clang expects. The `ClassTemplateDecl` parameters are set up here: 
> https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L1391-L1402
>
> Regardless of how complex the template parameters get, LLDB just turns each 
> into a plain `(Non)TypeTemplateParamDecl`

Got it, I missed that part, I'm not too familiar with how LLDB works in this 
case.  I'll take a look at those other patches.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140423

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


[PATCH] D141826: [WIP][clang][TemplateBase] Add IsDefaulted bit to TemplateArgument

2023-01-17 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

This seems innocuous enough/easy enough to use.  I'd like a comment on the 
functions at least and types in TemplateBase.h to specify that this is for 
printing-policy only?  Alternatively (and perhaps MUCH more appreciated) would 
be to make sure we mark the defaulted during AST generation as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141826

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


[PATCH] D141892: Implement modernize-use-constraints

2023-01-17 Thread Chris Cotter via Phabricator via cfe-commits
ccotter added a comment.

In D141892#4058273 , @njames93 wrote:

> In D141892#4057722 , @ccotter wrote:
>
>> 2. replace the non `_v` templates to the `_v` variants `is_same` -> 
>> `is_same_v` or the equivalent concept `same_as`
>
> See D137302 

Awesome!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141892

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


[PATCH] D141666: [RISCV] Proper support of extensions Zicsr and Zifencei

2023-01-17 Thread Elena Lepilkina via Phabricator via cfe-commits
eklepilkina added a comment.

Thank you for comments!

> The key aspect this patch misses right now is the versioning issue - I is 
> still marked as 2.0.

I can update `I` extension version or separate diffrent isa versions as you 
mentioned. I can fix comments and make proposed by community changes. We are 
interested in supporting compatibility with GCC.

> It might also be interesting to explore options that temporarly sidestep the 
> versioning discussion and improve compatibility with GCC -march strings. e.g. 
> an initial patch that adds zicsr and zifencei but enables it by default (or 
> otherwise handles zicsr and zifencei as a no-op)

We internally made something similar, just added extensions in the list and 
ignore warnings in some places. But still these extensions are already ratified 
so proper support is needed to be done some time


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141666

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


[PATCH] D141899: [IR][X86] Remove X86AMX type in LLVM IR instead of target extension

2023-01-17 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

From a very cursory look, this looks pretty nice. It looks like we pretty much 
get rid of AMX-specific knowledge in the middle-end entirely, which is the 
point of target extension types.

Regarding bitcasts, it's worth mentioning that there was some recent discussion 
about allowing bitcasts on target types as one of the supported properties -- 
however, I think we wouldn't actually want to do that for AMX, because of the 
special properties it has. In particular, if we allow bitcasts, we should also 
allow bitcast optimizations, and those are generally illegal for AMX (as seen 
with the various checks this patch removes).

Something this is missing is auto-upgrade support in the bitcode reader.

Nitpick: I wonder whether the type should be called `target("x86.amx")` -- it 
seems like lowercase names are more idiomatic in LLVM? No strong feelings 
either way though.




Comment at: clang/lib/CodeGen/CGBuiltin.cpp:5338
+if (TargetExtTy->getName() == "x86.AMX")
+  return true;
+  return false;

Probably worthwhile to add an overload like `Type::isTargetExtTy(StringRef)`?



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:5373
+Builder.CreateIntrinsic(Intrinsic::x86_bitconvert_vector_to_tile,
+{}, {ArgValue});
+} else {

Something I don't really get is why we need the separate bitconvert intrinsic, 
and the existing cast intrinsic does not work. Do they have different semantics?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141899

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


[PATCH] D128440: [WebAssembly] Initial support for reference type funcref in clang

2023-01-17 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/include/clang/Basic/Attr.td:4129
+  let Documentation = [WebAssemblyExportNameDocs];
+  let Subjects = SubjectList<[TypedefName], ErrorDiag>;
+}

pmatos wrote:
> erichkeane wrote:
> > pmatos wrote:
> > > erichkeane wrote:
> > > > Note that it seems this is likely not going to work correctly on 
> > > > template type aliases!  You probably want to make sure that is 
> > > > acceptable to you.
> > > Documentation says about Subject:
> > > 
> > > ```
> > >   // The things to which an attribute can appertain
> > >   SubjectList Subjects;
> > > ```
> > > 
> > > Given this can be attached to function pointer types, is the subject then 
> > > just Type ?
> > IIRC, the list of subjects are the Decls and Stmt types that are possibly 
> > allowed.  I don't thnk it would be just 'Type' there.
> > 
> > As you have it, it is only allowed on TypedefNameDecl.
> > 
> > See the SubsetSubject's at the top of this file for some examples on how 
> > you could constrain a special matcher to only work on function pointer 
> > decls.
> Good point @erichkeane . What do you think of FunctionPointer implementation 
> here?
That seems acceptable to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128440

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


[PATCH] D141572: [C++] [Coroutines] Deprecates the '-fcoroutines-ts' flag

2023-01-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM, thank you!


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

https://reviews.llvm.org/D141572

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


[PATCH] D141497: [clang][Interp] Record initialization via conditional operator

2023-01-17 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:200
+  using ExprVisitorFunc = std::function;
+  bool visitConditional(const AbstractConditionalOperator *E,
+ExprVisitorFunc VisitFunc);

tbaeder wrote:
> tbaeder wrote:
> > erichkeane wrote:
> > > I'd probably rather make this a template taking a functor, rather than 
> > > bringing in the atrocities that come with std::function.
> > Alright, will look into that
> Done. Not sure if this is exactly how you meant it to look. Feels a bit 
> inelegant.
This actually probably needs to be a non-member now, since its only used in the 
.cpp.

while I DO dislike that it was using std::function (probably because of 
captures in the lambdas?), I now suspect this is worse if we can't have it in 
the header, right?


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

https://reviews.llvm.org/D141497

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


[PATCH] D141899: [IR][X86] Remove X86AMX type in LLVM IR instead of target extension

2023-01-17 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

I think it would also be fine to retain the Type::isX86_AMXTy(), at least for 
now. That would reduce this patch to mostly the representation change, without 
the change to check for the type in a different way.




Comment at: llvm/lib/IR/Core.cpp:655
-LLVMTypeRef LLVMX86AMXTypeInContext(LLVMContextRef C) {
-  return (LLVMTypeRef) Type::getX86_AMXTy(*unwrap(C));
-}

These methods can be kept and just create the target type instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141899

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


[PATCH] D141690: [clang] fix consteval ctor code generation assert

2023-01-17 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang/lib/CodeGen/CGCall.cpp:1338
+  llvm::StructType *STy = dyn_cast(Val->getType());
+  if (STy && STy->canLosslesslyBitCastTo(Dest.getElementType())) {
 for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {

Intuitively, I feel like `canLosslesslyBitCastTo` should be used in conjuction 
with something like `Builder.CreateBitcast` and after a quick skim through 
existing I can't find any uses with `CreateStore` in the codebase. This leads 
me to think that we need to call a different function here. As mentioned 
earlier, I may be completely wrong as I don't have much experience with codegen.

I will let @jyknight sanity-check my intuition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141690

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


[PATCH] D141871: [Clang][OpenMP] Add parse and sema for iterator map modifier

2023-01-17 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

Erroneous test are required




Comment at: clang/include/clang/AST/OpenMPClause.h:310-314
+  /// Fetches list of variables associated with this clause.
+  Expr *getIteratorRef() {
+return (static_cast(this)
+->template getTrailingObjects())[2 * NumVars];
+  }

Why do we need it here, if it is specific to map clause?



Comment at: clang/include/clang/AST/OpenMPClause.h:317
+  /// Sets the list of variables for this clause.
+  void setIteratorRef(ArrayRef IL) {
+assert(IL.size() == 1 && "Number of iterator expressions must be 1");

Why ArrayRef if only one expression is expected?



Comment at: clang/include/clang/AST/OpenMPClause.h:5940-5942
+if (HasIteratorModifier)
+  return getIteratorRef();
+return nullptr;

Just `getIteratorRef()` should be enough.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:1166-1169
+for (auto *IteratorVD : Top->IteratorVarDecls)
+  if (IteratorVD == VD->getCanonicalDecl())
+return true;
+return false;

Use llvm::any_of()


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

https://reviews.llvm.org/D141871

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


[PATCH] D141918: WIP: [Clang] Emit 'unwindabort' when applicable.

2023-01-17 Thread Sergei Barannikov via Phabricator via cfe-commits
barannikov88 added a comment.

I couldn't find an example of creating "resume unwindabort" in the patch 
series. Is it yet to be done?
Could you show a source code example where such an instruction should be 
generated? (By the frontend or an IR pass.) I couldn't get it from the RFC.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141918

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


[clang] 12cb1cb - Revert "[clang] Instantiate concepts with sugared template arguments"

2023-01-17 Thread Erich Keane via cfe-commits

Author: Erich Keane
Date: 2023-01-17T07:29:31-08:00
New Revision: 12cb1cb3720de8d164196010123ce1a8901d8122

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

LOG: Revert "[clang] Instantiate concepts with sugared template arguments"

This reverts commit b8064374b217db061213c561ec8f3376681ff9c8.

Based on the report here:
https://github.com/llvm/llvm-project/issues/59271

this produces a significant increase in memory use of the compiler and a
large compile-time regression.  This patch reverts this so that we don't
branch for release with that issue.

Added: 


Modified: 
clang/lib/Sema/SemaConcept.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/test/AST/ast-dump-concepts.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/compound-requirement.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/simple-requirement.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/type-requirement.cpp
clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp
clang/test/CXX/temp/temp.param/p10-2a.cpp
clang/test/SemaTemplate/concepts-recursive-inst.cpp
clang/test/SemaTemplate/cxx2a-constraint-caching.cpp
clang/test/SemaTemplate/instantiate-requires-expr.cpp
clang/test/SemaTemplate/pr52970.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index fa5509f0f14f8..f20e4751f41a3 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1141,7 +1141,7 @@ static bool substituteParameterMappings(Sema &S, 
NormalizedConstraint &N,
   TemplateArgumentList TAL{TemplateArgumentList::OnStack,
CSE->getTemplateArguments()};
   MultiLevelTemplateArgumentList MLTAL = S.getTemplateInstantiationArgs(
-  CSE->getNamedConcept(), /*Final=*/true, &TAL,
+  CSE->getNamedConcept(), /*Final=*/false, &TAL,
   /*RelativeToPrimary=*/true,
   /*Pattern=*/nullptr,
   /*ForConstraintInstantiation=*/true);

diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 4e9541abb0af5..e3eef9323b2f8 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1482,57 +1482,53 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
   // C++2b:
   //   Otherwise, if the type contains a placeholder type, it is replaced by 
the
   //   type determined by placeholder type deduction.
-  if (const DeducedType *Deduced = Ty->getContainedDeducedType();
-  Deduced && !Deduced->isDeduced()) {
-if (isa(Deduced)) {
-  Ty = DeduceTemplateSpecializationFromInitializer(TInfo, Entity, Kind,
-   Exprs);
-  if (Ty.isNull())
-return ExprError();
-  Entity = InitializedEntity::InitializeTemporary(TInfo, Ty);
-} else {
-  assert(isa(Deduced));
-  MultiExprArg Inits = Exprs;
-  if (ListInitialization) {
-auto *ILE = cast(Exprs[0]);
-Inits = MultiExprArg(ILE->getInits(), ILE->getNumInits());
-  }
-
-  if (Inits.empty())
-return ExprError(
-Diag(TyBeginLoc, diag::err_auto_expr_init_no_expression)
-<< Ty << FullRange);
-  if (Inits.size() > 1) {
-Expr *FirstBad = Inits[1];
-return ExprError(Diag(FirstBad->getBeginLoc(),
-  diag::err_auto_expr_init_multiple_expressions)
- << Ty << FullRange);
-  }
-  if (getLangOpts().CPlusPlus2b) {
-if (Ty->getAs())
-  Diag(TyBeginLoc, diag::warn_cxx20_compat_auto_expr) << FullRange;
-  }
-  Expr *Deduce = Inits[0];
-  if (isa(Deduce))
-return ExprError(
-Diag(Deduce->getBeginLoc(), diag::err_auto_expr_init_paren_braces)
-<< ListInitialization << Ty << FullRange);
-  QualType DeducedType;
-  TemplateDeductionInfo Info(Deduce->getExprLoc());
-  TemplateDeductionResult Result =
-  DeduceAutoType(TInfo->getTypeLoc(), Deduce, DeducedType, Info);
-  if (Result != TDK_Success && Result != TDK_AlreadyDiagnosed)
-return ExprError(Diag(TyBeginLoc, 
diag::err_auto_expr_deduction_failure)
- << Ty << Deduce->getType() << FullRange
- << Deduce->getSourceRange());
-  if (DeducedType.isNull()) {
-assert(Result == TDK_AlreadyDiagnosed);
-return ExprError();
-  }
+  DeducedType *Deduced = Ty->getContainedDeducedType();
+  if (Deduced && isa(Deduced)) {
+Ty = DeduceTemplateSpecializationFromInitializer(TInfo, Entity,
+  

[PATCH] D141935: [OpenMP] Make `-Xarch_host` and `-Xarch_device` for for OpenMP offloading

2023-01-17 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, tra, yaxunl.
Herald added a subscriber: guansong.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, MaskRay.
Herald added a project: clang.

Clang currently supports the `-Xarch_host` and `-Xarch_device` variants
to handle passing arguments to only one part of the offloading
toolchain. This was previously only supported fully for HIP / CUDA This
patch simple updates the logic to make it work for any offloading kind.

Fixes #59799


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141935

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


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -355,3 +355,21 @@
 // RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
 
 // CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
+
+//
+// Check that `-Xarch_host` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_host -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-HOST %s
+// XARCH-HOST: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
+// XARCH-HOST-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+
+//
+// Check that `-Xarch_device` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_device -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-DEVICE %s
+// XARCH-DEVICE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+// XARCH-DEVICE-NOT: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -1333,17 +1333,17 @@
   DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
   bool Modified = false;
 
-  bool IsGPU = OFK == Action::OFK_Cuda || OFK == Action::OFK_HIP;
+  bool IsDevice = OFK != Action::OFK_None && OFK != Action::OFK_Host;
   for (Arg *A : Args) {
 bool NeedTrans = false;
 bool Skip = false;
 if (A->getOption().matches(options::OPT_Xarch_device)) {
-  NeedTrans = IsGPU;
-  Skip = !IsGPU;
+  NeedTrans = IsDevice;
+  Skip = !IsDevice;
 } else if (A->getOption().matches(options::OPT_Xarch_host)) {
-  NeedTrans = !IsGPU;
-  Skip = IsGPU;
-} else if (A->getOption().matches(options::OPT_Xarch__) && IsGPU) {
+  NeedTrans = !IsDevice;
+  Skip = IsDevice;
+} else if (A->getOption().matches(options::OPT_Xarch__) && IsDevice) {
   // Do not translate -Xarch_ options for non CUDA/HIP toolchain since
   // they may need special translation.
   // Skip this argument unless the architecture matches BoundArch


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -355,3 +355,21 @@
 // RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
 
 // CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
+
+//
+// Check that `-Xarch_host` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_host -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-HOST %s
+// XARCH-HOST: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
+// XARCH-HOST-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+
+//
+// Check that `-Xarch_device` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_device -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-DEVICE %s
+// XARCH-DEVICE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+// XARCH-DEVICE-NOT: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -1333,17 +1333,17 @@
   DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
   bool Modified = false;
 
-  bool IsGPU = OFK == Action::OFK_Cuda || OFK == Action::OFK_HIP;
+  bool IsDevice = OFK != Action::OFK_None && OFK != Action::OFK_Host;
   for (Arg *A : Args) {
 bool NeedTrans = false;
 bool Skip = false;
 if (A->getOption().matches(options::OPT_Xarch_device)) {
-  NeedTrans = IsGPU;
-  Skip = !IsGPU;
+  NeedTrans = IsDevice;
+  Skip = !IsDevic

[PATCH] D141826: [WIP][clang][TemplateBase] Add IsDefaulted bit to TemplateArgument

2023-01-17 Thread Michael Buch via Phabricator via cfe-commits
Michael137 added a comment.

In D141826#4058866 , @erichkeane 
wrote:

> This seems innocuous enough/easy enough to use.  I'd like a comment on the 
> functions at least and types in TemplateBase.h to specify that this is for 
> printing-policy only?  Alternatively (and perhaps MUCH more appreciated) 
> would be to make sure we mark the defaulted during AST generation as well.

I'll have a look at doing that

Are you suggesting we do the substitution check that the TypePrinter currently 
does when constructing the specialisation decls? So the TypePrinter simply 
needs to check the `TemplateArgument::getIsDefaulted`? I like the sound of that.

Unfortunately we'd still need the `setIsDefaulted` because of the DWARF 
limitation in LLDB


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141826

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


[PATCH] D141826: [WIP][clang][TemplateBase] Add IsDefaulted bit to TemplateArgument

2023-01-17 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D141826#4059073 , @Michael137 
wrote:

> In D141826#4058866 , @erichkeane 
> wrote:
>
>> This seems innocuous enough/easy enough to use.  I'd like a comment on the 
>> functions at least and types in TemplateBase.h to specify that this is for 
>> printing-policy only?  Alternatively (and perhaps MUCH more appreciated) 
>> would be to make sure we mark the defaulted during AST generation as well.
>
> I'll have a look at doing that
>
> Are you suggesting we do the substitution check that the TypePrinter 
> currently does when constructing the specialisation decls? So the TypePrinter 
> simply needs to check the `TemplateArgument::getIsDefaulted`? I like the 
> sound of that.
>
> Unfortunately we'd still need the `setIsDefaulted` because of the DWARF 
> limitation in LLDB

Yes, thats my thought.  Of course we'd still need the 'setIsDefaulted', but at 
least it would be something that coudl be generally useful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141826

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


[PATCH] D137058: [Driver] [Modules] Support -fmodule-output (1/2)

2023-01-17 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D137058#4055275 , @ChuanqiXu wrote:

> In D137058#4050188 , @dblaikie 
> wrote:
>
>> I really don't think this is the right thing to do - the Split DWARF code, 
>> for instance, has support for GPU bundling that's missing in the module file 
>> naming code, which seems likely to be broken & within reason handle-able 
>> today by reusing the Split DWARF code, similarly with the multi-arch 
>> bundling for MachO. But I've tried to explain these things in several ways, 
>> and haven't managed to connect.
>>
>> Carry on.
>
> Thanks for your patient reviewing! We can merge the logics with Split DWARF 
> code someday when we find it necessary.

My concern is that when it becomes necessary it won't be apparent - someone 
will fix (or introduce) a bug in one codepath, unaware of the other similar 
codepath. Unifying them before that happens is valuable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137058

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


[PATCH] D141855: [include-mapping] Parse zombie_names.html into a removed symbols map.

2023-01-17 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 489824.
VitaNuo added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141855

Files:
  clang/tools/include-mapping/gen_std.py


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -60,16 +60,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
-  default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  parser.add_argument('-symbols',
+  default='cpp_symbols',
+  help='Generate c or cpp (removed) symbols. One of 
{cpp_symbols, c_symbols, cpp_removed_symbols}.',
+  required=True)   
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +87,26 @@
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
 parse_pages = [(page_root, "index.html", None)]
-
+  elif args.symbols == 'cpp_removed_symbols':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
-os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
+os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')  
+  print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -60,16 +60,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
-  default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  parser.add_argument('-symbols',
+  default='cpp_symbols',
+  help='Generate c or cpp (removed) symbols. One of {cpp_symbols, c_symbols, cpp_removed_symbols}.',
+  required=True)   
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +87,26 @@
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
 parse_pages = [(page_root, "index.html", None)]
-
+  elif args.symbols == 'cpp_removed_symbols':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
-os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print

[PATCH] D141855: [include-mapping] Parse zombie_names.html into a removed symbols map.

2023-01-17 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 489827.
VitaNuo added a comment.

Remove extra whitespace.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141855

Files:
  clang/tools/include-mapping/gen_std.py


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -60,16 +60,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
-  default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  parser.add_argument('-symbols',
+  default='cpp_symbols',
+  help='Generate c or cpp (removed) symbols. One of 
{cpp_symbols, c_symbols, cpp_removed_symbols}.',
+  required=True) 
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +87,26 @@
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
 parse_pages = [(page_root, "index.html", None)]
-
+  elif args.symbols == 'cpp_removed_symbols':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
+  print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -60,16 +60,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
-  default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  parser.add_argument('-symbols',
+  default='cpp_symbols',
+  help='Generate c or cpp (removed) symbols. One of {cpp_symbols, c_symbols, cpp_removed_symbols}.',
+  required=True) 
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +87,26 @@
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
 parse_pages = [(page_root, "index.html", None)]
-
+  elif args.symbols == 'cpp_removed_symbols':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))

[PATCH] D139114: [Clang][Sema] Enabled implicit conversion warning for CompoundAssignment operator.

2023-01-17 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment.

> I’ll have to filter the warnings to see if there are any other instances with 
> other operators that appear problematic.

I count a single warning that triggers for an arithmetic operator (which might 
be a bug):

  ../drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10067:14: warning: implicit 
conversion from 'int' to 's8' (aka 'signed char') changes value from 128 to 
-128 [-Wconstant-conversion]
  cal_val -= 128;
 ^~~

and a few that trigger for `|=` (but I think they are all false positives?):

  ../drivers/usb/gadget/udc/bdc/bdc_core.c:62:17: warning: implicit conversion 
from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 
18446744071830503424 to 2415919104 [-Wconstant-conversion]
  temp |= BDC_COS|BDC_COP_STP;
  ~~~^~~~
  
  ../drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c:62:13: warning: 
implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes 
value from 18446744073707454463 to 4292870143 [-Wconstant-conversion]
  ledcfg |= ~BIT(21);
^~~~
  
  ../drivers/net/ethernet/intel/igb/igb_main.c:1834:42: warning: implicit 
conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value 
from 18446744073709486592 to 4294902272 [-Wconstant-conversion]
  tqavctrl |= E1000_TQAVCTRL_DATATRANTIM |
  ~~~^
  
  ../drivers/iio/adc/imx7d_adc.c:243:10: warning: implicit conversion from 
'unsigned long' to 'u32' (aka 'unsigned int') changes value from 
18446744073172680704 to 3758096384 [-Wconstant-conversion]
  cfg1 |= (IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN |
  ^~~


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139114

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


[PATCH] D141705: [HLSL] [Dirver] add dxv as a VerifyDebug Job

2023-01-17 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added a comment.

Re-using the `VerifyDebug` action really doesn't make sense. That's not what 
the DXIL validator does, and it will be a source of confusion forever.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141705

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


[PATCH] D141855: [include-mapping] Parse zombie_names.html into a removed symbols map.

2023-01-17 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 489828.
VitaNuo added a comment.

Adjust argument value set.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141855

Files:
  clang/tools/include-mapping/gen_std.py


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -60,16 +60,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
+  parser.add_argument('-symbols',
   default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  help='Generate c or cpp (removed) symbols. One of {cpp, 
c, cppremoved}.',
+  required=True) 
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +87,26 @@
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
 parse_pages = [(page_root, "index.html", None)]
-
+  elif args.symbols == 'cppremoved':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
+  print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -60,16 +60,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
+  parser.add_argument('-symbols',
   default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  help='Generate c or cpp (removed) symbols. One of {cpp, c, cppremoved}.',
+  required=True) 
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +87,26 @@
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
 parse_pages = [(page_root, "index.html", None)]
-
+  elif args.symbols == 'cppremoved':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
+  print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqual

[PATCH] D141855: [include-mapping] Parse zombie_names.html into a removed symbols map.

2023-01-17 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo marked an inline comment as done.
VitaNuo added a comment.

Yes, ofc I've run it, I wouldn't send a patch otherwise :)




Comment at: clang/tools/include-mapping/gen_std.py:67
   required=True)
+  parser.add_argument('-output',
+  default='SymbolMap.inc',

hokein wrote:
> instead adding two CLI flags, I'd suggest extending the existing `language` 
> flag to something like `-symbols = {cpp_symbols, c_symbols, 
> cpp_removed_symbols}`, it is easy to extend in the future (e.g. 
> `c_removed_symbols`).
> 
Sure, good idea!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141855

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


[PATCH] D141705: [HLSL] [Dirver] add dxv as a VerifyDebug Job

2023-01-17 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added inline comments.



Comment at: clang/lib/Driver/Driver.cpp:4215
+  // Call validator for dxc.
+  if (IsDXCMode()) {
+Action *LastAction = Actions.back();

Shouldn't the validator only run if we are targeting DXIL? Also we should 
probably add the `-Vd` flag to opt out.



Comment at: clang/lib/Driver/ToolChains/HLSL.cpp:169
+: ToolChain(D, Triple, Args) {
+  if (Args.hasArg(options::OPT_dxc_validator_path_EQ))
+getProgramPaths().push_back(

If this option isn't specified we should probably search for `dxv` relative to 
`clang` and on the `PATH`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141705

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


[PATCH] D141625: [DeclContext] Sort the Decls before adding into DeclContext

2023-01-17 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D141625#4053067 , @steven_wu wrote:

> @akyrtzi has the good idea. It is really hard to control `Decl*` to get values
> to get an unstable iteration order from the small tests, going beyond 32 decls
> to get out of SmallPtrSet's small model is much consistent.
>
> Add test.

Could you make a smaller test (probably just a couple of decls) that fails with 
LLVM_ENABLE_REVERSE_ITERATION? Such a failure would be more reliable/simpler to 
reproduce, probably?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141625

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


[PATCH] D141826: [WIP][clang][TemplateBase] Add IsDefaulted bit to TemplateArgument

2023-01-17 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D141826#4059088 , @erichkeane 
wrote:

> In D141826#4059073 , @Michael137 
> wrote:
>
>> In D141826#4058866 , @erichkeane 
>> wrote:
>>
>>> This seems innocuous enough/easy enough to use.  I'd like a comment on the 
>>> functions at least and types in TemplateBase.h to specify that this is for 
>>> printing-policy only?  Alternatively (and perhaps MUCH more appreciated) 
>>> would be to make sure we mark the defaulted during AST generation as well.
>>
>> I'll have a look at doing that
>>
>> Are you suggesting we do the substitution check that the TypePrinter 
>> currently does when constructing the specialisation decls? So the 
>> TypePrinter simply needs to check the `TemplateArgument::getIsDefaulted`? I 
>> like the sound of that.
>>
>> Unfortunately we'd still need the `setIsDefaulted` because of the DWARF 
>> limitation in LLDB
>
> Yes, thats my thought.  Of course we'd still need the 'setIsDefaulted', but 
> at least it would be something that coudl be generally useful.

Yeah, +1 for ensuring everything goes through the one solution (the 
`IsDefaulted` flag, in this case) - it'll make sure the flag support is well 
tested & is less likely to bitrot/break lldb's use case due to unrelated clang 
changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141826

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


[clang-tools-extra] 2486c8d - [clangd] Disable modernize-macro-to-enum tidy check

2023-01-17 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2023-01-17T17:12:07+01:00
New Revision: 2486c8d7bb377fccfc269472e59d748ece277c88

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

LOG: [clangd] Disable modernize-macro-to-enum tidy check

Check relies on seeing PP-directives from preamble, hence it's unusable.
See https://github.com/clangd/clangd/issues/1464.

Added: 


Modified: 
clang-tools-extra/clangd/TidyProvider.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/TidyProvider.cpp 
b/clang-tools-extra/clangd/TidyProvider.cpp
index 4adc5345c6d9f..f3ed6f08a9acb 100644
--- a/clang-tools-extra/clangd/TidyProvider.cpp
+++ b/clang-tools-extra/clangd/TidyProvider.cpp
@@ -205,7 +205,7 @@ TidyProvider 
disableUnusableChecks(llvm::ArrayRef ExtraBadChecks) {
 
// Check relies on seeing ifndef/define/endif 
directives,
// clangd doesn't replay those when using a preamble.
-   "-llvm-header-guard",
+   "-llvm-header-guard", "-modernize-macro-to-enum",
 
// - Crashing Checks -
 



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


[PATCH] D141765: [FPEnv] Fix complex operations in strictfp mode

2023-01-17 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn added a comment.

Are we testing _Complex multiply or subtraction anywhere? I have a vague memory 
of multiply not working correctly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141765

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


[PATCH] D141775: [Clang] Export CanPassInRegisters as a type trait

2023-01-17 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments.



Comment at: clang/lib/Sema/SemaExprCXX.cpp:5387
+  return RD->canPassInRegisters();
+return true;
   }

erichkeane wrote:
> Is there good reason to return true for all non-record types?  Should we 
> instead be limiting the types that can make it this far?
Looking how it is used internally, I think it makes sense to restrict this to 
records. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141775

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


[PATCH] D141929: Add support for clang-cl's option /fexcess-precision.

2023-01-17 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam updated this revision to Diff 489833.

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

https://reviews.llvm.org/D141929

Files:
  clang/include/clang/Driver/Options.td
  clang/test/Driver/cl-options.c


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -233,6 +233,14 @@
 // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck 
-check-prefix=showIncludes_E %s
 // showIncludes_E-NOT: warning: argument unused during compilation: 
'--show-includes'
 
+// Floating point excess precision
+// RUN: %clang_cl /fexcess-precision=fast -### -- %s 2>&1 | FileCheck 
-check-prefix=f16-prec-fast %s
+// f16-prec-fast: -ffloat16-excess-precision=fast
+// RUN: %clang_cl /fexcess-precision=standard -### -- %s 2>&1 | FileCheck 
-check-prefix=f16-prec-std %s
+// f16-prec-std: -ffloat16-excess-precision=standard
+// RUN: %clang_cl /fexcess-precision=16 -### -- %s 2>&1 | FileCheck 
-check-prefix=f16-prec-none %s
+// f16-prec-none: -ffloat16-excess-precision=none
+
 // /source-charset: should warn on everything except UTF-8.
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16' in '/source-charset:utf-16'
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6650,6 +6650,9 @@
 def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,
   Alias;
 
+def _SLASH_fexcess_precision_EQ : CLJoined<"fexcess-precision=">,
+  Alias;
+
 // The _SLASH_O option handles all the /O flags, but we also provide separate
 // aliased options to provide separate help messages.
 def _SLASH_O : CLDXCJoined<"O">,


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -233,6 +233,14 @@
 // RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
 // showIncludes_E-NOT: warning: argument unused during compilation: '--show-includes'
 
+// Floating point excess precision
+// RUN: %clang_cl /fexcess-precision=fast -### -- %s 2>&1 | FileCheck -check-prefix=f16-prec-fast %s
+// f16-prec-fast: -ffloat16-excess-precision=fast
+// RUN: %clang_cl /fexcess-precision=standard -### -- %s 2>&1 | FileCheck -check-prefix=f16-prec-std %s
+// f16-prec-std: -ffloat16-excess-precision=standard
+// RUN: %clang_cl /fexcess-precision=16 -### -- %s 2>&1 | FileCheck -check-prefix=f16-prec-none %s
+// f16-prec-none: -ffloat16-excess-precision=none
+
 // /source-charset: should warn on everything except UTF-8.
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16' in '/source-charset:utf-16'
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6650,6 +6650,9 @@
 def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,
   Alias;
 
+def _SLASH_fexcess_precision_EQ : CLJoined<"fexcess-precision=">,
+  Alias;
+
 // The _SLASH_O option handles all the /O flags, but we also provide separate
 // aliased options to provide separate help messages.
 def _SLASH_O : CLDXCJoined<"O">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141784: [clang][Interp] Fix binary comma operators

2023-01-17 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D141784

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


[PATCH] D119708: [clang][lex] Remove `PPCallbacks::FileNotFound()`

2023-01-17 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added subscribers: v.g.vassilev, Hahnfeld.
Hahnfeld added a comment.
Herald added a subscriber: ributzka.
Herald added a project: All.

Hello, sorry for the late heads-up, but this functionality is used by ROOT: 
https://github.com/root-project/root/blob/f58cccf5ce7fd67894c7fd9e9e74d3f37bc1acba/core/metacling/src/TClingCallbacks.cxx#L282
 Any chance of bringing this back?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119708

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


[PATCH] D141381: [codegen] Store address of indirect arguments on the stack

2023-01-17 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D141381#4056661 , @fdeazeve wrote:

> In hindsight, this should have been obvious.
> While SROA will not touch this:
>
>   define @foo(ptr %arg) {
>  call void @llvm.dbg.declare(%arg, [...], metadata !DIExpression())
>
> It completely destroys the debug information provided by:
>
>   define @foo(ptr %arg) {
>  %ptr_storage = alloca ptr
>  store ptr %arg, ptr %ptr_storage
>  call void @llvm.dbg.declare(%ptr_storage, [...], metadata 
> !DIExpression(DW_OP_deref))
>
> In other words, SROA rewrites the above to:
>
>   define @foo(ptr %arg) {
>  call void @llvm.dbg.declare(undef, [...], metadata 
> !DIExpression(DW_OP_deref))

Seems reasonable to me that SROA should be able to do a better/the right job 
here, for this and other places where the equivalent operation might occur... 
but this is hardly my wheelhouse/don't take that perspective as gospel.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141381

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


[PATCH] D141944: [include-mapping] Fix gen_std.py test

2023-01-17 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo created this revision.
VitaNuo added a reviewer: hokein.
Herald added a project: All.
VitaNuo 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/D141944

Files:
  clang/tools/include-mapping/test.py


Index: clang/tools/include-mapping/test.py
===
--- clang/tools/include-mapping/test.py
+++ clang/tools/include-mapping/test.py
@@ -24,11 +24,11 @@
 
 actual = _ParseIndexPage(html)
 expected = [
-  ("abs", "abs.html", True),
-  ("abs", "complex/abs.html", True),
-  ("acos", "acos.html", False),
-  ("acosh", "acosh.html", False),
-  ("as_bytes", "as_bytes.html", False),
+  ("abs", "abs.html", 'int'),
+  ("abs", "complex/abs.html", 'std::complex'),
+  ("acos", "acos.html", None),
+  ("acosh", "acosh.html", None),
+  ("as_bytes", "as_bytes.html", None),
 ]
 self.assertEqual(len(actual), len(expected))
 for i in range(0, len(actual)):


Index: clang/tools/include-mapping/test.py
===
--- clang/tools/include-mapping/test.py
+++ clang/tools/include-mapping/test.py
@@ -24,11 +24,11 @@
 
 actual = _ParseIndexPage(html)
 expected = [
-  ("abs", "abs.html", True),
-  ("abs", "complex/abs.html", True),
-  ("acos", "acos.html", False),
-  ("acosh", "acosh.html", False),
-  ("as_bytes", "as_bytes.html", False),
+  ("abs", "abs.html", 'int'),
+  ("abs", "complex/abs.html", 'std::complex'),
+  ("acos", "acos.html", None),
+  ("acosh", "acosh.html", None),
+  ("as_bytes", "as_bytes.html", None),
 ]
 self.assertEqual(len(actual), len(expected))
 for i in range(0, len(actual)):
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141803: [Clang] Reject in-class defaulting of previously declared comparison operators

2023-01-17 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment.

Interesting it looks like neither gcc nor MSVC diagnose this either but it 
looks correct to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141803

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


[PATCH] D140959: RFC: Multilib prototype

2023-01-17 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham added a comment.

"Make difficult things possible": perhaps it might be useful to make sure it's 
at least //possible// to express a complex boolean function of the basic 
predicates, even if it's cumbersome? (So that, for example, you could make an 
attribute conditional on "this cc1 option but not that one".) I assume YAML 
would let you write something like an expression AST in hierarchical form, with 
predicates like `regex:` at the leaves, and internal nodes for AND, OR and NOT.

Then again, perhaps it's enough to just make sure there's extension room in the 
syntax so that this can be added later, and there's no need to actually 
implement it in the first version.




Comment at: 
clang/test/Driver/Inputs/baremetal_multilib/arm-none-eabi/multilib.yaml:75
+  noMatchAttrs: [fpregs]
+- regex: -target-feature \+vfp2sp
+  matchAttrs: [vfp2sp]

Nit: don't forget to document whether these use basic or extended regex syntax


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140959

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


[PATCH] D141625: [DeclContext] Sort the Decls before adding into DeclContext

2023-01-17 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added a comment.

In D141625#4056831 , @steven_wu wrote:

> Actually, sorting in `numberAnonymousDeclsWithin` doesn't work for some 
> reasons.

The reason for this doesn't work is `ASTWriter::WriteDeclContextLexicalBlock` 
also iterates on `DeclContext::decls()`, so there are at least two sorts needed 
in ASTWriter. I prefer the current implementation if there isn't any 
performance overhead since it makes the iterator on DeclContext to have stable 
order.

In D141625#4059186 , @dblaikie wrote:

> In D141625#4053067 , @steven_wu 
> wrote:
>
>> @akyrtzi has the good idea. It is really hard to control `Decl*` to get 
>> values
>> to get an unstable iteration order from the small tests, going beyond 32 
>> decls
>> to get out of SmallPtrSet's small model is much consistent.
>>
>> Add test.
>
> Could you make a smaller test (probably just a couple of decls) that fails 
> with LLVM_ENABLE_REVERSE_ITERATION? Such a failure would be more 
> reliable/simpler to reproduce, probably?

Sure but it is going to put a different requirement on the tests. Now ASTWriter 
only cares about a stable order for deterministic output so it is doing a diff 
on pcm. If changing to the reverse iterator test, this need to change to do 
FileCheck on a predetermined order.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141625

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


[PATCH] D141625: [DeclContext] Sort the Decls before adding into DeclContext

2023-01-17 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added a comment.

@dblaikie Do we have any bots running reverse iteration?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141625

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


[PATCH] D141935: [OpenMP] Make `-Xarch_host` and `-Xarch_device` work for OpenMP offloading

2023-01-17 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 accepted this revision.
tianshilei1992 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/D141935/new/

https://reviews.llvm.org/D141935

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


[PATCH] D141625: [DeclContext] Sort the Decls before adding into DeclContext

2023-01-17 Thread Thorsten via Phabricator via cfe-commits
tschuett added a comment.

EXPANSIVE_CHECKS will reshuffle the llvm::sort input: 
https://lists.llvm.org/pipermail/llvm-dev/2018-April/122576.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141625

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


[PATCH] D139114: [Clang][Sema] Enabled implicit conversion warning for CompoundAssignment operator.

2023-01-17 Thread Fahad Nayyar via Phabricator via cfe-commits
fahadnayyar added a comment.

@aaron.ballman  do you think that we should call ```CheckImplicitConversion``` 
only for arithemetic compound assignment operators like +=, -=, /=, *= and %= ?

For bitwiseAssign operators (|=, &=, ^=) and shiftAssign operators (<<= and 
>>=) we may have to check the semantics to understand what implicit conversions 
are allowed and what are not allowed and which of these we should include with 
```-Wconversion``` flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139114

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


[PATCH] D141550: [CompilerRT] Remove ubsan static runtime on Apple

2023-01-17 Thread Brittany Blue Gaston via Phabricator via cfe-commits
thetruestblue accepted this revision.
thetruestblue added a comment.

This seems reasonable to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141550

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


[PATCH] D124286: [modules] Allow parsing a duplicate Obj-C interface if a previous one comes from a hidden [sub]module.

2023-01-17 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

Nice new testcase snippets, LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124286

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


[PATCH] D140756: Add clang_CXXMethod_isExplicit to libclang

2023-01-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D140756#4055516 , @diseraluca 
wrote:

> In D140756#4051383 , @aaron.ballman 
> wrote:
>
>> LGTM aside from some minor things you can correct when landing.
>> 
>
> Thank you for the great suggestions!
>
> I'll try to correct it as soon as possible, hopefully this weekend.
> Should I update the revision or should I just modify it and land it after 
> ensuring that it works correctly?

Thanks for checking! Feel free to modify it and land it after ensuring it works 
correctly. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140756

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


[clang] eec516a - [OpenMP] Make `-Xarch_host` and `-Xarch_device` work for OpenMP offloading

2023-01-17 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2023-01-17T12:38:56-06:00
New Revision: eec516a0954a5a91490ac4b6e86196e9813d9185

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

LOG: [OpenMP] Make `-Xarch_host` and `-Xarch_device` work for OpenMP offloading

Clang currently supports the `-Xarch_host` and `-Xarch_device` variants
to handle passing arguments to only one part of the offloading
toolchain. This was previously only supported fully for HIP / CUDA This
patch simple updates the logic to make it work for any offloading kind.

Fixes #59799

Reviewed By: tianshilei1992

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

Added: 


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

Removed: 




diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 7708d1b4ab931..bc70205a6c01e 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1333,17 +1333,17 @@ llvm::opt::DerivedArgList 
*ToolChain::TranslateXarchArgs(
   DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
   bool Modified = false;
 
-  bool IsGPU = OFK == Action::OFK_Cuda || OFK == Action::OFK_HIP;
+  bool IsDevice = OFK != Action::OFK_None && OFK != Action::OFK_Host;
   for (Arg *A : Args) {
 bool NeedTrans = false;
 bool Skip = false;
 if (A->getOption().matches(options::OPT_Xarch_device)) {
-  NeedTrans = IsGPU;
-  Skip = !IsGPU;
+  NeedTrans = IsDevice;
+  Skip = !IsDevice;
 } else if (A->getOption().matches(options::OPT_Xarch_host)) {
-  NeedTrans = !IsGPU;
-  Skip = IsGPU;
-} else if (A->getOption().matches(options::OPT_Xarch__) && IsGPU) {
+  NeedTrans = !IsDevice;
+  Skip = IsDevice;
+} else if (A->getOption().matches(options::OPT_Xarch__) && IsDevice) {
   // Do not translate -Xarch_ options for non CUDA/HIP toolchain since
   // they may need special translation.
   // Skip this argument unless the architecture matches BoundArch

diff  --git a/clang/test/Driver/openmp-offload-gpu.c 
b/clang/test/Driver/openmp-offload-gpu.c
index 3dc2830067a55..9a05dafc16e96 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -355,3 +355,21 @@
 // RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
 
 // CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
+
+//
+// Check that `-Xarch_host` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_host -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-HOST %s
+// XARCH-HOST: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
+// XARCH-HOST-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+
+//
+// Check that `-Xarch_device` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_device -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-DEVICE %s
+// XARCH-DEVICE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+// XARCH-DEVICE-NOT: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"



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


[PATCH] D141935: [OpenMP] Make `-Xarch_host` and `-Xarch_device` work for OpenMP offloading

2023-01-17 Thread Joseph Huber 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 rGeec516a0954a: [OpenMP] Make `-Xarch_host` and 
`-Xarch_device` work for OpenMP offloading (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141935

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


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -355,3 +355,21 @@
 // RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
 
 // CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
+
+//
+// Check that `-Xarch_host` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_host -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-HOST %s
+// XARCH-HOST: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
+// XARCH-HOST-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+
+//
+// Check that `-Xarch_device` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_device -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-DEVICE %s
+// XARCH-DEVICE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+// XARCH-DEVICE-NOT: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -1333,17 +1333,17 @@
   DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
   bool Modified = false;
 
-  bool IsGPU = OFK == Action::OFK_Cuda || OFK == Action::OFK_HIP;
+  bool IsDevice = OFK != Action::OFK_None && OFK != Action::OFK_Host;
   for (Arg *A : Args) {
 bool NeedTrans = false;
 bool Skip = false;
 if (A->getOption().matches(options::OPT_Xarch_device)) {
-  NeedTrans = IsGPU;
-  Skip = !IsGPU;
+  NeedTrans = IsDevice;
+  Skip = !IsDevice;
 } else if (A->getOption().matches(options::OPT_Xarch_host)) {
-  NeedTrans = !IsGPU;
-  Skip = IsGPU;
-} else if (A->getOption().matches(options::OPT_Xarch__) && IsGPU) {
+  NeedTrans = !IsDevice;
+  Skip = IsDevice;
+} else if (A->getOption().matches(options::OPT_Xarch__) && IsDevice) {
   // Do not translate -Xarch_ options for non CUDA/HIP toolchain since
   // they may need special translation.
   // Skip this argument unless the architecture matches BoundArch


Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -355,3 +355,21 @@
 // RUN:| FileCheck --check-prefix=CHECK-SET-FEATURES %s
 
 // CHECK-SET-FEATURES: clang-offload-packager{{.*}}--image={{.*}}feature=+ptx64
+
+//
+// Check that `-Xarch_host` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_host -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-HOST %s
+// XARCH-HOST: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
+// XARCH-HOST-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+
+//
+// Check that `-Xarch_device` works for OpenMP offloading.
+//
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \
+// RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xarch_device -O3 %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=XARCH-DEVICE %s
+// XARCH-DEVICE: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-O3"
+// XARCH-DEVICE-NOT: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-O3"
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -1333,17 +1333,17 @@
   DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
   bool Modified = false;
 
-  bool IsGPU = OFK == Action::OFK_Cuda || OFK == Action::OFK_HIP;
+  bool IsDevice = OFK != Action::OFK_None && OFK != Action::OFK_Host;
   for (Arg *A : Args) {
 bool NeedTrans = false;
 bool Skip = false;
 if (A->getOption().matches(options::OPT_Xarch_device)) {
-  NeedTrans = IsGPU;
-  Skip = !IsGPU;
+  NeedTrans = IsDevice;
+  Skip = !IsDevice;
 } else if (A->getOption().matches(options::OPT_Xarch_host)) {
-  NeedTrans = !IsGPU;
-  Skip = IsGPU;
-} else if (A->getOption().matches(options::OPT_Xarch__) && IsGPU) {
+  NeedTrans = !IsDevice;
+  Skip = IsDevice;
+} else if 

[PATCH] D131915: [MLIR][OpenMP] Added target data, exit data, and enter data operation definition for MLIR.

2023-01-17 Thread Akash Banerjee via Phabricator via cfe-commits
TIFitis updated this revision to Diff 489881.
TIFitis added a comment.

Addressed reviewer comments.
Updated printer and parser to remove the IntegerAttr from appearing. Removed 
none from map type modifiers, absence of other modifiers implicitly means none. 
This helps keep it in closer to the specification.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131915

Files:
  mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
  mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
  mlir/test/Dialect/OpenMP/ops.mlir

Index: mlir/test/Dialect/OpenMP/ops.mlir
===
--- mlir/test/Dialect/OpenMP/ops.mlir
+++ mlir/test/Dialect/OpenMP/ops.mlir
@@ -451,6 +451,26 @@
 return
 }
 
+// CHECK-LABEL: omp_target_data
+func.func @omp_target_data (%if_cond : i1, %device : si32, %device_ptr: memref, %device_addr: memref, %map1: memref, %map2: memref) -> () {
+// CHECK: omp.target_data if(%[[VAL_0:.*]] : i1) device(%[[VAL_1:.*]] : si32) map((always, from -> %[[VAL_2:.*]] : memref))
+omp.target_data if(%if_cond : i1) device(%device : si32) map((always, from -> %map1 : memref)){}
+
+// CHECK: omp.target_data use_device_ptr(%[[VAL_3:.*]] : memref) use_device_addr(%[[VAL_4:.*]] : memref) map((close, present, to -> %[[VAL_2:.*]] : memref))
+omp.target_data use_device_ptr(%device_ptr : memref) use_device_addr(%device_addr : memref) map((close, present, to -> %map1 : memref)){}
+
+// CHECK: omp.target_data map((tofrom -> %[[VAL_2]] : memref), (alloc -> %[[VAL_5:.*]] : memref))
+omp.target_data map((tofrom -> %map1 : memref), (alloc -> %map2 : memref)){}
+
+// CHECK: omp.target_enter_data if(%[[VAL_0]] : i1) device(%[[VAL_1]] : si32) nowait map((alloc -> %[[VAL_2]] : memref))
+omp.target_enter_data if(%if_cond : i1) device(%device : si32) nowait map((alloc -> %map1 : memref))
+
+// CHECK: omp.target_exit_data if(%[[VAL_0]] : i1) device(%[[VAL_1]] : si32) nowait map((release -> %[[VAL_5]] : memref))
+omp.target_exit_data if(%if_cond : i1) device(%device : si32) nowait map((release -> %map2 : memref))
+
+return
+}
+
 // CHECK-LABEL: omp_target_pretty
 func.func @omp_target_pretty(%if_cond : i1, %device : si32,  %num_threads : i32) -> () {
 // CHECK: omp.target if({{.*}}) device({{.*}})
Index: mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
===
--- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -22,6 +22,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/TypeSwitch.h"
+#include "llvm/Frontend/OpenMP/OMPConstants.h"
 #include 
 
 #include "mlir/Dialect/OpenMP/OpenMPOpsDialect.cpp.inc"
@@ -536,6 +537,191 @@
   return success();
 }
 
+//===--===//
+// Parser, printer and verifier for Target Data
+//===--===//
+/// Parses a Map Clause.
+///
+/// map-clause = `map (` ( `(` `always, `? `close, `? `present, `? ( `to` |
+/// `from` | `delete` ) ` -> ` symbol-ref ` : ` type(symbol-ref) `)` )+ `)`
+/// Eg: map((release -> %1 : !llvm.ptr>), (always, close, from
+/// -> %2 : !llvm.ptr>))
+static ParseResult
+parseMapClause(OpAsmParser &parser,
+   SmallVectorImpl &map_operands,
+   SmallVectorImpl &map_operand_types, ArrayAttr &map_types) {
+  StringRef mapTypeMod;
+  OpAsmParser::UnresolvedOperand arg1;
+  Type arg1Type;
+  IntegerAttr arg2;
+  SmallVector mapTypesVec;
+  llvm::omp::OpenMPOffloadMappingFlags mapTypeBits;
+
+  auto parseTypeAndMod = [&]() -> ParseResult {
+if (parser.parseKeyword(&mapTypeMod))
+  return failure();
+
+if (mapTypeMod == "always")
+  mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_ALWAYS;
+if (mapTypeMod == "close")
+  mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_CLOSE;
+if (mapTypeMod == "present")
+  mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_PRESENT;
+
+if (mapTypeMod == "to")
+  mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO;
+if (mapTypeMod == "from")
+  mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
+if (mapTypeMod == "tofrom")
+  mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO |
+ llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
+if (mapTypeMod == "delete")
+  mapTypeBits |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_DELETE;
+return success();
+  };
+
+  auto parseMap = [&]() -> ParseResult {
+mapTypeBits = llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_NONE;
+
+if (parser.parseLParen() ||
+parser.parseCommaSeparatedList(parseTypeAndMod) ||
+parser.parseArrow() || parser.parseOperand(arg1) ||
+parser.

[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

2023-01-17 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli added a comment.

Hi -has anybody any more concern on this change? I'd like to submit it as soon 
as possible to unlock @mgorny .

Francesco


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

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


[PATCH] D136554: Implement CWG2631

2023-01-17 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

one more regression bisected to this: 
https://bugs.chromium.org/p/chromium/issues/detail?id=1408177
`incomplete type 'blink::ResourceClient' used in type trait expression`
I'll try to come up with a smaller repro


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136554

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


[PATCH] D141886: [Clang][test] Avoid FileCheck error when matching `-cc1`

2023-01-17 Thread Bryan Chan via Phabricator via cfe-commits
bryanpkc requested changes to this revision.
bryanpkc added inline comments.
This revision now requires changes to proceed.



Comment at: clang/test/Driver/modules-ts.cpp:23
 //
-// CHECK-USE: -cc1
+// CHECK-USE: -cc1{{[^[:xdigit:]]}}
 // CHECK-USE-SAME: -emit-obj

bryanpkc wrote:
> An easier-to-understand fix is to simply combine this line and the next:
> ```
> // CHECK-USE: -cc1 {{.*}} -emit-obj
> ```
Adding `-###` to this test totally changes the meaning of the test, and is not 
what I asked for. See lines 5 and 14 for examples of the correct approach.



Comment at: clang/test/Driver/modules.cpp:24-25
 //
-// RUN: %clang -std=c++2a -fmodule-file=%t/module.pcm -Dexport= %s -S -o 
%t/module.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE
-// RUN: %clang -std=c++20 -fmodule-file=%t/module.pcm -Dexport= %s -S -o 
%t/module.o -v 2>&1 | FileCheck %s --check-prefix=CHECK-USE
+// RUN: %clang -std=c++2a -fmodule-file=%t/module.pcm -Dexport= %s -S -o 
%t/module.o -v -### 2>&1 | FileCheck %s --check-prefix=CHECK-USE
+// RUN: %clang -std=c++20 -fmodule-file=%t/module.pcm -Dexport= %s -S -o 
%t/module.o -v -### 2>&1 | FileCheck %s --check-prefix=CHECK-USE
 //

Do not add `-###`, which totally changes the meaning of the test. See line 17 
for an example of what you need to do here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141886

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


[PATCH] D131915: [MLIR][OpenMP] Added target data, exit data, and enter data operation definition for MLIR.

2023-01-17 Thread Akash Banerjee via Phabricator via cfe-commits
TIFitis marked 5 inline comments as done.
TIFitis added a comment.

In D131915#4056730 , 
@kiranchandramohan wrote:

> LGTM. Thanks for making the changes and for your patience. Please wait a 
> couple of days to give other reviewers a chance to have a look before 
> submitting.

Thanks for reviewing the changes as well :)

> Could you update the Summary of this patch to specify what is in this patch 
> and what is left out? Also, might be useful to specify any special modelling, 
> like for the map clause.

I've updated the summary. The new map clause looks straight forward to me, 
anything particular you want me to mention in the summary?

> Could you specify the co-authors in the following way?
> Co-authored-by: abidmalikwaterloo 
> Co-authored-by: raghavendra 

Done.

Cheers,
Akash




Comment at: mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td:790
+//===-===//
+// 2.12.2 target data Construct
+//===-===//

kiranchandramohan wrote:
> Is this number from the OpenMP 5.0 standard? I think 5.0 does not have the 
> `present` map-type modifier. The printer includes this. I think we can either 
> remove things that are not there in 5.0 or add comments when items from newer 
> versions are included or alternatively change the number to the latest 
> version and call out everything that is not implemented.
Hi I've updated it to OpenMP 5.1 standard specification. We are missing the 
`depend` clause, and mapper and iterator values for the map_type_modifier which 
are already specified in the TODO.



Comment at: mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp:542
+// Parser, printer and verifier for Target Data
+//===--===//
+static ParseResult

kiranchandramohan wrote:
> Could you specify the EBNF (https://mlir.llvm.org/docs/LangRef/#notation) for 
> the expected structure of the map clause?
Now that we are using `IntegerAttr` we no longer need the Attr to be explicitly 
present when printing it. 

I have thus updated the printer and parser accordingly, also removed `none` as 
a map_type_modifier as absence of other modifiers implicitly implies it and 
prevents confusion by diverging from the specification.

Here's an example of the new custom printer:

```
omp.target_exit_data   map((release -> %1 : !llvm.ptr>), 
(always, close, from -> %2 : !llvm.ptr>))
```

Let me know if the EBNF is okay. Should I override clang-format and keep the 
grammar and Eg in the same line to make them easier to read?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131915

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


[PATCH] D127855: [OpenMP] Basic parse and sema support for modifiers in order clause

2023-01-17 Thread Jennifer Yu via Phabricator via cfe-commits
jyu2 added a comment.

Hi @sandeepkosuri, do you plan to fix this?  Thanks.  Jennifer


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127855

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


[PATCH] D141625: [DeclContext] Sort the Decls before adding into DeclContext

2023-01-17 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added a comment.

In D141625#4059540 , @tschuett wrote:

> EXPANSIVE_CHECKS will reshuffle the llvm::sort input: 
> https://lists.llvm.org/pipermail/llvm-dev/2018-April/122576.html

This is a slightly different concern. The problem to catch is iterating over a 
SmallPtrSet, not identical sort key.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141625

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


[clang] 09e4449 - [PS5] Handle visibility options same as PS4

2023-01-17 Thread Paul Robinson via cfe-commits

Author: Paul Robinson
Date: 2023-01-17T11:27:51-08:00
New Revision: 09e4449901d7fc780806778181cf3136c1e08e98

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

LOG: [PS5] Handle visibility options same as PS4

This update was missed in the initial rounds of upstreaming PS5.

Added: 
clang/test/Driver/ps4-ps5-visibility-dllstorageclass.c

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

Removed: 
clang/test/Driver/ps4-visibility-dllstorageclass.c



diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 5462634aa96da..212b3faa2dc74 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6033,7 +6033,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 CmdArgs.push_back("-fvisibility=protected");
   }
 
-  if (!RawTriple.isPS4())
+  // PS4/PS5 process these options in addClangTargetOptions.
+  if (!RawTriple.isPS()) {
 if (const Arg *A =
 Args.getLastArg(options::OPT_fvisibility_from_dllstorageclass,
 options::OPT_fno_visibility_from_dllstorageclass)) 
{
@@ -6047,6 +6048,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 options::OPT_fvisibility_externs_nodllstorageclass_EQ);
   }
 }
+  }
 
   if (const Arg *A = Args.getLastArg(options::OPT_mignore_xcoff_visibility)) {
 if (Triple.isOSAIX())

diff  --git a/clang/test/Driver/ps4-visibility-dllstorageclass.c 
b/clang/test/Driver/ps4-ps5-visibility-dllstorageclass.c
similarity index 94%
rename from clang/test/Driver/ps4-visibility-dllstorageclass.c
rename to clang/test/Driver/ps4-ps5-visibility-dllstorageclass.c
index e7d9b122eed6d..1a54990da4764 100644
--- a/clang/test/Driver/ps4-visibility-dllstorageclass.c
+++ b/clang/test/Driver/ps4-ps5-visibility-dllstorageclass.c
@@ -1,4 +1,4 @@
-// Check behaviour of -fvisibility-from-dllstorageclass options for PS4
+// Check behaviour of -fvisibility-from-dllstorageclass options for PS4/PS5.
 
 // DEFINE: %{triple} =
 // DEFINE: %{run} = \
@@ -11,6 +11,8 @@
 // DEFINE: --implicit-check-not=-fvisibility-externs-nodllstorageclass
 // REDEFINE: %{triple} = x86_64-scei-ps4
 // RUN: %{run}
+// REDEFINE: %{triple} = x86_64-sie-ps5
+// RUN: %{run}
 //
 // REDEFINE: %{run} = \
 // REDEFINE: %clang -### -target %{triple} \
@@ -26,6 +28,8 @@
 // REDEFINE: --implicit-check-not=-fvisibility-externs-nodllstorageclass
 // REDEFINE: %{triple} = x86_64-scei-ps4
 // RUN: %{run}
+// REDEFINE: %{triple} = x86_64-sie-ps5
+// RUN: %{run}
 
 // DEFAULTS:  "-fvisibility-from-dllstorageclass"
 // DEFAULTS-SAME: "-fvisibility-dllexport=protected"
@@ -51,6 +55,8 @@
 // REDEFINE: --implicit-check-not=warning:
 // REDEFINE: %{triple} = x86_64-scei-ps4
 // RUN: %{run}
+// REDEFINE: %{triple} = x86_64-sie-ps5
+// RUN: %{run}
 
 // UNUSED:  warning: argument unused during compilation: 
'-fvisibility-dllexport=hidden'
 // UNUSED-NEXT: warning: argument unused during compilation: 
'-fvisibility-nodllstorageclass=protected'
@@ -71,6 +77,8 @@
 // REDEFINE: --implicit-check-not=-fvisibility-externs-nodllstorageclass
 // REDEFINE: %{triple} = x86_64-scei-ps4
 // RUN: %{run}
+// REDEFINE: %{triple} = x86_64-sie-ps5
+// RUN: %{run}
 
 // REDEFINE: %{run} = \
 // REDEFINE: %clang -### -target x86_64-scei-ps4 \
@@ -87,6 +95,8 @@
 // REDEFINE: --implicit-check-not=-fvisibility-externs-nodllstorageclass
 // REDEFINE: %{triple} = x86_64-scei-ps4
 // RUN: %{run}
+// REDEFINE: %{triple} = x86_64-sie-ps5
+// RUN: %{run}
 
 // SOME:  "-fvisibility-from-dllstorageclass"
 // SOME-SAME: "-fvisibility-dllexport=protected"
@@ -114,6 +124,8 @@
 // REDEFINE: --implicit-check-not=-fvisibility-externs-nodllstorageclass
 // REDEFINE: %{triple} = x86_64-scei-ps4
 // RUN: %{run}
+// REDEFINE: %{triple} = x86_64-sie-ps5
+// RUN: %{run}
 
 // REDEFINE: %{run} = \
 // REDEFINE: %clang -### -target x86_64-scei-ps4 \
@@ -136,6 +148,8 @@
 // REDEFINE: --implicit-check-not=-fvisibility-externs-nodllstorageclass
 // REDEFINE: %{triple} = x86_64-scei-ps4
 // RUN: %{run}
+// REDEFINE: %{triple} = x86_64-sie-ps5
+// RUN: %{run}
 
 // ALL:  "-fvisibility-from-dllstorageclass"
 // ALL-SAME: "-fvisibility-dllexport=hidden"



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


  1   2   3   >