[clang] [Clang][RFC] Bypass TAD during overload resolution if a perfect match exists (PR #133426)

2025-04-18 Thread Nikita Popov via cfe-commits

nikic wrote:

The final version had a 4% improvement on clang bootstrap: 
https://llvm-compile-time-tracker.com/compare.php?from=23324b8b109aed1f77cb20cef476b795f33b6835&to=8c5a307bd8d406e6167a5cd3ce3c74e2e3bfb2a6&stat=instructions:u

Wow.

https://github.com/llvm/llvm-project/pull/133426
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [HLSL][RootSignature] Implement initial parsing of the descriptor table clause params (PR #133800)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`llvm-clang-x86_64-sie-ubuntu-fast` running on `sie-linux-worker` while 
building `clang,llvm` at step 5 "build-unified-tree".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/144/builds/23055


Here is the relevant piece of the build log for the reference

```
Step 5 (build-unified-tree) failure: build (failure)
...
0.161 [1550/5/57] Building DiagnosticGroups.inc...
0.172 [164/4/58] Building DiagnosticSerializationKinds.inc...
0.210 [130/32/59] Generating VCSVersion.inc
1.505 [123/38/60] Building CXX object 
tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Version.cpp.o
2.250 [123/37/61] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/FindDiagnosticID.cpp.o
2.403 [123/36/62] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ListWarnings.cpp.o
2.657 [123/35/63] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/DiagnosticNames.cpp.o
3.026 [123/34/64] Building CXX object 
tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Warnings.cpp.o
3.062 [123/33/65] Building CXX object 
tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/TreeView.cpp.o
4.412 [123/32/66] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
FAILED: 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/g++ -DCLANG_EXPORTS 
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/lib/Parse
 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/lib/Parse
 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include
 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/include
 -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/include 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include
 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden 
-Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings 
-Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long 
-Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess 
-Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
-Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti 
-UNDEBUG -std=c++17 -MD -MT 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
 -MF 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o.d
 -o 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
 -c 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/lib/Parse/ParseHLSLRootSignature.cpp
In file included from 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Parse/ParseHLSLRootSignature.h:23,
 from 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/lib/Parse/ParseHLSLRootSignature.cpp:9:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h:42:12:
 error: declaration of ‘llvm::hlsl::rootsig::Register 
llvm::hlsl::rootsig::DescriptorTableClause::Register’ changes meaning of 
‘Register’ [-fpermissive]
   42 |   Register Register;
  |^~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h:28:8:
 note: ‘Register’ declared here as ‘struct llvm::hlsl::rootsig::Register’
   28 | struct Register {
  |^~~~
4.595 [123/31/67] Building CXX object 
lib/Object/CMakeFiles/LLVMObject.dir/IRSymtab.cpp.o
12.378 [123/30/68] Building CXX object 
tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/DiagnosticIDs.cpp.o
12.829 [123/29/69] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseAST.cpp.o
13.554 [123/28/70] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseInit.cpp.o
13.811 [123/27/71] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSL.cpp.o
14.226 [123/26/72] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseTentative.cpp.o
14.773 [123/25/73] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/Parser.cpp.o
15.324 [123/24/74] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseCXXInlineMethods.cpp.o

[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Andrew Savonichev via cfe-commits

https://github.com/asavonic ready_for_review 
https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`clang-cmake-x86_64-avx512-linux` running on `avx512-intel64` while building 
`clang,llvm` at step 7 "ninja check 1".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/133/builds/14743


Here is the relevant piece of the build log for the reference

```
Step 7 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/clang
 -cc1 -internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/Inputs/include
-internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -  | 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck
 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/clang
 -cc1 -internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/Inputs/include
 -internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -
+ 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck
 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c'
 
   2: source_filename = 
"/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/clang/test/Headers/gpuintrin_lang.c"
 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ca9ec7d - [ARM, AArch64] Fix passing of structures with aligned base classes (#135564)

2025-04-18 Thread via cfe-commits

Author: Harald van Dijk
Date: 2025-04-18T02:11:02+01:00
New Revision: ca9ec7dfc3a5ebad9e5c25b30511b2ed73287f61

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

LOG: [ARM, AArch64] Fix passing of structures with aligned base classes 
(#135564)

RecordLayout::UnadjustedAlignment was documented as "Maximum of the
alignments of the record members in characters", but
RecordLayout::getUnadjustedAlignment(), which just returns
UnadjustedAlignment, was documented as getting "the record alignment in
characters, before alignment adjustement." These are not the same thing:
the former excludes alignment of base classes, the latter takes it into
account. ItaniumRecordLayoutBuilder::LayoutBase was setting it according
to the former, but the AAPCS calling convention handling, currently the
only user, relies on it being set according to the latter.

Fixes #135551.

Added: 


Modified: 
clang/include/clang/AST/RecordLayout.h
clang/lib/AST/RecordLayoutBuilder.cpp
clang/test/CodeGen/AArch64/args.cpp
clang/test/CodeGen/aapcs64-align.cpp
clang/test/CodeGen/arm-vfp16-arguments2.cpp

Removed: 




diff  --git a/clang/include/clang/AST/RecordLayout.h 
b/clang/include/clang/AST/RecordLayout.h
index dd18f9c49f84f..6cf08e76396e2 100644
--- a/clang/include/clang/AST/RecordLayout.h
+++ b/clang/include/clang/AST/RecordLayout.h
@@ -75,8 +75,9 @@ class ASTRecordLayout {
   // performance or backwards compatibility preserving (e.g. AIX-ABI).
   CharUnits PreferredAlignment;
 
-  // UnadjustedAlignment - Maximum of the alignments of the record members in
-  // characters.
+  // UnadjustedAlignment - Alignment of record in characters before alignment
+  // adjustments. Maximum of the alignments of the record members and base
+  // classes in characters.
   CharUnits UnadjustedAlignment;
 
   /// RequiredAlignment - The required alignment of the object.  In the MS-ABI
@@ -186,7 +187,7 @@ class ASTRecordLayout {
   CharUnits getPreferredAlignment() const { return PreferredAlignment; }
 
   /// getUnadjustedAlignment - Get the record alignment in characters, before
-  /// alignment adjustement.
+  /// alignment adjustment.
   CharUnits getUnadjustedAlignment() const { return UnadjustedAlignment; }
 
   /// getSize - Get the record size in characters.

diff  --git a/clang/lib/AST/RecordLayoutBuilder.cpp 
b/clang/lib/AST/RecordLayoutBuilder.cpp
index ea353f88a8aec..dd932f6179f88 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const 
BaseSubobjectInfo *Base) {
 setSize(std::max(getSize(), Offset + Layout.getSize()));
 
   // Remember max struct/class alignment.
+  UnadjustedAlignment = std::max(UnadjustedAlignment, BaseAlign);
   UpdateAlignment(BaseAlign, UnpackedAlignTo, PreferredBaseAlign);
 
   return Offset;

diff  --git a/clang/test/CodeGen/AArch64/args.cpp 
b/clang/test/CodeGen/AArch64/args.cpp
index 6f1f3d5e2a062..3cb62d3119ecf 100644
--- a/clang/test/CodeGen/AArch64/args.cpp
+++ b/clang/test/CodeGen/AArch64/args.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs -emit-llvm 
-o - %s | FileCheck %s --check-prefixes=CHECK,DARWIN
-// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - -x c %s | 
FileCheck %s --check-prefixes=CHECK,C
-// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,CXX
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - -x c %s | 
FileCheck %s --check-prefixes=CHECK,C,AAPCS
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,CXX,AAPCS
 
 // Empty structs are ignored for PCS purposes on Darwin and in C mode 
elsewhere.
 // In C++ mode on ELF they consume a register slot though. Functions are
@@ -110,3 +110,110 @@ EXTERNC struct SortOfEmpty sort_of_empty_arg_variadic(int 
a, ...) {
   return b;
 }
 
+// Base case, nothing interesting.
+struct S {
+  long x, y;
+};
+
+// CHECK-LABEL: @g_S(
+// CHECK: call void @f_S(i64 noundef 1, [2 x i64] {{.*}})
+// CHECK: call void @fm_S(i64 noundef 1, i64 noundef 2, i64 noundef 3, i64 
noundef 4, i64 noundef 5, [2 x i64] {{.*}})
+EXTERNC void f_S(long, struct S);
+EXTERNC void fm_S(long, long, long, long, long, struct S);
+EXTERNC void g_S() {
+  struct S s = {6, 7};
+  f_S(1, s);
+  fm_S(1, 2, 3, 4, 5, s);
+}
+
+// Aligned struct passed according to its natural alignment.
+struct __attribute__((aligned(16))) S16 {
+  long x, y;
+};
+
+// CHECK-LABEL: @g_S16(
+// DARWIN: call void @f_S16(i64 noundef 1, i128 {{.*}})
+// AAPCS: call void @f_S16(i64 noundef 1, [2 x i64] {{.*}})
+// DARWIN: call void @fm_S16(i64 noundef 1, i64 noundef 2, i64 noundef 3, i64 
noundef 4, i64 noundef 5,

[clang] [llvm] [RISCV] Add processor definition for XiangShan-KunMingHu-V2R2 (PR #123193)

2025-04-18 Thread via cfe-commits

liliumShade wrote:

> LGTM in general, but I have a question here: can you clarify the naming 
> strategy? The name used in `-mcpu` is `xiangshan-kunminghu`, which 
> corresponds to the `V2R2` version now apparently. Then, will there be 
> `V2R3`/`V3R2`/...? If so, what should we use in `-mcpu`?
  
Thank you for raising this! To clarify: V2R2 is the current frozen version of 
kunminghu, the subsequent development in the plan will not affect the ISA 
string and pipeline.

If significant changes ever arise in a future major version (e.g., a 
hypothetical V3), we will introduce a new -mcpu name to reflect that 
divergence. 

https://github.com/llvm/llvm-project/pull/123193
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] [libclc] Set OpenCL C version for each target (PR #135733)

2025-04-18 Thread Matt Arsenault via cfe-commits

arsenm wrote:

> LGTM. That means we compile for the last OpenCL version, which is 3.0, and 
> enable all OpenCL extensions/features, right?

Yes. Otherwise you have to still write the code to work with the lowest common 
denominator.


https://github.com/llvm/llvm-project/pull/135733
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a8fe21f - [clang] Handle instantiated members to determine visibility (#136128)

2025-04-18 Thread via cfe-commits

Author: Andrew Savonichev
Date: 2025-04-18T20:29:19+09:00
New Revision: a8fe21f3f502a49cb05b69b0d6fa74472b93888a

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

LOG: [clang] Handle instantiated members to determine visibility (#136128)

As reported in issue #103477, visibility of instantiated member
functions used to be ignored when calculating visibility of a
specialization.

This patch modifies `getLVForClassMember` to look up for a source
template for an instantiated member, and changes `mergeTemplateLV` to
apply it.

A similar issue was reported in #31462, but it seems that `extern`
declaration with visibility prevents the function from being emitted as
hidden. This behavior seems correct, even though GCC emits it as with
default visibility instead.

Both tests from #103477 and #31462 are added as LIT tests `test72` and
`test73` respectively.

Added: 


Modified: 
clang/lib/AST/Decl.cpp
clang/test/CodeGenCXX/visibility.cpp

Removed: 




diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index ad1cb01592e9b..b59619892979a 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -400,9 +400,9 @@ void LinkageComputer::mergeTemplateLV(
   FunctionTemplateDecl *temp = specInfo->getTemplate();
   // Merge information from the template declaration.
   LinkageInfo tempLV = getLVForDecl(temp, computation);
-  // The linkage of the specialization should be consistent with the
-  // template declaration.
-  LV.setLinkage(tempLV.getLinkage());
+  // The linkage and visibility of the specialization should be
+  // consistent with the template declaration.
+  LV.mergeMaybeWithVisibility(tempLV, considerVisibility);
 
   // Merge information from the template parameters.
   LinkageInfo paramsLV =
@@ -1051,6 +1051,13 @@ LinkageComputer::getLVForClassMember(const NamedDecl *D,
 if (const auto *redeclTemp = dyn_cast(temp)) {
   if (isExplicitMemberSpecialization(redeclTemp)) {
 explicitSpecSuppressor = temp->getTemplatedDecl();
+  } else if (const RedeclarableTemplateDecl *from =
+ redeclTemp->getInstantiatedFromMemberTemplate()) {
+// If no explicit visibility is specified yet, and this is an
+// instantiated member of a template, look up visibility there
+// as well.
+LinkageInfo fromLV = from->getLinkageAndVisibility();
+LV.mergeMaybeWithVisibility(fromLV, considerVisibility);
   }
 }
   }

diff  --git a/clang/test/CodeGenCXX/visibility.cpp 
b/clang/test/CodeGenCXX/visibility.cpp
index e1061f3dbd18f..b69278a71d48e 100644
--- a/clang/test/CodeGenCXX/visibility.cpp
+++ b/clang/test/CodeGenCXX/visibility.cpp
@@ -1457,9 +1457,45 @@ namespace test71 {
   // CHECK-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
   // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIiE3barIiEET_v(
   // CHECK-LABEL: define linkonce_odr hidden noundef i64 
@_ZN6test713fooIlE3zedEv(
-  // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
+  // CHECK-LABEL: define linkonce_odr hidden noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
   // CHECK-HIDDEN-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
   // CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIiE3barIiEET_v(
   // CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i64 
@_ZN6test713fooIlE3zedEv(
   // CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
 }
+
+// https://github.com/llvm/llvm-project/issues/103477
+namespace test72 {
+  template 
+  struct t {
+template 
+static HIDDEN void bar() {}
+  };
+
+  void test() {
+  t::bar<1>();
+  }
+  // CHECK-LABEL: define linkonce_odr hidden void 
@_ZN6test721tIcE3barILi1EEEvv(
+  // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void 
@_ZN6test721tIcE3barILi1EEEvv(
+}
+
+// https://github.com/llvm/llvm-project/issues/31462
+namespace test73 {
+  template  struct s {
+template 
+__attribute__((__visibility__("hidden"))) U should_not_be_exported();
+  };
+
+  template  template  U s::should_not_be_exported() {
+return U();
+  }
+
+  extern template struct __attribute__((__visibility__("default"))) s;
+
+  int f() {
+s o;
+return o.should_not_be_exported();
+  }
+  // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test731sIiE22should_not_be_exportedIiEET_v(
+  // CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 
@_ZN6test731sIiE22should_not_be_exportedIiEET_v(
+}



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


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Andrew Savonichev via cfe-commits

https://github.com/asavonic closed 
https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`openmp-offload-amdgpu-runtime-2` running on `rocm-worker-hw-02` while building 
`clang,llvm` at step 7 "Add check check-clang".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/10/builds/3722


Here is the relevant piece of the build log for the reference

```
Step 7 (Add check check-clang) failure: test (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/clang 
-cc1 -internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/Inputs/include
-internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c
 -o -  | 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/FileCheck 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/clang 
-cc1 -internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/Inputs/include
 -internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c
 -o -
+ 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/FileCheck 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c'
 
   2: source_filename = 
"/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/Headers/gpuintrin_lang.c"
 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Andrew Savonichev via cfe-commits

asavonic wrote:

Thanks everyone for review!
Test issues were indeed fixed after rebase. 

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [clang][OpenMP][SPIR-V] Fix addrspace of global constants (PR #134399)

2025-04-18 Thread Nick Sarnie via cfe-commits

sarnex wrote:

@alexfh FYI I expect the problem is in LLVM and not the translator, but it's 
not that this change is totally wrong it's just a missed case as the goal of 
this commit was to add the address space, not remove it.

https://github.com/llvm/llvm-project/pull/134399
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [OpenACC] Switch Clang to use the Flang 'appertainment' rules for cla… (PR #135372)

2025-04-18 Thread Erich Keane via cfe-commits

https://github.com/erichkeane edited 
https://github.com/llvm/llvm-project/pull/135372
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][ARM][AArch64] Define intrinsics guarded by __has_builtin on all platforms (PR #128222)

2025-04-18 Thread Nick Sarnie via cfe-commits


@@ -36,6 +36,28 @@ typedef __SIZE_TYPE__ size_t;
 
 #include 
 
+#ifdef __ARM_ACLE
+// arm_acle.h needs some stdint types, but -ffreestanding prevents us from

sarnex wrote:

`arm_acle.h` already includes the correct header, `stdint.h`, the problem here 
is this test uses a custom `stdint.h` in the `Inputs/include` directory that 
doesn't have the required types, a better fix is to just add this code to that 
custom `stdint.h`, I'll do that in the next commit, thanks.

https://github.com/llvm/llvm-project/pull/128222
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Define convergence in C++ languages such as HIP, CUDA, OpenCL (PR #136280)

2025-04-18 Thread Sameer Sahasrabuddhe via cfe-commits

https://github.com/ssahasra created 
https://github.com/llvm/llvm-project/pull/136280

The proposed definition closely follows the existing definition of convergence 
in LLVM IR, but using C++ terms to describe language constructs.

There is no undefined behaviour. For each situation, convergence is either 
fully specified or implementation-defined.

Two important limitations where LLVM IR requires convergence control tokens to 
correctly express the convergence specified here:

1. Some combinations of loops, continue and break statements have different 
convergence specified for the statements inside that region of code, but result 
in the same loops in LLVM IR, thus producing ambiguous convergence in LLVM IR.

2. When a divergent condition inside a loop contains a convergent call followed 
by a break statement, these statements are lexically inside the loop, but in 
LLVM IR, they are outside the corresponding CFG loop.

>From 4ddf344b77cc01282571c643d621af34e6a7d8ad Mon Sep 17 00:00:00 2001
From: Sameer Sahasrabuddhe 
Date: Fri, 18 Apr 2025 12:21:36 +0530
Subject: [PATCH] [clang] Define convergence in C++ languages such as HIP,
 CUDA, OpenCL

The proposed definition closely follows the existing definition of convergence
in LLVM IR, but using C++ terms to describe language constructs.

There is no undefined behaviour. For each situation, convergence is either fully
specified or implementation-defined.

Two important limitations where LLVM IR requires convergence control tokens to
correctly express the convergence specified here:

1. Some combinations of loops, continue and break statements have different
   convergence specified for the statements inside that region of code, but
   result in the same loops in LLVM IR, thus producing ambiguous convergence in
   LLVM IR.

2. When a divergent condition inside a loop contains a convergent call followed
   by a break statement, these statements are lexically inside the loop, but in
   LLVM IR, they are outside the corresponding CFG loop.
---
 clang/docs/ThreadConvergence.rst  | 795 ++
 clang/docs/conf.py|   4 +
 clang/docs/index.rst  |   1 +
 clang/include/clang/AST/ParentMap.h   |  14 +-
 .../Analysis/Analyses/ConvergenceCheck.h  |  25 +
 clang/include/clang/Analysis/CFG.h|   2 +
 clang/include/clang/Basic/AttrDocs.td |  16 +-
 clang/include/clang/Basic/DiagnosticGroups.td |   3 +
 .../clang/Basic/DiagnosticSemaKinds.td|  10 +
 clang/lib/AST/ParentMap.cpp   |  65 +-
 clang/lib/Analysis/AnalysisDeclContext.cpp|   2 +-
 clang/lib/Analysis/CMakeLists.txt |   1 +
 clang/lib/Analysis/ConvergenceCheck.cpp   | 119 +++
 clang/lib/Sema/AnalysisBasedWarnings.cpp  |   7 +-
 clang/test/SemaHIP/convergence-warnings.hip   | 473 +++
 15 files changed, 1494 insertions(+), 43 deletions(-)
 create mode 100644 clang/docs/ThreadConvergence.rst
 create mode 100644 clang/include/clang/Analysis/Analyses/ConvergenceCheck.h
 create mode 100644 clang/lib/Analysis/ConvergenceCheck.cpp
 create mode 100644 clang/test/SemaHIP/convergence-warnings.hip

diff --git a/clang/docs/ThreadConvergence.rst b/clang/docs/ThreadConvergence.rst
new file mode 100644
index 0..d872ab9cb77f5
--- /dev/null
+++ b/clang/docs/ThreadConvergence.rst
@@ -0,0 +1,795 @@
+==
+Thread Convergence
+==
+
+.. contents::
+   :local:
+
+Revisions
+=
+
+- 2025/04/14 --- Created
+
+Introduction
+
+
+Some languages such as OpenCL, CUDA and HIP execute threads in groups 
(typically
+on a GPU) that allow efficient communication within the group using special
+*crosslane* primitives. The outcome of a crosslane communication
+is sensitive to the set of threads that execute it "together", i.e.,
+`convergently`__. When control flow *diverges*, i.e., threads of the same group
+follow different paths through the program, not all threads of the group may be
+available to participate in this communication.
+
+__ https://llvm.org/docs/ConvergenceAndUniformity.html
+
+Crosslane Operations
+
+
+A *crosslane operation* is an expression whose evaluation by multiple threads
+produces a side-effect visible to all those threads in a manner that does not
+depend on volatile objects, library I/O functions or memory. The set of threads
+which participate in this communication is implicitly affected by control flow.
+
+For example, in the following GPU compute kernel, communication during the
+crosslane operation is expected to occur precisely among an environment-defined
+set of threads (such as workgroup or subgroup) for which ``condition`` is true:
+
+.. code-block:: c++
+   :caption: A crosslane operation
+   :name: convergence-example-crosslane-operation
+
+   void example_kernel() {
+  ...
+  if (condition)
+  crosslane_operation();
+  ...
+   }
+
+Thread Convergence
+-

[clang] [clang-format] Fix a bug in BWACS_MultiLine (PR #136281)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)


Changes

Fixes #136266

---
Full diff: https://github.com/llvm/llvm-project/pull/136281.diff


2 Files Affected:

- (modified) clang/lib/Format/UnwrappedLineFormatter.cpp (+2-1) 
- (modified) clang/unittests/Format/FormatTest.cpp (+13-6) 


``diff
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp 
b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 6806ab18312ea..1298e3e7bab38 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -907,7 +907,8 @@ class LineJoiner {
 // { <-- current Line
 //   baz();
 // }
-if (Line.First == Line.Last && Line.First->isNot(TT_FunctionLBrace) &&
+if (Line.First == Line.Last &&
+Line.First->is(TT_ControlStatementLBrace) &&
 Style.BraceWrapping.AfterControlStatement ==
 FormatStyle::BWACS_MultiLine) {
   return 0;
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 49284c7f51e27..f97e8de02afb0 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2866,19 +2866,21 @@ TEST_F(FormatTest, ShortEnums) {
 }
 
 TEST_F(FormatTest, ShortCompoundRequirement) {
+  constexpr StringRef Code("template \n"
+   "concept c = requires(T x) {\n"
+   "  { x + 1 } -> std::same_as;\n"
+   "};");
+
   FormatStyle Style = getLLVMStyle();
   EXPECT_TRUE(Style.AllowShortCompoundRequirementOnASingleLine);
-  verifyFormat("template \n"
-   "concept c = requires(T x) {\n"
-   "  { x + 1 } -> std::same_as;\n"
-   "};",
-   Style);
+  verifyFormat(Code, Style);
   verifyFormat("template \n"
"concept c = requires(T x) {\n"
"  { x + 1 } -> std::same_as;\n"
"  { x + 2 } -> std::same_as;\n"
"};",
Style);
+
   Style.AllowShortCompoundRequirementOnASingleLine = false;
   verifyFormat("template \n"
"concept c = requires(T x) {\n"
@@ -2886,7 +2888,7 @@ TEST_F(FormatTest, ShortCompoundRequirement) {
"x + 1\n"
"  } -> std::same_as;\n"
"};",
-   Style);
+   Code, Style);
   verifyFormat("template \n"
"concept c = requires(T x) {\n"
"  {\n"
@@ -2897,6 +2899,11 @@ TEST_F(FormatTest, ShortCompoundRequirement) {
"  } -> std::same_as;\n"
"};",
Style);
+
+  Style.AllowShortCompoundRequirementOnASingleLine = true;
+  Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+  Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_MultiLine;
+  verifyFormat(Code, Style);
 }
 
 TEST_F(FormatTest, ShortCaseLabels) {

``




https://github.com/llvm/llvm-project/pull/136281
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Define convergence in C++ languages such as HIP, CUDA, OpenCL (PR #136280)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-analysis

Author: Sameer Sahasrabuddhe (ssahasra)


Changes

The proposed definition closely follows the existing definition of convergence 
in LLVM IR, but using C++ terms to describe language constructs.

There is no undefined behaviour. For each situation, convergence is either 
fully specified or implementation-defined.

Two important limitations where LLVM IR requires convergence control tokens to 
correctly express the convergence specified here:

1. Some combinations of loops, continue and break statements have different 
convergence specified for the statements inside that region of code, but result 
in the same loops in LLVM IR, thus producing ambiguous convergence in LLVM IR.

2. When a divergent condition inside a loop contains a convergent call followed 
by a break statement, these statements are lexically inside the loop, but in 
LLVM IR, they are outside the corresponding CFG loop.

---

Patch is 61.81 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/136280.diff


15 Files Affected:

- (added) clang/docs/ThreadConvergence.rst (+795) 
- (modified) clang/docs/conf.py (+4) 
- (modified) clang/docs/index.rst (+1) 
- (modified) clang/include/clang/AST/ParentMap.h (+12-2) 
- (added) clang/include/clang/Analysis/Analyses/ConvergenceCheck.h (+25) 
- (modified) clang/include/clang/Analysis/CFG.h (+2) 
- (modified) clang/include/clang/Basic/AttrDocs.td (+7-9) 
- (modified) clang/include/clang/Basic/DiagnosticGroups.td (+3) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+10) 
- (modified) clang/lib/AST/ParentMap.cpp (+35-30) 
- (modified) clang/lib/Analysis/AnalysisDeclContext.cpp (+1-1) 
- (modified) clang/lib/Analysis/CMakeLists.txt (+1) 
- (added) clang/lib/Analysis/ConvergenceCheck.cpp (+119) 
- (modified) clang/lib/Sema/AnalysisBasedWarnings.cpp (+6-1) 
- (added) clang/test/SemaHIP/convergence-warnings.hip (+473) 


``diff
diff --git a/clang/docs/ThreadConvergence.rst b/clang/docs/ThreadConvergence.rst
new file mode 100644
index 0..d872ab9cb77f5
--- /dev/null
+++ b/clang/docs/ThreadConvergence.rst
@@ -0,0 +1,795 @@
+==
+Thread Convergence
+==
+
+.. contents::
+   :local:
+
+Revisions
+=
+
+- 2025/04/14 --- Created
+
+Introduction
+
+
+Some languages such as OpenCL, CUDA and HIP execute threads in groups 
(typically
+on a GPU) that allow efficient communication within the group using special
+*crosslane* primitives. The outcome of a crosslane communication
+is sensitive to the set of threads that execute it "together", i.e.,
+`convergently`__. When control flow *diverges*, i.e., threads of the same group
+follow different paths through the program, not all threads of the group may be
+available to participate in this communication.
+
+__ https://llvm.org/docs/ConvergenceAndUniformity.html
+
+Crosslane Operations
+
+
+A *crosslane operation* is an expression whose evaluation by multiple threads
+produces a side-effect visible to all those threads in a manner that does not
+depend on volatile objects, library I/O functions or memory. The set of threads
+which participate in this communication is implicitly affected by control flow.
+
+For example, in the following GPU compute kernel, communication during the
+crosslane operation is expected to occur precisely among an environment-defined
+set of threads (such as workgroup or subgroup) for which ``condition`` is true:
+
+.. code-block:: c++
+   :caption: A crosslane operation
+   :name: convergence-example-crosslane-operation
+
+   void example_kernel() {
+  ...
+  if (condition)
+  crosslane_operation();
+  ...
+   }
+
+Thread Convergence
+--
+
+Whether two threads convergently execute an operation is different at every
+execution of that operation by those two threads. [Note: This corresponds to
+`dynamic instances in LLVM IR`__.] In a structured program, there is often an
+intuitive and unambiguous way of determining the threads that are converged at 
a
+particular operation. Threads may *diverge* at a *divergent branch*, and then
+*reconverge* at some later point in the program such as the end of an enclosing
+statement. However, this intuition does not work very well with unstructured
+control flow. In particular, when two threads enter an `irreducible cycle`__ in
+the control-flow graph along different paths, whether they converge inside the
+cycle and at which point depends on the choices made by the implementation.
+
+__ 
https://llvm.org/docs/ConvergenceAndUniformity.html#threads-and-dynamic-instances
+__ https://llvm.org/docs/CycleTerminology.html
+
+The intuitive picture of *convergence* is built around threads executing in
+"lock step" --- a set of threads is thought of as *converged* if they are all
+executing "the same sequence of instructions together". But this assumption is
+not necessary for describing c

[clang] [clang] Define convergence in C++ languages such as HIP, CUDA, OpenCL (PR #136280)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Sameer Sahasrabuddhe (ssahasra)


Changes

The proposed definition closely follows the existing definition of convergence 
in LLVM IR, but using C++ terms to describe language constructs.

There is no undefined behaviour. For each situation, convergence is either 
fully specified or implementation-defined.

Two important limitations where LLVM IR requires convergence control tokens to 
correctly express the convergence specified here:

1. Some combinations of loops, continue and break statements have different 
convergence specified for the statements inside that region of code, but result 
in the same loops in LLVM IR, thus producing ambiguous convergence in LLVM IR.

2. When a divergent condition inside a loop contains a convergent call followed 
by a break statement, these statements are lexically inside the loop, but in 
LLVM IR, they are outside the corresponding CFG loop.

---

Patch is 61.81 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/136280.diff


15 Files Affected:

- (added) clang/docs/ThreadConvergence.rst (+795) 
- (modified) clang/docs/conf.py (+4) 
- (modified) clang/docs/index.rst (+1) 
- (modified) clang/include/clang/AST/ParentMap.h (+12-2) 
- (added) clang/include/clang/Analysis/Analyses/ConvergenceCheck.h (+25) 
- (modified) clang/include/clang/Analysis/CFG.h (+2) 
- (modified) clang/include/clang/Basic/AttrDocs.td (+7-9) 
- (modified) clang/include/clang/Basic/DiagnosticGroups.td (+3) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+10) 
- (modified) clang/lib/AST/ParentMap.cpp (+35-30) 
- (modified) clang/lib/Analysis/AnalysisDeclContext.cpp (+1-1) 
- (modified) clang/lib/Analysis/CMakeLists.txt (+1) 
- (added) clang/lib/Analysis/ConvergenceCheck.cpp (+119) 
- (modified) clang/lib/Sema/AnalysisBasedWarnings.cpp (+6-1) 
- (added) clang/test/SemaHIP/convergence-warnings.hip (+473) 


``diff
diff --git a/clang/docs/ThreadConvergence.rst b/clang/docs/ThreadConvergence.rst
new file mode 100644
index 0..d872ab9cb77f5
--- /dev/null
+++ b/clang/docs/ThreadConvergence.rst
@@ -0,0 +1,795 @@
+==
+Thread Convergence
+==
+
+.. contents::
+   :local:
+
+Revisions
+=
+
+- 2025/04/14 --- Created
+
+Introduction
+
+
+Some languages such as OpenCL, CUDA and HIP execute threads in groups 
(typically
+on a GPU) that allow efficient communication within the group using special
+*crosslane* primitives. The outcome of a crosslane communication
+is sensitive to the set of threads that execute it "together", i.e.,
+`convergently`__. When control flow *diverges*, i.e., threads of the same group
+follow different paths through the program, not all threads of the group may be
+available to participate in this communication.
+
+__ https://llvm.org/docs/ConvergenceAndUniformity.html
+
+Crosslane Operations
+
+
+A *crosslane operation* is an expression whose evaluation by multiple threads
+produces a side-effect visible to all those threads in a manner that does not
+depend on volatile objects, library I/O functions or memory. The set of threads
+which participate in this communication is implicitly affected by control flow.
+
+For example, in the following GPU compute kernel, communication during the
+crosslane operation is expected to occur precisely among an environment-defined
+set of threads (such as workgroup or subgroup) for which ``condition`` is true:
+
+.. code-block:: c++
+   :caption: A crosslane operation
+   :name: convergence-example-crosslane-operation
+
+   void example_kernel() {
+  ...
+  if (condition)
+  crosslane_operation();
+  ...
+   }
+
+Thread Convergence
+--
+
+Whether two threads convergently execute an operation is different at every
+execution of that operation by those two threads. [Note: This corresponds to
+`dynamic instances in LLVM IR`__.] In a structured program, there is often an
+intuitive and unambiguous way of determining the threads that are converged at 
a
+particular operation. Threads may *diverge* at a *divergent branch*, and then
+*reconverge* at some later point in the program such as the end of an enclosing
+statement. However, this intuition does not work very well with unstructured
+control flow. In particular, when two threads enter an `irreducible cycle`__ in
+the control-flow graph along different paths, whether they converge inside the
+cycle and at which point depends on the choices made by the implementation.
+
+__ 
https://llvm.org/docs/ConvergenceAndUniformity.html#threads-and-dynamic-instances
+__ https://llvm.org/docs/CycleTerminology.html
+
+The intuitive picture of *convergence* is built around threads executing in
+"lock step" --- a set of threads is thought of as *converged* if they are all
+executing "the same sequence of instructions together". But this assumption is
+not necessary for describing communicat

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-18 Thread Qiongsi Wu via cfe-commits


@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID(
   return CacheShards[Hash % NumShards];
 }
 
+void DependencyScanningFilesystemSharedCache::
+diagnoseInvalidNegativeStatCachedPaths(
+std::vector &InvalidPaths,

qiongsiwu wrote:

Nope - fixed. Is it a style preference that we prefer a return value? I use 
either freely and I don't have a strong preference either way. 

https://github.com/llvm/llvm-project/pull/135703
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Fix the trailing comma regression (PR #136273)

2025-04-18 Thread Younan Zhang via cfe-commits

https://github.com/zyn0217 closed 
https://github.com/llvm/llvm-project/pull/136273
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c7daab2 - [Clang] Fix the trailing comma regression (#136273)

2025-04-18 Thread via cfe-commits

Author: Younan Zhang
Date: 2025-04-18T16:27:27+08:00
New Revision: c7daab259c3281cf8f649583993bad2536febc02

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

LOG: [Clang] Fix the trailing comma regression (#136273)

925e195 introduced a regression since which we started to accept invalid
trailing commas in many expression lists where they're not allowed by
the grammar. The issue came from the fact that an additional invalid
state - previously handled by ParseExpressionList - was overlooked in
that patch.

Fixes https://github.com/llvm/llvm-project/issues/136254

No release entry because I want to backport it.

Added: 


Modified: 
clang/lib/Parse/ParseExpr.cpp
clang/test/Parser/recovery.cpp

Removed: 




diff  --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 1416d52157dca..3e3e7cbcd68b2 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -2239,8 +2239,6 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
 if (PP.isCodeCompletionReached() && !CalledSignatureHelp)
   RunSignatureHelp();
 LHS = ExprError();
-  } else if (!HasError && HasTrailingComma) {
-Diag(Tok, diag::err_expected_expression);
   } else if (LHS.isInvalid()) {
 for (auto &E : ArgExprs)
   Actions.CorrectDelayedTyposInExpr(E);
@@ -3750,7 +3748,6 @@ bool Parser::ParseExpressionList(SmallVectorImpl 
&Exprs,
 if (Tok.is(tok::r_paren)) {
   if (HasTrailingComma)
 *HasTrailingComma = true;
-  break;
 }
   }
   if (SawError) {

diff  --git a/clang/test/Parser/recovery.cpp b/clang/test/Parser/recovery.cpp
index 2fce67a52c6b6..261f5dc99bad4 100644
--- a/clang/test/Parser/recovery.cpp
+++ b/clang/test/Parser/recovery.cpp
@@ -222,3 +222,21 @@ void k() {
   func(1, ); // expected-error {{expected expression}}
 }
 }
+
+namespace GH136254 {
+
+void call() {
+  [a(42, )]() {} (); // expected-error {{expected expression}}
+
+  int *b = new int(42, ); // expected-error {{expected expression}}
+
+  struct S {
+int c;
+
+S() : c(42, ) {} // expected-error {{expected expression}}
+  };
+
+  int d(42, ); // expected-error {{expected expression}}
+}
+
+}



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


[clang] [Clang] Fix the trailing comma regression (PR #136273)

2025-04-18 Thread Younan Zhang via cfe-commits

https://github.com/zyn0217 milestoned 
https://github.com/llvm/llvm-project/pull/136273
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format] Fix a bug in BWACS_MultiLine (PR #136281)

2025-04-18 Thread Owen Pan via cfe-commits

https://github.com/owenca created 
https://github.com/llvm/llvm-project/pull/136281

Fixes #136266

>From 0544b824ac0f81c8bb274063c885a5fb4d41ecef Mon Sep 17 00:00:00 2001
From: Owen Pan 
Date: Fri, 18 Apr 2025 01:24:54 -0700
Subject: [PATCH] [clang-format] Fix a bug in BWACS_MultiLine

Fixes #136266
---
 clang/lib/Format/UnwrappedLineFormatter.cpp |  3 ++-
 clang/unittests/Format/FormatTest.cpp   | 19 +--
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp 
b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 6806ab18312ea..1298e3e7bab38 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -907,7 +907,8 @@ class LineJoiner {
 // { <-- current Line
 //   baz();
 // }
-if (Line.First == Line.Last && Line.First->isNot(TT_FunctionLBrace) &&
+if (Line.First == Line.Last &&
+Line.First->is(TT_ControlStatementLBrace) &&
 Style.BraceWrapping.AfterControlStatement ==
 FormatStyle::BWACS_MultiLine) {
   return 0;
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 49284c7f51e27..f97e8de02afb0 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2866,19 +2866,21 @@ TEST_F(FormatTest, ShortEnums) {
 }
 
 TEST_F(FormatTest, ShortCompoundRequirement) {
+  constexpr StringRef Code("template \n"
+   "concept c = requires(T x) {\n"
+   "  { x + 1 } -> std::same_as;\n"
+   "};");
+
   FormatStyle Style = getLLVMStyle();
   EXPECT_TRUE(Style.AllowShortCompoundRequirementOnASingleLine);
-  verifyFormat("template \n"
-   "concept c = requires(T x) {\n"
-   "  { x + 1 } -> std::same_as;\n"
-   "};",
-   Style);
+  verifyFormat(Code, Style);
   verifyFormat("template \n"
"concept c = requires(T x) {\n"
"  { x + 1 } -> std::same_as;\n"
"  { x + 2 } -> std::same_as;\n"
"};",
Style);
+
   Style.AllowShortCompoundRequirementOnASingleLine = false;
   verifyFormat("template \n"
"concept c = requires(T x) {\n"
@@ -2886,7 +2888,7 @@ TEST_F(FormatTest, ShortCompoundRequirement) {
"x + 1\n"
"  } -> std::same_as;\n"
"};",
-   Style);
+   Code, Style);
   verifyFormat("template \n"
"concept c = requires(T x) {\n"
"  {\n"
@@ -2897,6 +2899,11 @@ TEST_F(FormatTest, ShortCompoundRequirement) {
"  } -> std::same_as;\n"
"};",
Style);
+
+  Style.AllowShortCompoundRequirementOnASingleLine = true;
+  Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+  Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_MultiLine;
+  verifyFormat(Code, Style);
 }
 
 TEST_F(FormatTest, ShortCaseLabels) {

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


[clang] [clang] Use llvm::append_range (NFC) (PR #136256)

2025-04-18 Thread Kazu Hirata via cfe-commits

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/136256
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix filename parsing in clang-format-diff.py for paths with spaces (PR #135779)

2025-04-18 Thread Owen Pan via cfe-commits

https://github.com/owenca approved this pull request.


https://github.com/llvm/llvm-project/pull/135779
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (PR #136234)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Farzon Lotfi (farzonl)


Changes

fixes #135654

In #128613 we added safe guards to prevent the lowering of just any 
intrinsic in the backend. We used `DiagnosticInfoUnsupported` to do this.

What we found was when using `opt` the diagnostic print function  was called 
but when using clang the diagnostic message was used.

Printing message in the clang version means we miss valuable debugging 
information like function name and function type when LLVMContext was only 
needed to call `getBestLocationFromDebugLoc`.

There are a few potential fixes

1. Write a custom DiagnosticInfoUnsupported so we can change the Message just 
for DirectX. Too heavy handed so rejected.

2. Add the function name to the Message in DirectX code. Very simple one line 
change. Downside is when using opt you see the function name twice. But makes 
the clang-dxc bugs more actionable.

3. change CodeGenAction.cpp to always use the print function and not the 
message directly. Downside is a bunch of innacurate information shows up in the 
message if you don't  specify `-debug-info-kind=standalone`.

4. add some book keeping to know which function called the intrinsic keep a map 
of these so we can pass the calling function to `DiagnosticInfoUnsupported` 
instead of the intrinsic. This would only be useful if we had debug info so we 
could distinguish different uses of the intrinsic by line\col number. We would 
also need to change from iterating on every function to doing something like a 
LazyCallGraph which is a nonstarter.

5. pick a different means of doing a Diagnostic error, because other uses of 
`DiagnosticInfoUnsupported` error when we are in the body of a function not 
when we see one being used like in the intrinsic case.

This PR went with option 2. Its low code change that also only impacts the 
DirectX backend.

---
Full diff: https://github.com/llvm/llvm-project/pull/136234.diff


3 Files Affected:

- (added) clang/test/CodeGenDirectX/unsupported_intrinsic.hlsl (+7) 
- (modified) llvm/lib/Target/DirectX/DXILOpLowering.cpp (+6-3) 
- (modified) llvm/test/CodeGen/DirectX/unsupported_intrinsic.ll (+1-1) 


``diff
diff --git a/clang/test/CodeGenDirectX/unsupported_intrinsic.hlsl 
b/clang/test/CodeGenDirectX/unsupported_intrinsic.hlsl
new file mode 100644
index 0..b10fb5d409f91
--- /dev/null
+++ b/clang/test/CodeGenDirectX/unsupported_intrinsic.hlsl
@@ -0,0 +1,7 @@
+// RUN: %if clang-dxc %{not %clang_dxc -T lib_6_3 %s 2>&1 | FileCheck %s %}
+
+// CHECK: error: Unsupported intrinsic llvm.vector.reduce.and.v4i32 for DXIL 
lowering
+
+export int vecReduceAndTest(int4 vec) {
+return __builtin_reduce_and(vec);
+}
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp 
b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index 4574e5f7bbd96..3ba963a5b4f8a 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -8,7 +8,6 @@
 
 #include "DXILOpLowering.h"
 #include "DXILConstants.h"
-#include "DXILIntrinsicExpansion.h"
 #include "DXILOpBuilder.h"
 #include "DXILShaderFlags.h"
 #include "DirectX.h"
@@ -27,6 +26,7 @@
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FormatVariadic.h"
 
 #define DEBUG_TYPE "dxil-op-lower"
 
@@ -756,8 +756,11 @@ class OpLowerer {
   case Intrinsic::not_intrinsic:
 continue;
   default: {
-DiagnosticInfoUnsupported Diag(
-F, "Unsupported intrinsic for DXIL lowering");
+std::string Msg =
+llvm::formatv("Unsupported intrinsic {0} for DXIL lowering",
+  F.getName())
+.str();
+DiagnosticInfoUnsupported Diag(F, Msg);
 M.getContext().diagnose(Diag);
 HasErrors |= true;
 break;
diff --git a/llvm/test/CodeGen/DirectX/unsupported_intrinsic.ll 
b/llvm/test/CodeGen/DirectX/unsupported_intrinsic.ll
index d703f2f04c494..3ee5ff89b02a2 100644
--- a/llvm/test/CodeGen/DirectX/unsupported_intrinsic.ll
+++ b/llvm/test/CodeGen/DirectX/unsupported_intrinsic.ll
@@ -1,6 +1,6 @@
 ; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 
2>&1 | FileCheck %s
 
-; CHECK: error: :0:0: in function llvm.vector.reduce.and.v4i32 i32 
(<4 x i32>): Unsupported intrinsic for DXIL lowering
+; CHECK: Unsupported intrinsic llvm.vector.reduce.and.v4i32 for DXIL lowering
 define i32 @fn_and(<4 x i32> %0) local_unnamed_addr #0 {
   %2 = tail call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> %0)
   ret i32 %2

``




https://github.com/llvm/llvm-project/pull/136234
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-18 Thread Qiongsi Wu via cfe-commits


@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID(
   return CacheShards[Hash % NumShards];
 }
 
+void DependencyScanningFilesystemSharedCache::
+diagnoseInvalidNegativeStatCachedPaths(
+std::vector &InvalidPaths,
+llvm::vfs::FileSystem &UnderlyingFS) const {
+  // Iterate through all shards and look for cached stat errors.
+  for (unsigned i = 0; i < NumShards; i++) {
+const CacheShard &Shard = CacheShards[i];
+std::lock_guard LockGuard(Shard.CacheLock);
+for (const auto &[Path, CachedPair] : Shard.CacheByFilename) {
+  const CachedFileSystemEntry *Entry = CachedPair.first;
+
+  if (Entry->getError()) {
+// Only examine cached errors.
+llvm::ErrorOr Stat = UnderlyingFS.status(Path);
+if (Stat) {
+  // This is the case where we have cached the non-existence
+  // of the file at Path first, and a a file at the path is created
+  // later. The cache entry is not invalidated (as we have no good
+  // way to do it now), which may lead to missing file build errors.
+  InvalidPaths.push_back(std::string(Path));

qiongsiwu wrote:

Sure! Fixed. I think it might be less burdensome for the client to not worry 
about how to allocate the string, but I don't have a strong opinion on this. Is 
it a performance reason where we do not want to allocate the strings here so 
the client can save the allocation if necessary? 

https://github.com/llvm/llvm-project/pull/135703
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 0348ff5 - [SYCL] Basic code generation for SYCL kernel caller offload entry point functions. (#133030)

2025-04-18 Thread via cfe-commits

Author: Tom Honermann
Date: 2025-04-17T09:14:45-04:00
New Revision: 0348ff515854438cab8a48b79e8839cb99d48701

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

LOG: [SYCL] Basic code generation for SYCL kernel caller offload entry point 
functions. (#133030)

A function declared with the `sycl_kernel_entry_point` attribute,
sometimes called a SYCL kernel entry point function, specifies a pattern
from which the parameters and body of an offload entry point function,
sometimes called a SYCL kernel caller function, are derived.

SYCL kernel caller functions are emitted during SYCL device compilation.
Their parameters and body are derived from the `SYCLKernelCallStmt`
statement and `OutlinedFunctionDecl` declaration associated with their
corresponding SYCL kernel entry point function. A distinct SYCL kernel
caller function is generated for each SYCL kernel entry point function
defined as a non-inline function or ODR-used in the translation unit.

The name of each SYCL kernel caller function is parameterized by the
SYCL kernel name type specified by the `sycl_kernel_entry_point`
attribute attached to the corresponding SYCL kernel entry point
function. For the moment, the Itanium ABI mangled name for typeinfo data
(`_ZTS`) is used to name these functions; a future change will
switch to a more appropriate naming scheme.

The calling convention used for a SYCL kernel caller function is target
dependent. Support for AMDGCN, NVPTX, and SPIR targets is currently
provided. These functions are required to observe the language
restrictions for SYCL devices as specified by the SYCL 2020
specification; this includes a forward progress guarantee and prohibits
recursion.

Only SYCL kernel caller functions, functions declared as
`SYCL_EXTERNAL`, and functions directly or indirectly referenced from
those functions should be emitted during device compilation. Pruning of
other declarations has not yet been implemented.

-

Co-authored-by: Elizabeth Andrews 

Added: 
clang/lib/CodeGen/CodeGenSYCL.cpp
clang/test/CodeGenSYCL/kernel-caller-entry-point.cpp

Modified: 
clang/include/clang/AST/SYCLKernelInfo.h
clang/lib/AST/ASTContext.cpp
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CMakeLists.txt
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/CodeGenTypes.h
clang/lib/CodeGen/Targets/NVPTX.cpp

Removed: 




diff  --git a/clang/include/clang/AST/SYCLKernelInfo.h 
b/clang/include/clang/AST/SYCLKernelInfo.h
index 4a4827e601053..3825af86c14e3 100644
--- a/clang/include/clang/AST/SYCLKernelInfo.h
+++ b/clang/include/clang/AST/SYCLKernelInfo.h
@@ -22,9 +22,10 @@ namespace clang {
 class SYCLKernelInfo {
 public:
   SYCLKernelInfo(CanQualType KernelNameType,
- const FunctionDecl *KernelEntryPointDecl)
+ const FunctionDecl *KernelEntryPointDecl,
+ const std::string &KernelName)
   : KernelNameType(KernelNameType),
-KernelEntryPointDecl(KernelEntryPointDecl) {}
+KernelEntryPointDecl(KernelEntryPointDecl), KernelName(KernelName) {}
 
   CanQualType getKernelNameType() const { return KernelNameType; }
 
@@ -32,9 +33,12 @@ class SYCLKernelInfo {
 return KernelEntryPointDecl;
   }
 
+  const std::string &GetKernelName() const { return KernelName; }
+
 private:
   CanQualType KernelNameType;
   const FunctionDecl *KernelEntryPointDecl;
+  std::string KernelName;
 };
 
 } // namespace clang

diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index bf24704e48eaa..860e6ec0fb47e 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -12825,6 +12825,15 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
 if (!FD->doesThisDeclarationHaveABody())
   return FD->doesDeclarationForceExternallyVisibleDefinition();
 
+// Function definitions with the sycl_kernel_entry_point attribute are
+// required during device compilation so that SYCL kernel caller offload
+// entry points are emitted.
+if (LangOpts.SYCLIsDevice && FD->hasAttr())
+  return true;
+
+// FIXME: Functions declared with SYCL_EXTERNAL are required during
+// device compilation.
+
 // Constructors and destructors are required.
 if (FD->hasAttr() || FD->hasAttr())
   return true;
@@ -14832,9 +14841,36 @@ void 
ASTContext::getFunctionFeatureMap(llvm::StringMap &FeatureMap,
   }
 }
 
-static SYCLKernelInfo BuildSYCLKernelInfo(CanQualType KernelNameType,
+static SYCLKernelInfo BuildSYCLKernelInfo(ASTContext &Context,
+  CanQualType KernelNameType,
   const FunctionDecl *FD) {
-  return {KernelNameType, FD};
+  // Host and device compilation may

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-18 Thread Erich Keane via cfe-commits


@@ -18,9 +18,12 @@
 using namespace clang;
 using namespace clang::CIRGen;
 
-CIRGenFunctionInfo *CIRGenFunctionInfo::create() {
-  // For now we just create an empty CIRGenFunctionInfo.
-  CIRGenFunctionInfo *fi = new CIRGenFunctionInfo();
+CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType) {
+  void *buffer = operator new(totalSizeToAlloc(1));

erichkeane wrote:

> > I realize there are a number of arguments that we don't know yet, but can 
> > we switch this to use ::create instead?
> 
> Sorry maybe I misunderstood but I'm a bit confused about what you're actually 
> supposing -- Are you suggesting that we should use ASTContext's allocator 
> instead of the `operator new` here?

Nope, sorry.  This was a mix of github making it REALLY hard to see the context 
of this conversation, and me misremembering it.  Disregard.  I think we're fine 
now with the proper destruction of these, so I'm going to resolve this 
conversation.

https://github.com/llvm/llvm-project/pull/135552
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [compiler-rt] [lld] [llvm] [Coverage][WebAssembly] Add initial support for WebAssembly/WASI (PR #111332)

2025-04-18 Thread Yuta Saito via cfe-commits

kateinoigakukun wrote:

@arsnyder16 The feature itself has already been in the main, and we are using 
the feature in Swift 
https://book.swiftwasm.org/getting-started/testing.html#code-coverage-with-swiftpm

I think we don't need extra change in `llvm-profdata` and `llvm-cov` for 
Emscripten support, but we need some changes for libcompiler_rt.profile.a to 
port it to Emscripten.

https://github.com/llvm/llvm-project/pull/111332
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][bytecode] Reject constexpr-unknown values in CheckStore (PR #136279)

2025-04-18 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/136279

None

>From 7cfafd2b9ee2bb357a6e2ff0f9cacde6f1c1725b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= 
Date: Fri, 18 Apr 2025 10:23:40 +0200
Subject: [PATCH] [clang][bytecode] Reject constexpr-unknown values in
 CheckStore

---
 clang/lib/AST/ByteCode/Interp.cpp | 2 ++
 clang/test/CodeGen/p0963r3.cpp| 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index 4625154ac353d..b755a072fec88 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -790,6 +790,8 @@ bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer 
&Ptr) {
 return false;
   if (!CheckConst(S, OpPC, Ptr))
 return false;
+  if (!S.inConstantContext() && isConstexprUnknown(Ptr))
+return false;
   return true;
 }
 
diff --git a/clang/test/CodeGen/p0963r3.cpp b/clang/test/CodeGen/p0963r3.cpp
index 4a5e6c3f5d751..65d33397e6173 100644
--- a/clang/test/CodeGen/p0963r3.cpp
+++ b/clang/test/CodeGen/p0963r3.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu 
%s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c++2c -verify -fsyntax-only 
-fexperimental-new-constant-interpreter -triple=x86_64-pc-linux-gnu %s
+// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu 
%s -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu 
%s -o - -fexperimental-new-constant-interpreter | FileCheck %s
 // expected-no-diagnostics
 
 namespace std {

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


[clang] [clang][bytecode] Reject constexpr-unknown values in CheckStore (PR #136279)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/136279.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Interp.cpp (+2) 
- (modified) clang/test/CodeGen/p0963r3.cpp (+2-2) 


``diff
diff --git a/clang/lib/AST/ByteCode/Interp.cpp 
b/clang/lib/AST/ByteCode/Interp.cpp
index 4625154ac353d..b755a072fec88 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -790,6 +790,8 @@ bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer 
&Ptr) {
 return false;
   if (!CheckConst(S, OpPC, Ptr))
 return false;
+  if (!S.inConstantContext() && isConstexprUnknown(Ptr))
+return false;
   return true;
 }
 
diff --git a/clang/test/CodeGen/p0963r3.cpp b/clang/test/CodeGen/p0963r3.cpp
index 4a5e6c3f5d751..65d33397e6173 100644
--- a/clang/test/CodeGen/p0963r3.cpp
+++ b/clang/test/CodeGen/p0963r3.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu 
%s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c++2c -verify -fsyntax-only 
-fexperimental-new-constant-interpreter -triple=x86_64-pc-linux-gnu %s
+// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu 
%s -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c++2c -verify -emit-llvm -triple=x86_64-pc-linux-gnu 
%s -o - -fexperimental-new-constant-interpreter | FileCheck %s
 // expected-no-diagnostics
 
 namespace std {

``




https://github.com/llvm/llvm-project/pull/136279
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Fix the trailing comma regression (PR #136273)

2025-04-18 Thread via cfe-commits

https://github.com/cor3ntin approved this pull request.

Thanks

https://github.com/llvm/llvm-project/pull/136273
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Constant-evaluate format strings as last resort (PR #135864)

2025-04-18 Thread via cfe-commits


@@ -5935,8 +5936,14 @@ static void CheckFormatString(
 llvm::SmallBitVector &CheckedVarArgs, UncoveredArgHandler &UncoveredArg,
 bool IgnoreStringsWithoutSpecifiers);
 
-static const Expr *maybeConstEvalStringLiteral(ASTContext &Context,
-   const Expr *E);
+enum StringLiteralConstEvalResult {

cor3ntin wrote:

```suggestion
enum StringLiteralConstantEvaluationResult {
```

https://github.com/llvm/llvm-project/pull/135864
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CUDA][HIP] Add a __device__ version of std::__glibcxx_assert_fail() (PR #136133)

2025-04-18 Thread Juan Manuel Martinez Caamaño via cfe-commits


@@ -0,0 +1,35 @@
+// libstdc++ uses the non-constexpr function std::__glibcxx_assert_fail()
+// to trigger compilation errors when the __glibcxx_assert(cond) macro
+// is used in a constexpr context.
+// Compilation fails when using code from the libstdc++ (such as std::array) on
+// device code, since these assertions invoke a non-constexpr host function 
from
+// device code.
+//
+// To work around this issue, we declare our own device version of the function
+
+#ifndef __CLANG_CUDA_WRAPPERS_BITS_CPP_CONFIG
+#define __CLANG_CUDA_WRAPPERS_BITS_CPP_CONFIG
+
+#include_next 
+
+#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_BEGIN_NAMESPACE_STD
+#else
+namespace std {
+#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#endif
+#endif
+__device__
+__attribute__((__always_inline__, __visibility__("default"))) inline void
+__glibcxx_assert_fail() {}

jmmartinez wrote:

> Presumably we _do_ want to fail here. We should at least call 
> __builtin_abort() or something.

This fails in fact. It's a "trick" to trigger a compilation failure on a 
constantly evaluated context: the code ends up calling a non-constexpr function 
from a constantly evaluated context when the assertion fails.

The new thing in this libstdc++ version is that even when assertions are 
disabled, on a constexpr context, we still have assert checks.

> Also, __glibcxx_assert_fail() appears to have variants with multiple 
> parameters, too:
> 
> https://github.com/gcc-mirror/gcc/blob/4cff0434e8bf6683988482a7e47f8459c06f2c05/libstdc%2B%2B-v3/src/c%2B%2B11/assert_fail.cc#L33
> 
> It looks like it's version-dependent, and we may need to provide both 
> variants, otherwise the issue will still be there for other libstdc++ 
> versions.

Thanks for pointing this out. I'll add the non-constexpr version too.

https://github.com/llvm/llvm-project/pull/136133
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] Improve error recovery for invalid calls (PR #136295)

2025-04-18 Thread Younan Zhang via cfe-commits

https://github.com/zyn0217 created 
https://github.com/llvm/llvm-project/pull/136295

It doesn't make sense that we only build a RecoveryExpr for expressions with 
invalid trailing commas. This patch extends it so that we now always build up a 
RecoveryExpr whenever the call contains anything invalid. As a result, we can 
back out HasTrailingComma.

There is only one diagnostic change as to concepts, where a RecoveryExpr than 
an ExprError is now used to model an invalud requires clause, for which we 
suggest adding parentheses around it. (This looks like what GCC diagnoses: 
https://gcc.godbolt.org/z/GT4TzbqTq)

>From 8efadc35d64f2724d5610a7ae66fa70a7c8e3d46 Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Fri, 18 Apr 2025 19:20:49 +0800
Subject: [PATCH] [Clang] Improve error recovery for invalid calls

It doesn't make sense that we only build a RecoveryExpr for expressions
with invalid trailing commas. This patch extends it so that we now
always build up a RecoveryExpr whenever the call contains anything
invalid. As a result, we can back out HasTrailingComma.

There is only one diagnostic change as to concepts, where a
RecoveryExpr than an ExprError is used to model an invalud requires
clause, for which we now suggest adding parenthesis around it.
---
 clang/docs/ReleaseNotes.rst   |  2 ++
 clang/include/clang/Parse/Parser.h|  3 +-
 clang/lib/Parse/ParseExpr.cpp | 31 +++
 clang/test/AST/ast-dump-recovery.cpp  | 11 ---
 clang/test/AST/new-unknown-type.cpp   |  8 -
 .../Parser/cxx-concepts-requires-clause.cpp   |  3 +-
 6 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f5cd1fbeabcfe..613b79ca2c3d8 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -395,6 +395,8 @@ Improvements to Clang's diagnostics
   constructors to initialize their non-modifiable members. The diagnostic is
   not new; being controlled via a warning group is what's new. Fixes #GH41104
 
+- Improved Clang's error recovery for invalid function calls.
+
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index 662f54d0e8d8a..40dbe23434d04 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1942,8 +1942,7 @@ class Parser : public CodeCompletionHandler {
llvm::function_ref ExpressionStarts =
llvm::function_ref(),
bool FailImmediatelyOnInvalidExpr = false,
-   bool EarlyTypoCorrection = false,
-   bool *HasTrailingComma = nullptr);
+   bool EarlyTypoCorrection = false);
 
   /// ParseSimpleExpressionList - A simple comma-separated list of expressions,
   /// used for misc language extensions.
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 3e3e7cbcd68b2..df015564849da 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -2218,19 +2218,13 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
 CalledSignatureHelp = true;
 return PreferredType;
   };
+  bool KnownInvalidCall = false;
   if (OpKind == tok::l_paren || !LHS.isInvalid()) {
 if (Tok.isNot(tok::r_paren)) {
-  bool HasTrailingComma = false;
-  bool HasError = ParseExpressionList(
-  ArgExprs,
-  [&] {
-PreferredType.enterFunctionArgument(Tok.getLocation(),
-RunSignatureHelp);
-  },
-  /*FailImmediatelyOnInvalidExpr*/ false,
-  /*EarlyTypoCorrection*/ false, &HasTrailingComma);
-
-  if (HasError && !HasTrailingComma) {
+  if ((KnownInvalidCall = ParseExpressionList(ArgExprs, [&] {
+ PreferredType.enterFunctionArgument(Tok.getLocation(),
+ RunSignatureHelp);
+   }))) {
 (void)Actions.CorrectDelayedTyposInExpr(LHS);
 // If we got an error when parsing expression list, we don't call
 // the CodeCompleteCall handler inside the parser. So call it here
@@ -2238,7 +2232,6 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
 // middle of a parameter.
 if (PP.isCodeCompletionReached() && !CalledSignatureHelp)
   RunSignatureHelp();
-LHS = ExprError();
   } else if (LHS.isInvalid()) {
 for (auto &E : ArgExprs)
   Actions.CorrectDelayedTyposInExpr(E);
@@ -2249,6 +2242,12 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
   // Match the ')'.
   if (LHS.isInvalid()) {
 SkipUntil(tok::r_paren, StopAtSemi);
+  } else if (KnownI

[clang] [Clang] Improve error recovery for invalid calls (PR #136295)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Younan Zhang (zyn0217)


Changes

It doesn't make sense that we only build a RecoveryExpr for expressions with 
invalid trailing commas. This patch extends it so that we now always build up a 
RecoveryExpr whenever the call contains anything invalid. As a result, we can 
back out HasTrailingComma.

There is only one diagnostic change as to concepts, where a RecoveryExpr than 
an ExprError is now used to model an invalud requires clause, for which we 
suggest adding parentheses around it. (This looks like what GCC diagnoses: 
https://gcc.godbolt.org/z/GT4TzbqTq)

---
Full diff: https://github.com/llvm/llvm-project/pull/136295.diff


6 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+2) 
- (modified) clang/include/clang/Parse/Parser.h (+1-2) 
- (modified) clang/lib/Parse/ParseExpr.cpp (+12-19) 
- (modified) clang/test/AST/ast-dump-recovery.cpp (+6-5) 
- (modified) clang/test/AST/new-unknown-type.cpp (+7-1) 
- (modified) clang/test/Parser/cxx-concepts-requires-clause.cpp (+2-1) 


``diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f5cd1fbeabcfe..613b79ca2c3d8 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -395,6 +395,8 @@ Improvements to Clang's diagnostics
   constructors to initialize their non-modifiable members. The diagnostic is
   not new; being controlled via a warning group is what's new. Fixes #GH41104
 
+- Improved Clang's error recovery for invalid function calls.
+
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index 662f54d0e8d8a..40dbe23434d04 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1942,8 +1942,7 @@ class Parser : public CodeCompletionHandler {
llvm::function_ref ExpressionStarts =
llvm::function_ref(),
bool FailImmediatelyOnInvalidExpr = false,
-   bool EarlyTypoCorrection = false,
-   bool *HasTrailingComma = nullptr);
+   bool EarlyTypoCorrection = false);
 
   /// ParseSimpleExpressionList - A simple comma-separated list of expressions,
   /// used for misc language extensions.
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 3e3e7cbcd68b2..df015564849da 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -2218,19 +2218,13 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
 CalledSignatureHelp = true;
 return PreferredType;
   };
+  bool KnownInvalidCall = false;
   if (OpKind == tok::l_paren || !LHS.isInvalid()) {
 if (Tok.isNot(tok::r_paren)) {
-  bool HasTrailingComma = false;
-  bool HasError = ParseExpressionList(
-  ArgExprs,
-  [&] {
-PreferredType.enterFunctionArgument(Tok.getLocation(),
-RunSignatureHelp);
-  },
-  /*FailImmediatelyOnInvalidExpr*/ false,
-  /*EarlyTypoCorrection*/ false, &HasTrailingComma);
-
-  if (HasError && !HasTrailingComma) {
+  if ((KnownInvalidCall = ParseExpressionList(ArgExprs, [&] {
+ PreferredType.enterFunctionArgument(Tok.getLocation(),
+ RunSignatureHelp);
+   }))) {
 (void)Actions.CorrectDelayedTyposInExpr(LHS);
 // If we got an error when parsing expression list, we don't call
 // the CodeCompleteCall handler inside the parser. So call it here
@@ -2238,7 +2232,6 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
 // middle of a parameter.
 if (PP.isCodeCompletionReached() && !CalledSignatureHelp)
   RunSignatureHelp();
-LHS = ExprError();
   } else if (LHS.isInvalid()) {
 for (auto &E : ArgExprs)
   Actions.CorrectDelayedTyposInExpr(E);
@@ -2249,6 +2242,12 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
   // Match the ')'.
   if (LHS.isInvalid()) {
 SkipUntil(tok::r_paren, StopAtSemi);
+  } else if (KnownInvalidCall) {
+Expr *Fn = LHS.get();
+ArgExprs.insert(ArgExprs.begin(), Fn);
+LHS = Actions.CreateRecoveryExpr(Fn->getBeginLoc(), Tok.getLocation(),
+ ArgExprs);
+SkipUntil(tok::r_paren, StopAtSemi);
   } else if (Tok.isNot(tok::r_paren)) {
 bool HadDelayedTypo = false;
 if (Actions.CorrectDelayedTyposInExpr(LHS).get() != LHS.get())
@@ -3700,8 +3699,7 @@ void Parser::injectEmbedTokens() {
 bool Parser::ParseExpressionList(SmallVectorImpl &Exprs,
  llvm::function_ref ExpressionStart

[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Younan Zhang via cfe-commits

zyn0217 wrote:

I was going to say we need a release note but you have merged it :)

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Fix nvptx range check (PR #136296)

2025-04-18 Thread Rahul Joshi via cfe-commits

https://github.com/jurahul closed 
https://github.com/llvm/llvm-project/pull/136296
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [include-cleaner] rename enabled flags to `disable-*` (PR #132991)

2025-04-18 Thread Aaron Ballman via cfe-commits

https://github.com/AaronBallman commented:

So I think the things that are missing are:

1) If `Insert` or `Remove` is true, we should diagnose those as being 
deprecated and recommend using `disable-insert` or `disable-remove` instead.
2) A release note should be added to clang-tools-extra/docs/ReleaseNotes.rst so 
users know about the change and new flags.
3) Test coverage in clang-tools-extra/include-cleaner/test to test that we get 
the deprecation warning only when expected (for both options) and that the new 
options behave the same as the old options.

https://github.com/llvm/llvm-project/pull/132991
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][GPU] Fix unit test for NVPTX tid.x intrinsic (PR #136297)

2025-04-18 Thread Rahul Joshi via cfe-commits

https://github.com/jurahul created 
https://github.com/llvm/llvm-project/pull/136297

- llvm.nvvm.read.ptx.sreg.tid.x does not have the result range attribute yet.

>From d2731a74ee04d2b11b521b76c0a87bb68f0ba03a Mon Sep 17 00:00:00 2001
From: Rahul Joshi 
Date: Fri, 18 Apr 2025 04:56:55 -0700
Subject: [PATCH] [Clang][GPU] Fix unit test for NVPTX tid.x intrinsic

- llvm.nvvm.read.ptx.sreg.tid.x does not have the result range
  attribute yet.
---
 clang/test/Headers/gpuintrin_lang.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/Headers/gpuintrin_lang.c 
b/clang/test/Headers/gpuintrin_lang.c
index ab660ac5c8a49..b804d46071507 100644
--- a/clang/test/Headers/gpuintrin_lang.c
+++ b/clang/test/Headers/gpuintrin_lang.c
@@ -36,7 +36,7 @@ __device__ int foo() { return __gpu_thread_id_x(); }
 // CUDA-LABEL: define dso_local i32 @foo(
 // CUDA-SAME: ) #[[ATTR0:[0-9]+]] {
 // CUDA-NEXT:  [[ENTRY:.*:]]
-// CUDA-NEXT:[[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
+// CUDA-NEXT:[[TMP0:%.*]] = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 // CUDA-NEXT:ret i32 [[TMP0]]
 //
 // HIP-LABEL: define dso_local i32 @foo(

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


[clang] [Clang][GPU] Fix unit test for NVPTX tid.x intrinsic (PR #136297)

2025-04-18 Thread Rahul Joshi via cfe-commits

https://github.com/jurahul closed 
https://github.com/llvm/llvm-project/pull/136297
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a99c978 - [Clang] Avoid dereferencing an invalid iterator

2025-04-18 Thread Corentin Jabot via cfe-commits

Author: Corentin Jabot
Date: 2025-04-18T10:03:06+02:00
New Revision: a99c978d1b35e30d9a0fe9db68b91e9f2815c8e9

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

LOG: [Clang] Avoid dereferencing an invalid iterator

Fix msan builds after 8c5a307bd8
https://lab.llvm.org/buildbot/#/builders/94/builds/6321

Added: 


Modified: 
clang/include/clang/Sema/Overload.h
clang/lib/Sema/SemaOverload.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Overload.h 
b/clang/include/clang/Sema/Overload.h
index 55d714c1222a1..8182ce9c39685 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -1350,6 +1350,9 @@ class Sema;
 iterator end() { return Candidates.end(); }
 
 size_t size() const { return Candidates.size() + DeferredCandidatesCount; }
+
+size_t nonDeferredCandidatesCount() const { return Candidates.size(); }
+
 bool empty() const {
   return Candidates.empty() && DeferredCandidatesCount == 0;
 }

diff  --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index b7a981e08ead9..e4ff8c5489df3 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -1108,7 +1108,7 @@ bool 
OverloadCandidateSet::OperatorRewriteInfo::shouldAddReversed(
 }
 
 void OverloadCandidateSet::destroyCandidates() {
-  for (iterator i = begin(), e = end(); i != e; ++i) {
+  for (iterator i = Candidates.begin(), e = Candidates.end(); i != e; ++i) {
 for (auto &C : i->Conversions)
   C.~ImplicitConversionSequence();
 if (!i->Viable && i->FailureKind == ovl_fail_bad_deduction)
@@ -11237,7 +11237,7 @@ void OverloadCandidateSet::PerfectViableFunction(
 Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best) {
 
   Best = end();
-  for (auto It = begin(); It != end(); ++It) {
+  for (auto It = Candidates.begin(); It != Candidates.end(); ++It) {
 
 if (!It->isPerfectMatch(S.getASTContext()))
   continue;
@@ -11277,7 +11277,8 @@ OverloadingResult 
OverloadCandidateSet::BestViableFunctionImpl(
 
   llvm::SmallVector Candidates;
   Candidates.reserve(this->Candidates.size());
-  std::transform(begin(), end(), std::back_inserter(Candidates),
+  std::transform(this->Candidates.begin(), this->Candidates.end(),
+ std::back_inserter(Candidates),
  [](OverloadCandidate &Cand) { return &Cand; });
 
   if (S.getLangOpts().CUDA)
@@ -13050,7 +13051,8 @@ SmallVector 
OverloadCandidateSet::CompleteCandidates(
   // be prohibitive, so we make a set of pointers and sort those.
   SmallVector Cands;
   if (OCD == OCD_AllCandidates) Cands.reserve(size());
-  for (iterator Cand = begin(), LastCand = end(); Cand != LastCand; ++Cand) {
+  for (iterator Cand = Candidates.begin(), LastCand = Candidates.end();
+   Cand != LastCand; ++Cand) {
 if (!Filter(*Cand))
   continue;
 switch (OCD) {
@@ -13127,7 +13129,8 @@ void OverloadCandidateSet::NoteCandidates(
 NoteCandidates(S, Args, Cands, Opc, OpLoc);
 
   if (OCD == OCD_AmbiguousCandidates)
-MaybeDiagnoseAmbiguousConstraints(S, {begin(), end()});
+MaybeDiagnoseAmbiguousConstraints(S,
+  {Candidates.begin(), Candidates.end()});
 }
 
 void OverloadCandidateSet::NoteCandidates(Sema &S, ArrayRef Args,
@@ -16255,7 +16258,8 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
   // we filter them out to produce better error diagnostics, ie to avoid
   // showing 2 failed overloads instead of one.
   bool IgnoreSurrogateFunctions = false;
-  if (CandidateSet.size() == 1 && Record->getAsCXXRecordDecl()->isLambda()) {
+  if (CandidateSet.nonDeferredCandidatesCount() == 1 &&
+  Record->getAsCXXRecordDecl()->isLambda()) {
 const OverloadCandidate &Candidate = *CandidateSet.begin();
 if (!Candidate.Viable &&
 Candidate.FailureKind == ovl_fail_constraints_not_satisfied)



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


[clang] [clang] Constant-evaluate format strings as last resort (PR #135864)

2025-04-18 Thread via cfe-commits


@@ -3,6 +3,11 @@
 // RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wformat-nonliteral -isystem 
%S/Inputs -triple=x86_64-unknown-fuchsia %s
 // RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wformat-nonliteral -isystem 
%S/Inputs -triple=x86_64-linux-android %s
 
+// expected-note@-5{{format string was constant-evaluated}}
+// ^^^ there will be a  SourceLocation caused by the

cor3ntin wrote:

Like @shafik and @tbaederr - I have a slight concern with performance.
In general, we should avoid checking format strings when these diagnostics are 
not enabled. That would at least lead to less work in system headers. 

Benchmarking sounds like a good idea.
But I don't have a better solution than using a scratch space. 

https://github.com/llvm/llvm-project/pull/135864
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][bytecode] Reject constexpr-unknown values in CheckStore (PR #136279)

2025-04-18 Thread Timm Baeder via cfe-commits

https://github.com/tbaederr closed 
https://github.com/llvm/llvm-project/pull/136279
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-aarch64-darwin` 
running on `doug-worker-5` while building `clang,llvm` at step 6 
"test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/190/builds/18560


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang -cc1 
-internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/build/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/Inputs/include
-internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 -o -  | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang -cc1 
-internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/build/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/Inputs/include
 -internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 -o -
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
1: ; ModuleID = 
'/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c'
 
2: source_filename = 
"/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c"
 
3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
4: target triple = "nvptx64" 
5:  
6: ; Function Attrs: convergent noinline 
nounwind optnone 
7: define dso_local i32 @foo() #0 
{ 
label:36'0 ^~
label:36'1 ^~
same:37'0^~
same:37'1   ^captured var 
"ATTR0"
8: entry: 
next:38'0  ^~
next:38'1  ^~  captured var "ENTRY"
next:39'0X error: no match found
9:  %0 = call i32 
@llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0  
next:39'1   ?   
possible intended match
   10:  ret i32 %0 
next:39'0  
   11: } 
next:39'0  ~~
   12:  
next:39'0  ~
   13: ; Function Attrs: nocallback 
nofree nosync nounwind speculatable willreturn memory(none) 
...

```



https://github.com/llvm/llvm-project/pull/136196

[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-x86_64-darwin` 
running on `doug-worker-3` while building `clang,llvm` at step 6 
"test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/23/builds/9504


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/clang -cc1 
-internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/Inputs/include
-internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 -o -  | /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/FileCheck 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/clang -cc1 
-internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/Inputs/include
 -internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 -o -
+ /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/FileCheck 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c'
 
   2: source_filename = 
"/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/clang/test/Headers/gpuintrin_lang.c"
 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 9bdd9dc - AMDGPU: Mark workitem ID intrinsics with range attribute (#136196)

2025-04-18 Thread via cfe-commits

Author: Matt Arsenault
Date: 2025-04-18T12:27:38+02:00
New Revision: 9bdd9dc895ade41ec24f1a9918f70b23271ac89b

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

LOG: AMDGPU: Mark workitem ID intrinsics with range attribute (#136196)

This avoids the need to have special handling at every use site.
Unfortunately this means we unnecessarily emit AssertZext in the DAG
(where we already directly understand the range of the intrinsic), andt
we regress in undefined cases as we don't fold out asserts on undef.

Added: 


Modified: 
clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp
clang/test/CodeGenOpenCL/builtins-amdgcn.cl
clang/test/CodeGenOpenCL/builtins-r600.cl
clang/test/Headers/gpuintrin.c
clang/test/Headers/gpuintrin_lang.c
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
llvm/test/CodeGen/AMDGPU/amdgpu-inline.ll
llvm/test/CodeGen/AMDGPU/ds-sub-offset.ll
llvm/test/CodeGen/AMDGPU/flat-scratch-svs.ll
llvm/test/CodeGen/AMDGPU/flat-scratch.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.iglp.opt.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.sched.group.barrier.gfx11.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.sched.group.barrier.gfx12.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.sched.group.barrier.iterative.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.sched.group.barrier.ll

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.workitem.id-unsupported-calling-convention.ll
llvm/test/CodeGen/AMDGPU/memory_clause.ll
llvm/test/CodeGen/AMDGPU/v_add_u64_pseudo_sdwa.ll
llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-for-private.ll

Removed: 




diff  --git a/clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp 
b/clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp
index 35c9f8ae48c80..ad012d98635ff 100644
--- a/clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp
@@ -171,16 +171,6 @@ static Value *emitFPIntBuiltin(CodeGenFunction &CGF,
   return CGF.Builder.CreateCall(F, {Src0, Src1});
 }
 
-static Value *emitRangedBuiltin(CodeGenFunction &CGF, unsigned IntrinsicID,
-int low, int high) {
-  Function *F = CGF.CGM.getIntrinsic(IntrinsicID, {});
-  llvm::CallInst *Call = CGF.Builder.CreateCall(F);
-  llvm::ConstantRange CR(APInt(32, low), APInt(32, high));
-  Call->addRangeRetAttr(CR);
-  Call->addRetAttr(llvm::Attribute::AttrKind::NoUndef);
-  return Call;
-}
-
 // For processing memory ordering and memory scope arguments of various
 // amdgcn builtins.
 // \p Order takes a C++11 comptabile memory-ordering specifier and converts
@@ -934,15 +924,6 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned 
BuiltinID,
 Function *F = CGM.getIntrinsic(BuiltinWMMAOp, ArgTypes);
 return Builder.CreateCall(F, Args);
   }
-
-  // amdgcn workitem
-  case AMDGPU::BI__builtin_amdgcn_workitem_id_x:
-return emitRangedBuiltin(*this, Intrinsic::amdgcn_workitem_id_x, 0, 1024);
-  case AMDGPU::BI__builtin_amdgcn_workitem_id_y:
-return emitRangedBuiltin(*this, Intrinsic::amdgcn_workitem_id_y, 0, 1024);
-  case AMDGPU::BI__builtin_amdgcn_workitem_id_z:
-return emitRangedBuiltin(*this, Intrinsic::amdgcn_workitem_id_z, 0, 1024);
-
   // amdgcn workgroup size
   case AMDGPU::BI__builtin_amdgcn_workgroup_size_x:
 return EmitAMDGPUWorkGroupSize(*this, 0);
@@ -964,12 +945,6 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned 
BuiltinID,
   case AMDGPU::BI__builtin_r600_recipsqrt_ieeef:
 return emitBuiltinWithOneOverloadedType<1>(*this, E,
Intrinsic::r600_recipsqrt_ieee);
-  case AMDGPU::BI__builtin_r600_read_tidig_x:
-return emitRangedBuiltin(*this, Intrinsic::r600_read_tidig_x, 0, 1024);
-  case AMDGPU::BI__builtin_r600_read_tidig_y:
-return emitRangedBuiltin(*this, Intrinsic::r600_read_tidig_y, 0, 1024);
-  case AMDGPU::BI__builtin_r600_read_tidig_z:
-return emitRangedBuiltin(*this, Intrinsic::r600_read_tidig_z, 0, 1024);
   case AMDGPU::BI__builtin_amdgcn_alignbit: {
 llvm::Value *Src0 = EmitScalarExpr(E->getArg(0));
 llvm::Value *Src1 = EmitScalarExpr(E->getArg(1));

diff  --git a/clang/test/CodeGenOpenCL/builtins-amdgcn.cl 
b/clang/test/CodeGenOpenCL/builtins-amdgcn.cl
index ded5f6b5ac4fd..bf022bc6eb446 100644
--- a/clang/test/CodeGenOpenCL/builtins-amdgcn.cl
+++ b/clang/test/CodeGenOpenCL/builtins-amdgcn.cl
@@ -605,9 +605,9 @@ void test_s_getreg(volatile global uint *out)
 }
 
 // CHECK-LABEL: @test_get_local_id(
-// CHECK: tail call noundef range(i32 0, 1024){{.*}} i32 
@llvm.amdgcn.workitem.id.x()
-// CHECK: tail call noundef range(i32 0, 1024){{.*}} i32 
@llvm.amdgcn.workitem.id.y()
-// CHECK: tail call noundef range(i32 0, 1024){{.*}} i32 
@llvm.amdgcn.workitem.id.z()
+// CHECK: tail call{{.*}} i32 @llvm.amdgcn.workitem.id.x()
+// CHECK: 

[clang] c609cd2 - Give this diagnostic a diagnostic group (#136182)

2025-04-18 Thread via cfe-commits

Author: Aaron Ballman
Date: 2025-04-18T07:09:27-04:00
New Revision: c609cd2df981d1fcbdfefa1e2601b965b9670630

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

LOG: Give this diagnostic a diagnostic group (#136182)

I put this under -Wunitialized because that's the same group it's under
in GCC.

Fixes #41104

Added: 
clang/test/SemaCXX/uninitialized-no-ctor.cpp

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/Misc/warning-flags.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 7b76a2caa694b..f5cd1fbeabcfe 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -391,6 +391,10 @@ Improvements to Clang's diagnostics
 
   Fixes #GH131127
 
+- ``-Wuninitialized`` now diagnoses when a class does not declare any
+  constructors to initialize their non-modifiable members. The diagnostic is
+  not new; being controlled via a warning group is what's new. Fixes #GH41104
+
 Improvements to Clang's time-trace
 --
 

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 6cbe8b60fe9bf..c29a3422acd26 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2266,7 +2266,8 @@ def err_constructor_byvalue_arg : Error<
   "copy constructor must pass its first argument by reference">;
 def warn_no_constructor_for_refconst : Warning<
   "%select{struct|interface|union|class|enum}0 %1 does not declare any "
-  "constructor to initialize its non-modifiable members">;
+  "constructor to initialize its non-modifiable members">,
+  InGroup;
 def note_refconst_member_not_initialized : Note<
   "%select{const|reference}0 member %1 will never be initialized">;
 def ext_ms_explicit_constructor_call : ExtWarn<

diff  --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index 7ac77cc91fdc1..3dc4bb55aa69c 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (57):
+CHECK: Warnings without flags (56):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
@@ -57,7 +57,6 @@ CHECK-NEXT:   warn_method_param_redefinition
 CHECK-NEXT:   warn_missing_case_for_condition
 CHECK-NEXT:   warn_missing_dependent_template_keyword
 CHECK-NEXT:   warn_missing_whitespace_after_macro_name
-CHECK-NEXT:   warn_no_constructor_for_refconst
 CHECK-NEXT:   warn_not_compound_assign
 CHECK-NEXT:   warn_objc_property_copy_missing_on_block
 CHECK-NEXT:   warn_objc_protocol_qualifier_missing_id

diff  --git a/clang/test/SemaCXX/uninitialized-no-ctor.cpp 
b/clang/test/SemaCXX/uninitialized-no-ctor.cpp
new file mode 100644
index 0..7a08f2f3dc37e
--- /dev/null
+++ b/clang/test/SemaCXX/uninitialized-no-ctor.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-uninitialized  -verify=good %s
+//good-no-diagnostics
+
+template 
+class RefMem { // expected-warning {{class 'RefMem' does not declare 
any constructor to initialize its non-modifiable members}}
+  T &M; // expected-note {{reference member 'M' will never be initialized}}
+};
+
+struct RefRef {
+  RefMem R; // expected-note {{in instantiation of template class 
'RefMem' requested here}}
+};
+



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


[clang] Give this diagnostic a diagnostic group (PR #136182)

2025-04-18 Thread Aaron Ballman via cfe-commits

https://github.com/AaronBallman closed 
https://github.com/llvm/llvm-project/pull/136182
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] enhance loop analysis to handle variable changes inside lambdas (PR #135573)

2025-04-18 Thread Younan Zhang via cfe-commits


@@ -299,3 +299,38 @@ void test10() {
   for (auto[i, j, k] = arr; i < a; ++i) { }
   for (auto[i, j, k] = arr; i < a; ++arr[0]) { }
 };
+
+namespace GH132038 {
+extern void foo(int);
+void test1() {
+  int a = 0;
+  auto incr_a = [&a]() { ++a; };
+
+  for (int b = 10; a <= b; incr_a())
+foo(a);
+
+  for (int b = 10; a <= b;)
+incr_a();
+
+  for (int b = 10; a <= b; [&a]() { ++a; }()) { }
+  for (int b = 10; a <= b; [&a]() { }()) { }

zyn0217 wrote:

Or if that is something we can't handle at the moment, can you please add a 
FIXME?

https://github.com/llvm/llvm-project/pull/135573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] enhance loop analysis to handle variable changes inside lambdas (PR #135573)

2025-04-18 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/135573

>From 93c8fc7faba6ab9537039b8745e62f5d79785cd0 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk 
Date: Thu, 17 Apr 2025 23:58:35 +0300
Subject: [PATCH] [Clang] enhance loop analysis to handle variable changes
 inside lambdas

---
 clang/docs/ReleaseNotes.rst   |  2 ++
 clang/lib/Sema/SemaStmt.cpp   | 19 ++--
 clang/test/SemaCXX/warn-loop-analysis.cpp | 35 +++
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c75d83a6d1a7a..8a330c010a73d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -385,6 +385,8 @@ Improvements to Clang's diagnostics
 
   Fixes #GH131127
 
+- The ``-Wloop-analysis`` warning now handles variable modifications inside 
lambda expressions (#GH132038).
+
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 39c2e157591df..2bb46dd94cca2 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2002,9 +2002,24 @@ namespace {
 }
 
 void VisitDeclRefExpr(DeclRefExpr *E) {
-  if (VarDecl *VD = dyn_cast(E->getDecl()))
+  if (VarDecl *VD = dyn_cast(E->getDecl())) {
 if (Decls.count(VD))
   FoundDecl = true;
+  } else if (CXXMethodDecl *MD = dyn_cast(E->getDecl());
+ MD && isLambdaCallOperator(MD)) {
+for (const auto &Capture : MD->getParent()->captures()) {
+  if (!Capture.capturesVariable())
+continue;
+
+  LambdaCaptureKind CK = Capture.getCaptureKind();
+  if (CK != LCK_ByRef)
+continue;
+
+  VarDecl *VD = dyn_cast(Capture.getCapturedVar());
+  if (VD && Decls.count(VD))
+FoundDecl = true;
+}
+  }
 }
 
 void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
@@ -2021,7 +2036,7 @@ namespace {
 
 bool FoundDeclInUse() { return FoundDecl; }
 
-  };  // end class DeclMatcher
+  }; // end class DeclMatcher
 
   void CheckForLoopConditionalStatement(Sema &S, Expr *Second,
 Expr *Third, Stmt *Body) {
diff --git a/clang/test/SemaCXX/warn-loop-analysis.cpp 
b/clang/test/SemaCXX/warn-loop-analysis.cpp
index 324dd386292ac..ec2894a46ee77 100644
--- a/clang/test/SemaCXX/warn-loop-analysis.cpp
+++ b/clang/test/SemaCXX/warn-loop-analysis.cpp
@@ -299,3 +299,38 @@ void test10() {
   for (auto[i, j, k] = arr; i < a; ++i) { }
   for (auto[i, j, k] = arr; i < a; ++arr[0]) { }
 };
+
+namespace GH132038 {
+extern void foo(int);
+void test1() {
+  int a = 0;
+  auto incr_a = [&a]() { ++a; };
+
+  for (int b = 10; a <= b; incr_a())
+foo(a);
+
+  for (int b = 10; a <= b;)
+incr_a();
+
+  for (int b = 10; a <= b; [&a]() { ++a; }()) { }
+  for (int b = 10; a <= b; [&a]() { }()) { }
+}
+
+void test2() {
+  int a = 0;
+  auto incr_a = [a]() {  };
+  auto incr_b = [](int b) { };
+
+  for (int b = 10; a <= b; incr_a()) // expected-warning {{variables 'a' and 
'b' used in loop condition not modified in loop body}}
+foo(a);
+
+  for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used 
in loop condition not modified in loop body}}
+incr_a();
+
+  for (int b = 10; a <= b; incr_b(b)) // expected-warning {{variables 'a' and 
'b' used in loop condition not modified in loop body}}
+foo(a);
+
+  for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used 
in loop condition not modified in loop body}}
+incr_b(b);
+}
+}

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


[clang] [Clang] Improve error recovery for invalid calls (PR #136295)

2025-04-18 Thread Erich Keane via cfe-commits

https://github.com/erichkeane approved this pull request.


https://github.com/llvm/llvm-project/pull/136295
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Generate empty .clang-format-ignore before running tests (PR #136154)

2025-04-18 Thread Devon Loehr via cfe-commits

https://github.com/DKLoehr updated 
https://github.com/llvm/llvm-project/pull/136154

>From 804fcdd84e8551005bfa5dae58d24f9852608360 Mon Sep 17 00:00:00 2001
From: Devon Loehr 
Date: Thu, 17 Apr 2025 16:10:55 +
Subject: [PATCH 1/2] Generate empty .clang-format-ignore before running tests

---
 clang/test/Format/lit.local.cfg | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index b060c79226cbd..cf79e8df89a33 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -1,3 +1,4 @@
+import os
 import platform
 import lit.formats
 
@@ -27,3 +28,8 @@ config.suffixes = [
 # python implementation does, so use that for cross platform compatibility
 if platform.system() == "AIX":
 config.test_format = lit.formats.ShTest()
+
+# Create an empty .clang-format-ignore file so that tests don't get messed
+# up if one exists higher in the tree
+with open(os.path.join("Format", ".clang-format-ignore"), 'w'):
+pass
\ No newline at end of file

>From 94d80cbb3b63c14f047fe253c5adf2ce26e4f554 Mon Sep 17 00:00:00 2001
From: Devon Loehr 
Date: Thu, 17 Apr 2025 13:27:27 -0400
Subject: [PATCH 2/2] Just create file in cwd

Should be more robust to whether the Format folder already exists or not.
---
 clang/test/Format/lit.local.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index cf79e8df89a33..20e217664997b 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -31,5 +31,5 @@ if platform.system() == "AIX":
 
 # Create an empty .clang-format-ignore file so that tests don't get messed
 # up if one exists higher in the tree
-with open(os.path.join("Format", ".clang-format-ignore"), 'w'):
-pass
\ No newline at end of file
+with open(".clang-format-ignore", 'w'):
+pass

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


[clang-tools-extra] [clang-tidy] detect arithmetic operations within member list initialization in modernize-use-default-member-init check (PR #129370)

2025-04-18 Thread David Rivera via cfe-commits

RiverDave wrote:

Ping @5chmidti @PiotrZSL @carlosgalvezp

https://github.com/llvm/llvm-project/pull/129370
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format] Fix a crash in EnumTrailingComma (PR #135903)

2025-04-18 Thread Björn Schäpers via cfe-commits

https://github.com/HazardyKnusperkeks approved this pull request.


https://github.com/llvm/llvm-project/pull/135903
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 257b727 - [clang][Sema][SYCL] Fix MSVC STL usage on AMDGPU (#135979)

2025-04-18 Thread via cfe-commits

Author: Nick Sarnie
Date: 2025-04-18T15:28:46Z
New Revision: 257b72758424f56103d38e3d016cfb6baa4da613

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

LOG: [clang][Sema][SYCL] Fix MSVC STL usage on AMDGPU (#135979)

The MSVC STL includes specializations of `_Is_memfunptr` for every
function pointer type, including every calling convention.

The problem is the AMDGPU target doesn't support the x86 `vectorcall`
calling convention so clang sets it to the default CC. This ends up
clashing with the already-existing overload for the default CC, so we
get a duplicate definition error when including `type_traits` (which we
heavily use in the SYCL STL) and compiling for AMDGPU on Windows.

This doesn't happen for pure AMDGPU non-SYCL because it doesn't include
the C++ STL, and it doesn't happen for CUDA/HIP because a similar
workaround was done
[here](https://github.com/llvm/llvm-project/commit/fa49c3a888e816969b5ed68cd5c47efc3eb9419f).

I am not an expert in Sema, so I did a kinda of hardcoded fix, please
let me know if there is a better way to fix this.

As far as I can tell we can't do exactly the same fix that was done for
CUDA because we can't differentiate between device and host code so
easily.

-

Signed-off-by: Sarnie, Nick 

Added: 
clang/test/SemaSYCL/Inputs/vectorcall.hpp
clang/test/SemaSYCL/sycl-cconv-win.cpp

Modified: 
clang/lib/Sema/SemaDeclAttr.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 7dd20a8795fc9..cb230774d56fc 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -5495,12 +5495,12 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr 
&Attrs, CallingConv &CC,
 
   TargetInfo::CallingConvCheckResult A = TargetInfo::CCCR_OK;
   const TargetInfo &TI = Context.getTargetInfo();
+  auto *Aux = Context.getAuxTargetInfo();
   // CUDA functions may have host and/or device attributes which indicate
   // their targeted execution environment, therefore the calling convention
   // of functions in CUDA should be checked against the target deduced based
   // on their host/device attributes.
   if (LangOpts.CUDA) {
-auto *Aux = Context.getAuxTargetInfo();
 assert(FD || CFT != CUDAFunctionTarget::InvalidTarget);
 auto CudaTarget = FD ? CUDA().IdentifyTarget(FD) : CFT;
 bool CheckHost = false, CheckDevice = false;
@@ -5525,6 +5525,15 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, 
CallingConv &CC,
   A = HostTI->checkCallingConvention(CC);
 if (A == TargetInfo::CCCR_OK && CheckDevice && DeviceTI)
   A = DeviceTI->checkCallingConvention(CC);
+  } else if (LangOpts.SYCLIsDevice && TI.getTriple().isAMDGPU() &&
+ CC == CC_X86VectorCall) {
+// Assuming SYCL Device AMDGPU CC_X86VectorCall functions are always to be
+// emitted on the host. The MSVC STL has CC-based specializations so we
+// cannot change the CC to be the default as that will cause a clash with
+// another specialization.
+A = TI.checkCallingConvention(CC);
+if (Aux && A != TargetInfo::CCCR_OK)
+  A = Aux->checkCallingConvention(CC);
   } else {
 A = TI.checkCallingConvention(CC);
   }

diff  --git a/clang/test/SemaSYCL/Inputs/vectorcall.hpp 
b/clang/test/SemaSYCL/Inputs/vectorcall.hpp
new file mode 100644
index 0..566a48dd24c30
--- /dev/null
+++ b/clang/test/SemaSYCL/Inputs/vectorcall.hpp
@@ -0,0 +1,18 @@
+
+template  struct A{};
+
+template  struct A { static constexpr int value = 0; };
+template  struct A { static constexpr int value = 1; };
+
+template  constexpr int A_v = A::value;
+
+struct B
+{
+void f() noexcept {}
+void __vectorcall g() noexcept {}
+};
+
+int main()
+{
+return A_v + A_v;
+}

diff  --git a/clang/test/SemaSYCL/sycl-cconv-win.cpp 
b/clang/test/SemaSYCL/sycl-cconv-win.cpp
new file mode 100644
index 0..f0c22a2ed3921
--- /dev/null
+++ b/clang/test/SemaSYCL/sycl-cconv-win.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -isystem %S/Inputs/ -fsycl-is-device -triple amdgcn-amd-hsa 
-aux-triple x86_64-pc-windows-msvc -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+
+#include 



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


[clang] Generate empty .clang-format-ignore before running tests (PR #136154)

2025-04-18 Thread Devon Loehr via cfe-commits

https://github.com/DKLoehr updated 
https://github.com/llvm/llvm-project/pull/136154

>From 804fcdd84e8551005bfa5dae58d24f9852608360 Mon Sep 17 00:00:00 2001
From: Devon Loehr 
Date: Thu, 17 Apr 2025 16:10:55 +
Subject: [PATCH 1/2] Generate empty .clang-format-ignore before running tests

---
 clang/test/Format/lit.local.cfg | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index b060c79226cbd..cf79e8df89a33 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -1,3 +1,4 @@
+import os
 import platform
 import lit.formats
 
@@ -27,3 +28,8 @@ config.suffixes = [
 # python implementation does, so use that for cross platform compatibility
 if platform.system() == "AIX":
 config.test_format = lit.formats.ShTest()
+
+# Create an empty .clang-format-ignore file so that tests don't get messed
+# up if one exists higher in the tree
+with open(os.path.join("Format", ".clang-format-ignore"), 'w'):
+pass
\ No newline at end of file

>From 94d80cbb3b63c14f047fe253c5adf2ce26e4f554 Mon Sep 17 00:00:00 2001
From: Devon Loehr 
Date: Thu, 17 Apr 2025 13:27:27 -0400
Subject: [PATCH 2/2] Just create file in cwd

Should be more robust to whether the Format folder already exists or not.
---
 clang/test/Format/lit.local.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index cf79e8df89a33..20e217664997b 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -31,5 +31,5 @@ if platform.system() == "AIX":
 
 # Create an empty .clang-format-ignore file so that tests don't get messed
 # up if one exists higher in the tree
-with open(os.path.join("Format", ".clang-format-ignore"), 'w'):
-pass
\ No newline at end of file
+with open(".clang-format-ignore", 'w'):
+pass

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


[clang] [Clang] enhance loop analysis to handle variable changes inside lambdas (PR #135573)

2025-04-18 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/135573

>From 93c8fc7faba6ab9537039b8745e62f5d79785cd0 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk 
Date: Thu, 17 Apr 2025 23:58:35 +0300
Subject: [PATCH 1/2] [Clang] enhance loop analysis to handle variable changes
 inside lambdas

---
 clang/docs/ReleaseNotes.rst   |  2 ++
 clang/lib/Sema/SemaStmt.cpp   | 19 ++--
 clang/test/SemaCXX/warn-loop-analysis.cpp | 35 +++
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c75d83a6d1a7a..8a330c010a73d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -385,6 +385,8 @@ Improvements to Clang's diagnostics
 
   Fixes #GH131127
 
+- The ``-Wloop-analysis`` warning now handles variable modifications inside 
lambda expressions (#GH132038).
+
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 39c2e157591df..2bb46dd94cca2 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2002,9 +2002,24 @@ namespace {
 }
 
 void VisitDeclRefExpr(DeclRefExpr *E) {
-  if (VarDecl *VD = dyn_cast(E->getDecl()))
+  if (VarDecl *VD = dyn_cast(E->getDecl())) {
 if (Decls.count(VD))
   FoundDecl = true;
+  } else if (CXXMethodDecl *MD = dyn_cast(E->getDecl());
+ MD && isLambdaCallOperator(MD)) {
+for (const auto &Capture : MD->getParent()->captures()) {
+  if (!Capture.capturesVariable())
+continue;
+
+  LambdaCaptureKind CK = Capture.getCaptureKind();
+  if (CK != LCK_ByRef)
+continue;
+
+  VarDecl *VD = dyn_cast(Capture.getCapturedVar());
+  if (VD && Decls.count(VD))
+FoundDecl = true;
+}
+  }
 }
 
 void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
@@ -2021,7 +2036,7 @@ namespace {
 
 bool FoundDeclInUse() { return FoundDecl; }
 
-  };  // end class DeclMatcher
+  }; // end class DeclMatcher
 
   void CheckForLoopConditionalStatement(Sema &S, Expr *Second,
 Expr *Third, Stmt *Body) {
diff --git a/clang/test/SemaCXX/warn-loop-analysis.cpp 
b/clang/test/SemaCXX/warn-loop-analysis.cpp
index 324dd386292ac..ec2894a46ee77 100644
--- a/clang/test/SemaCXX/warn-loop-analysis.cpp
+++ b/clang/test/SemaCXX/warn-loop-analysis.cpp
@@ -299,3 +299,38 @@ void test10() {
   for (auto[i, j, k] = arr; i < a; ++i) { }
   for (auto[i, j, k] = arr; i < a; ++arr[0]) { }
 };
+
+namespace GH132038 {
+extern void foo(int);
+void test1() {
+  int a = 0;
+  auto incr_a = [&a]() { ++a; };
+
+  for (int b = 10; a <= b; incr_a())
+foo(a);
+
+  for (int b = 10; a <= b;)
+incr_a();
+
+  for (int b = 10; a <= b; [&a]() { ++a; }()) { }
+  for (int b = 10; a <= b; [&a]() { }()) { }
+}
+
+void test2() {
+  int a = 0;
+  auto incr_a = [a]() {  };
+  auto incr_b = [](int b) { };
+
+  for (int b = 10; a <= b; incr_a()) // expected-warning {{variables 'a' and 
'b' used in loop condition not modified in loop body}}
+foo(a);
+
+  for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used 
in loop condition not modified in loop body}}
+incr_a();
+
+  for (int b = 10; a <= b; incr_b(b)) // expected-warning {{variables 'a' and 
'b' used in loop condition not modified in loop body}}
+foo(a);
+
+  for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used 
in loop condition not modified in loop body}}
+incr_b(b);
+}
+}

>From 00053790db55d3f26836e958f8624c0f4bf4fbb8 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk 
Date: Fri, 18 Apr 2025 18:28:16 +0300
Subject: [PATCH 2/2] add FIXME test case

---
 clang/test/SemaCXX/warn-loop-analysis.cpp | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/clang/test/SemaCXX/warn-loop-analysis.cpp 
b/clang/test/SemaCXX/warn-loop-analysis.cpp
index ec2894a46ee77..7773bef0cd238 100644
--- a/clang/test/SemaCXX/warn-loop-analysis.cpp
+++ b/clang/test/SemaCXX/warn-loop-analysis.cpp
@@ -318,8 +318,11 @@ void test1() {
 
 void test2() {
   int a = 0;
+  int *c = &a;
+
   auto incr_a = [a]() {  };
   auto incr_b = [](int b) { };
+  auto incr_c = [c]() { ++*c; };
 
   for (int b = 10; a <= b; incr_a()) // expected-warning {{variables 'a' and 
'b' used in loop condition not modified in loop body}}
 foo(a);
@@ -332,5 +335,9 @@ void test2() {
 
   for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used 
in loop condition not modified in loop body}}
 incr_b(b);
+
+  // FIXME: handle modification of loop control variable inside lambda body
+  for (a = 10; a <= 20; incr_c()) // expected-warning {{variable 'a' used in 
loop condition not modified in loop body}}
+foo(a);
 }
 }

___
cfe-commits mailing list
cfe-commits@lis

[clang] [clang][Sema][SYCL] Fix MSVC STL usage on AMDGPU (PR #135979)

2025-04-18 Thread Nick Sarnie via cfe-commits

https://github.com/sarnex closed 
https://github.com/llvm/llvm-project/pull/135979
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Jan Patrick Lehr via cfe-commits

jplehr wrote:

I think this broke one of our bots: 
https://lab.llvm.org/buildbot/#/builders/10/builds/3726/steps/10/logs/stdio

The bot was red for another issue at the time, but the stack trace includes 
methods that are touched in this PR.
This is part of the stack trace:
```
#12 0x748dc31b00cb 
clang::LinkageComputer::computeTypeLinkageInfo(clang::Type const*) 
(/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/../lib/../lib/libclangAST.so.21.0git+0xbb00cb)
#13 0x748dc31b0b9b 
clang::LinkageComputer::getTypeLinkageAndVisibility(clang::Type const*) 
(/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/../lib/../lib/libclangAST.so.21.0git+0xbb0b9b)
#14 0x748dc2af0258 
clang::LinkageComputer::getLVForTemplateArgumentList(llvm::ArrayRef,
 clang::LVComputationKind) 
(/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/../lib/../lib/libclangAST.so.21.0git+0x4f0258)
#15 0x748dc2af05d1 
clang::LinkageComputer::mergeTemplateLV(clang::LinkageInfo&, 
clang::ClassTemplateSpecializationDecl const*, clang::LVComputationKind) 
(/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/../lib/../lib/libclangAST.so.21.0git+0x4f05d1)
#16 0x748dc2af120c 
clang::LinkageComputer::getLVForNamespaceScopeDecl(clang::NamedDecl const*, 
clang::LVComputationKind, bool) 
(/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/../lib/../lib/libclangAST.so.21.0git+0x4f120c)
#17 0x748dc2aeee05 clang::LinkageComputer::getLVForDecl(clang::NamedDecl 
const*, clang::LVComputationKind) 
(/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/../lib/../lib/libclangAST.so.21.0git+0x4eee05)
```

I'd appreciate if someone more familiar with the matter can have a look at it. 
I'm happy to assist with info on build config etc.

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Devon Loehr via cfe-commits

DKLoehr wrote:

This is breaking builds when compiling chromium as well, bisected to this 
change. Example build: 
https://ci.chromium.org/ui/p/chromium/builders/ci/ToTLinux%20(dbg)/31974/overview.
 Compiler output can be seen by clicking `[raw]` under the `compile` step, but 
I'm working on a minimized reproduction now.

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [clang][uefi] add arm, aarch64, x86, loongarch64, riscv64 targets (PR #136247)

2025-04-18 Thread Tristan Ross via cfe-commits

https://github.com/RossComputerGuy updated 
https://github.com/llvm/llvm-project/pull/136247

>From fe082622b38f5b4e00a5be7076523ad2adb104a4 Mon Sep 17 00:00:00 2001
From: Tristan Ross 
Date: Thu, 17 Apr 2025 20:06:51 -0700
Subject: [PATCH 1/3] [clang][uefi] add arm, aarch64, x86, loongarch64, riscv64
 targets

---
 clang/include/clang/Basic/TargetOSMacros.def |  3 +++
 clang/lib/Basic/Targets.cpp  | 14 ++
 clang/test/Preprocessor/init.c   |  5 +
 3 files changed, 22 insertions(+)

diff --git a/clang/include/clang/Basic/TargetOSMacros.def 
b/clang/include/clang/Basic/TargetOSMacros.def
index 58dce330f9c8f..f4f3276ad1c25 100644
--- a/clang/include/clang/Basic/TargetOSMacros.def
+++ b/clang/include/clang/Basic/TargetOSMacros.def
@@ -53,4 +53,7 @@ TARGET_OS(TARGET_OS_NANO, Triple.isWatchOS())
 TARGET_OS(TARGET_IPHONE_SIMULATOR, Triple.isSimulatorEnvironment())
 TARGET_OS(TARGET_OS_UIKITFORMAC, Triple.isMacCatalystEnvironment())
 
+// UEFI target.
+TARGET_OS(TARGET_OS_UEFI, Triple.isUEFI())
+
 #undef TARGET_OS
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index c6d228fe98100..0502d99a20e4f 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -164,6 +164,11 @@ std::unique_ptr AllocateTarget(const 
llvm::Triple &Triple,
 return std::make_unique>(Triple,
  Opts);
   }
+
+case llvm::Triple::UEFI:
+  return std::make_unique>(Triple,
+   Opts);
+
 case llvm::Triple::NetBSD:
   return std::make_unique>(Triple,
  Opts);
@@ -227,6 +232,8 @@ std::unique_ptr AllocateTarget(const 
llvm::Triple &Triple,
   return std::make_unique>(Triple, Opts);
 case llvm::Triple::NaCl:
   return std::make_unique>(Triple, Opts);
+case llvm::Triple::UEFI:
+  return std::make_unique>(Triple, Opts);
 case llvm::Triple::Win32:
   switch (Triple.getEnvironment()) {
   case llvm::Triple::Cygnus:
@@ -457,6 +464,8 @@ std::unique_ptr AllocateTarget(const 
llvm::Triple &Triple,
 case llvm::Triple::Haiku:
   return std::make_unique>(Triple,
   Opts);
+case llvm::Triple::UEFI:
+  return std::make_unique>(Triple, Opts);
 case llvm::Triple::Linux:
   switch (Triple.getEnvironment()) {
   default:
@@ -569,6 +578,8 @@ std::unique_ptr AllocateTarget(const 
llvm::Triple &Triple,
 case llvm::Triple::Solaris:
   return std::make_unique>(Triple,
Opts);
+case llvm::Triple::UEFI:
+  return std::make_unique>(Triple, Opts);
 case llvm::Triple::Win32: {
   switch (Triple.getEnvironment()) {
   case llvm::Triple::Cygnus:
@@ -760,6 +771,9 @@ std::unique_ptr AllocateTarget(const 
llvm::Triple &Triple,
 case llvm::Triple::FreeBSD:
   return std::make_unique>(Triple,
 Opts);
+case llvm::Triple::UEFI:
+  return std::make_unique>(Triple,
+ Opts);
 default:
   return std::make_unique(Triple, Opts);
 }
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 1ac325d444662..55a7340deba24 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -2835,6 +2835,11 @@
 // RISCV64-LINUX: #define unix 1
 
 // RUN: %clang_cc1 -dM -triple=x86_64-uefi -E /dev/null | FileCheck 
-match-full-lines -check-prefix UEFI %s
+// RUN: %clang_cc1 -dM -triple=armv7l-unknown-uefi -E < /dev/null | FileCheck 
-match-full-lines -check-prefix UEFI %s
+// RUN: %clang_cc1 -dM -triple=aarch64-unknown-uefi -E < /dev/null | FileCheck 
-match-full-lines -check-prefix UEFI %s
+// RUN: %clang_cc1 -dM -triple=loongarch64-unknown-uefi -E < /dev/null | 
FileCheck -match-full-lines -check-prefix UEFI %s
+// RUN: %clang_cc1 -dM -triple=riscv64-unknown-uefi -E < /dev/null | FileCheck 
-match-full-lines -check-prefix UEFI %s
+// RUN: %clang_cc1 -dM -triple=x86_64-unknown-uefi -E /dev/null | FileCheck 
-match-full-lines -check-prefix UEFI %s
 
 // UEFI: #define __UEFI__ 1
 

>From b601bb7fbaa3e8d93970f913afdaf7e60e7b6ef8 Mon Sep 17 00:00:00 2001
From: Tristan Ross 
Date: Thu, 17 Apr 2025 20:46:01 -0700
Subject: [PATCH 2/3] [clang] remove x86_64-unknown-uefi block

---
 clang/lib/Driver/Driver.cpp | 4 
 1 file changed, 4 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 90d8e823d1d02..55abe691ea8e2 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -699,10 +699,6 @@ static llvm::Triple computeTargetTriple(const Driver &D,
 }
   }
 
-  // Currently the only architecture supported by *-uefi trip

[clang] [clang-format] Fix a bug in annotating TT_PointerOrReference (PR #136073)

2025-04-18 Thread Björn Schäpers via cfe-commits

https://github.com/HazardyKnusperkeks approved this pull request.


https://github.com/llvm/llvm-project/pull/136073
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] enhance loop analysis to handle variable changes inside lambdas (PR #135573)

2025-04-18 Thread Oleksandr T. via cfe-commits


@@ -299,3 +299,38 @@ void test10() {
   for (auto[i, j, k] = arr; i < a; ++i) { }
   for (auto[i, j, k] = arr; i < a; ++arr[0]) { }
 };
+
+namespace GH132038 {
+extern void foo(int);
+void test1() {
+  int a = 0;
+  auto incr_a = [&a]() { ++a; };
+
+  for (int b = 10; a <= b; incr_a())
+foo(a);
+
+  for (int b = 10; a <= b;)
+incr_a();
+
+  for (int b = 10; a <= b; [&a]() { ++a; }()) { }
+  for (int b = 10; a <= b; [&a]() { }()) { }

a-tarasyuk wrote:

@zyn0217 I've added a test case with a FIXME. The original test already briefly 
mentions cases involving dereferencing...

https://github.com/llvm/llvm-project/blob/db0f754c5af8e6c96770533520bf8b17fc0dc977/clang/test/SemaCXX/warn-loop-analysis.cpp#L40-L41
 

> rewritten using dataflow analysis

I suppose it’s better to rely on dataflow analysis when handling more complex 
cases...

https://github.com/llvm/llvm-project/pull/135573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [OpenACC] Switch Clang to use the Flang 'appertainment' rules for cla… (PR #135372)

2025-04-18 Thread Erich Keane via cfe-commits

https://github.com/erichkeane edited 
https://github.com/llvm/llvm-project/pull/135372
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [OpenACC] Switch Clang to use the Flang 'appertainment' rules for cla… (PR #135372)

2025-04-18 Thread Erich Keane via cfe-commits

erichkeane wrote:

> > > Updated list:
> > > ```
> > > Disagreements on 'num_gangs' appearing >1x on kernels/kernels-loop 
> > > (justification for kernels-loop should apply to kernels as well?) (UNK 
> > > way forward right now)
> > > Clang :: SemaOpenACC/compute-construct-num_gangs-clause.c
> > >   
> > > FLANG: prohibits device_num >1x  (UNK way forward RN).
> > >   Clang :: SemaOpenACC/init-construct.cpp
> > >   Clang :: SemaOpenACC/shutdown-construct.cpp
> > >   
> > > Disagreement on 'bind' on a 'routine'. (UNK way forward right now)
> > >Clang :: SemaOpenACC/routine-construct-clauses.cpp
> > > ```
> > 
> > 
> > In discussion, we decided that `bind` probably should follow the same rules 
> > as "Implemented proposed change for 'routine' gang/worker/vector/seq. (see 
> > issue 539)". So I'll follow-up on that after this.
> 
> We discussed/solved 'bind', so:
> 
> ```
>  Disagreements on 'num_gangs' appearing >1x on kernels/kernels-loop 
> (justification for kernels-loop should apply to kernels as well?) (UNK way 
> forward right now)
>  Clang :: SemaOpenACC/compute-construct-num_gangs-clause.c
>
>  FLANG: prohibits device_num >1x  (UNK way forward RN).
>Clang :: SemaOpenACC/init-construct.cpp
>Clang :: SemaOpenACC/shutdown-construct.cpp
> ```

Implemented our agreement on the `device_num` on init/shutdown, so down to only 
the num_gangs/num_workers/vector_length restriction we proposed, which requires 
that the Appertainment files (and thus likely the Fortran impl) change.

@clementval 

https://github.com/llvm/llvm-project/pull/135372
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [HLSL][RootSignature] Implement initial parsing of the descriptor table clause params (PR #133800)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `bolt-x86_64-ubuntu-nfc` 
running on `bolt-worker` while building `clang,llvm` at step 8 
"test-build-bolt-check-bolt".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/92/builds/17375


Here is the relevant piece of the build log for the reference

```
Step 8 (test-build-bolt-check-bolt) failure: test (failure)
...
0.238 [791/9/56] Building DiagnosticSemaKinds.inc...
0.238 [791/8/57] Building DiagnosticSerializationInterface.inc...
0.240 [791/7/58] Building DiagnosticIndexName.inc...
0.240 [791/6/59] Completed 'bolt_rt'
0.248 [791/5/60] Building DiagnosticGroups.inc...
0.253 [38/4/61] Building DiagnosticAllCompatIDs.inc...
0.273 [23/18/62] Generating VCSVersion.inc
2.551 [21/18/63] Linking CXX executable bin/llvm-bat-dump
2.604 [20/18/64] Linking CXX executable 
tools/bolt/unittests/Profile/ProfileTests
3.842 [19/18/65] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
FAILED: 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG 
-D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/tools/clang/lib/Parse 
-I/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/clang/lib/Parse 
-I/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/clang/include 
-I/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/tools/clang/include 
-I/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/include 
-I/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/llvm/include 
-fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
-Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough 
-Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move 
-Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor 
-Wsuggest-override -Wno-comment -Wno-misleading-indentation 
-Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections 
-fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 
-DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
 -MF 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o.d
 -o 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSLRootSignature.cpp.o
 -c 
/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/clang/lib/Parse/ParseHLSLRootSignature.cpp
In file included from 
/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/clang/include/clang/Parse/ParseHLSLRootSignature.h:23,
 from 
/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/clang/lib/Parse/ParseHLSLRootSignature.cpp:9:
/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h:42:12:
 error: declaration of ‘llvm::hlsl::rootsig::Register 
llvm::hlsl::rootsig::DescriptorTableClause::Register’ changes meaning of 
‘Register’ [-fpermissive]
   42 |   Register Register;
  |^~~~
/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h:28:8:
 note: ‘Register’ declared here as ‘struct llvm::hlsl::rootsig::Register’
   28 | struct Register {
  |^~~~
5.438 [19/17/66] Building CXX object 
tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Warnings.cpp.o
5.694 [19/16/67] Linking CXX executable tools/bolt/unittests/Core/CoreTests
10.935 [19/15/68] Building CXX object 
tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/DiagnosticIDs.cpp.o
11.401 [19/14/69] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseInit.cpp.o
11.405 [19/13/70] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseAST.cpp.o
11.734 [19/12/71] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseHLSL.cpp.o
12.525 [19/11/72] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
12.950 [19/10/73] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseCXXInlineMethods.cpp.o
13.476 [19/9/74] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseStmtAsm.cpp.o
13.686 [19/8/75] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseStmt.cpp.o
13.999 [19/7/76] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExprCXX.cpp.o
14.091 [19/6/77] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseObjc.cpp.o
14.319 [19/5/78] Building CXX object 
tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseExpr.cpp.o
1

[clang] [clang-format] Fix a bug in parsing C-style cast lambda (PR #136099)

2025-04-18 Thread Björn Schäpers via cfe-commits


@@ -2371,7 +2371,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
   if ((Previous && ((Previous->Tok.getIdentifierInfo() &&
  !Previous->isOneOf(tok::kw_return, tok::kw_co_await,
 tok::kw_co_yield, tok::kw_co_return)) 
||
-Previous->closesScope())) ||
+(Previous->closesScope() &&
+ !Previous->endsSequence(tok::r_paren, tok::greater ||

HazardyKnusperkeks wrote:

And if it is casted to `int(*)`?

I know we didn't annotate stuff here, it is hard to detect if this is a cast, 
but is there maybe a different way which would be a bit more resilient?

https://github.com/llvm/llvm-project/pull/136099
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy][C++20] Add support for Initialization Forwarding in structs and Nested Objects within modernize-use-emplace (PR #131969)

2025-04-18 Thread David Rivera via cfe-commits

RiverDave wrote:

Ping @piotrdz @5chmidti @HerrCai0907 :)

https://github.com/llvm/llvm-project/pull/131969
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Improve integer comparison by matching valid expressions outside implicitCastExpr (PR #134188)

2025-04-18 Thread David Rivera via cfe-commits

RiverDave wrote:

Ping :)

https://github.com/llvm/llvm-project/pull/134188
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 915de1a - Generate empty .clang-format-ignore before running tests (#136154)

2025-04-18 Thread via cfe-commits

Author: Devon Loehr
Date: 2025-04-18T08:43:00-07:00
New Revision: 915de1a5889c4dad1ec7b77ac5c41ebabc20a8ca

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

LOG: Generate empty .clang-format-ignore before running tests (#136154)

Followup to #136022, this ensures formatting tests are run with an empty
`.clang-format-ignore` in their root directory, to prevent failures if
the file also exists higher in the tree.

Added: 


Modified: 
clang/test/Format/lit.local.cfg

Removed: 




diff  --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index b060c79226cbd..20e217664997b 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -1,3 +1,4 @@
+import os
 import platform
 import lit.formats
 
@@ -27,3 +28,8 @@ config.suffixes = [
 # python implementation does, so use that for cross platform compatibility
 if platform.system() == "AIX":
 config.test_format = lit.formats.ShTest()
+
+# Create an empty .clang-format-ignore file so that tests don't get messed
+# up if one exists higher in the tree
+with open(".clang-format-ignore", 'w'):
+pass



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


[clang] Generate empty .clang-format-ignore before running tests (PR #136154)

2025-04-18 Thread Arthur Eubanks via cfe-commits

https://github.com/aeubanks closed 
https://github.com/llvm/llvm-project/pull/136154
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Erich Keane via cfe-commits

erichkeane wrote:

Hmm... do either of you (@jplehr @DKLoehr ) have the ability to provide the 
author a reduced example they can work with?  We can revert in the meantime, 
but without a reduction provided (or AT LEAST a pre-processed example), there 
isn't anything we can really do about these reports.

Our crashes usually provide dumps (the location should be printed in the crash) 
which should provide the info needed to do so.

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Revert "[clang] Handle instantiated members to determine visibility" (PR #136317)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Erich Keane (erichkeane)


Changes

Reverts llvm/llvm-project#136128

See discussion here: 
https://github.com/llvm/llvm-project/pull/136128#issuecomment-2815648110
and : https://github.com/llvm/llvm-project/pull/136128#issuecomment-2815652846

@asavonic can re-submit once the examples provided by @jplehr 
and/or @DKLoehr  are fixed.

---
Full diff: https://github.com/llvm/llvm-project/pull/136317.diff


2 Files Affected:

- (modified) clang/lib/AST/Decl.cpp (+3-10) 
- (modified) clang/test/CodeGenCXX/visibility.cpp (+1-37) 


``diff
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index b59619892979a..ad1cb01592e9b 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -400,9 +400,9 @@ void LinkageComputer::mergeTemplateLV(
   FunctionTemplateDecl *temp = specInfo->getTemplate();
   // Merge information from the template declaration.
   LinkageInfo tempLV = getLVForDecl(temp, computation);
-  // The linkage and visibility of the specialization should be
-  // consistent with the template declaration.
-  LV.mergeMaybeWithVisibility(tempLV, considerVisibility);
+  // The linkage of the specialization should be consistent with the
+  // template declaration.
+  LV.setLinkage(tempLV.getLinkage());
 
   // Merge information from the template parameters.
   LinkageInfo paramsLV =
@@ -1051,13 +1051,6 @@ LinkageComputer::getLVForClassMember(const NamedDecl *D,
 if (const auto *redeclTemp = dyn_cast(temp)) {
   if (isExplicitMemberSpecialization(redeclTemp)) {
 explicitSpecSuppressor = temp->getTemplatedDecl();
-  } else if (const RedeclarableTemplateDecl *from =
- redeclTemp->getInstantiatedFromMemberTemplate()) {
-// If no explicit visibility is specified yet, and this is an
-// instantiated member of a template, look up visibility there
-// as well.
-LinkageInfo fromLV = from->getLinkageAndVisibility();
-LV.mergeMaybeWithVisibility(fromLV, considerVisibility);
   }
 }
   }
diff --git a/clang/test/CodeGenCXX/visibility.cpp 
b/clang/test/CodeGenCXX/visibility.cpp
index b69278a71d48e..e1061f3dbd18f 100644
--- a/clang/test/CodeGenCXX/visibility.cpp
+++ b/clang/test/CodeGenCXX/visibility.cpp
@@ -1457,45 +1457,9 @@ namespace test71 {
   // CHECK-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
   // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIiE3barIiEET_v(
   // CHECK-LABEL: define linkonce_odr hidden noundef i64 
@_ZN6test713fooIlE3zedEv(
-  // CHECK-LABEL: define linkonce_odr hidden noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
+  // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
   // CHECK-HIDDEN-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
   // CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIiE3barIiEET_v(
   // CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i64 
@_ZN6test713fooIlE3zedEv(
   // CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
 }
-
-// https://github.com/llvm/llvm-project/issues/103477
-namespace test72 {
-  template 
-  struct t {
-template 
-static HIDDEN void bar() {}
-  };
-
-  void test() {
-  t::bar<1>();
-  }
-  // CHECK-LABEL: define linkonce_odr hidden void 
@_ZN6test721tIcE3barILi1EEEvv(
-  // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void 
@_ZN6test721tIcE3barILi1EEEvv(
-}
-
-// https://github.com/llvm/llvm-project/issues/31462
-namespace test73 {
-  template  struct s {
-template 
-__attribute__((__visibility__("hidden"))) U should_not_be_exported();
-  };
-
-  template  template  U s::should_not_be_exported() {
-return U();
-  }
-
-  extern template struct __attribute__((__visibility__("default"))) s;
-
-  int f() {
-s o;
-return o.should_not_be_exported();
-  }
-  // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test731sIiE22should_not_be_exportedIiEET_v(
-  // CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 
@_ZN6test731sIiE22should_not_be_exportedIiEET_v(
-}

``




https://github.com/llvm/llvm-project/pull/136317
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Erich Keane via cfe-commits

erichkeane wrote:

Revert submitted here: https://github.com/llvm/llvm-project/pull/136317 

When CI is ok with it, I'll merge it.

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-18 Thread David Rivera via cfe-commits

RiverDave wrote:

Ping 

https://github.com/llvm/llvm-project/pull/134774
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Revert "[clang] Handle instantiated members to determine visibility" (PR #136317)

2025-04-18 Thread Erich Keane via cfe-commits

https://github.com/erichkeane created 
https://github.com/llvm/llvm-project/pull/136317

Reverts llvm/llvm-project#136128

See discussion here: 
https://github.com/llvm/llvm-project/pull/136128#issuecomment-2815648110
and : https://github.com/llvm/llvm-project/pull/136128#issuecomment-2815652846

@asavonic can re-submit once the examples provided by @jplehr and/or @DKLoehr  
are fixed.

>From 583fb96d16c34c5d2b2925a9135c94c587beefed Mon Sep 17 00:00:00 2001
From: Erich Keane 
Date: Fri, 18 Apr 2025 08:48:31 -0700
Subject: [PATCH] Revert "[clang] Handle instantiated members to determine
 visibility (#136128)"

This reverts commit a8fe21f3f502a49cb05b69b0d6fa74472b93888a.
---
 clang/lib/AST/Decl.cpp   | 13 +++---
 clang/test/CodeGenCXX/visibility.cpp | 38 +---
 2 files changed, 4 insertions(+), 47 deletions(-)

diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index b59619892979a..ad1cb01592e9b 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -400,9 +400,9 @@ void LinkageComputer::mergeTemplateLV(
   FunctionTemplateDecl *temp = specInfo->getTemplate();
   // Merge information from the template declaration.
   LinkageInfo tempLV = getLVForDecl(temp, computation);
-  // The linkage and visibility of the specialization should be
-  // consistent with the template declaration.
-  LV.mergeMaybeWithVisibility(tempLV, considerVisibility);
+  // The linkage of the specialization should be consistent with the
+  // template declaration.
+  LV.setLinkage(tempLV.getLinkage());
 
   // Merge information from the template parameters.
   LinkageInfo paramsLV =
@@ -1051,13 +1051,6 @@ LinkageComputer::getLVForClassMember(const NamedDecl *D,
 if (const auto *redeclTemp = dyn_cast(temp)) {
   if (isExplicitMemberSpecialization(redeclTemp)) {
 explicitSpecSuppressor = temp->getTemplatedDecl();
-  } else if (const RedeclarableTemplateDecl *from =
- redeclTemp->getInstantiatedFromMemberTemplate()) {
-// If no explicit visibility is specified yet, and this is an
-// instantiated member of a template, look up visibility there
-// as well.
-LinkageInfo fromLV = from->getLinkageAndVisibility();
-LV.mergeMaybeWithVisibility(fromLV, considerVisibility);
   }
 }
   }
diff --git a/clang/test/CodeGenCXX/visibility.cpp 
b/clang/test/CodeGenCXX/visibility.cpp
index b69278a71d48e..e1061f3dbd18f 100644
--- a/clang/test/CodeGenCXX/visibility.cpp
+++ b/clang/test/CodeGenCXX/visibility.cpp
@@ -1457,45 +1457,9 @@ namespace test71 {
   // CHECK-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
   // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIiE3barIiEET_v(
   // CHECK-LABEL: define linkonce_odr hidden noundef i64 
@_ZN6test713fooIlE3zedEv(
-  // CHECK-LABEL: define linkonce_odr hidden noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
+  // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
   // CHECK-HIDDEN-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
   // CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 
@_ZN6test713fooIiE3barIiEET_v(
   // CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i64 
@_ZN6test713fooIlE3zedEv(
   // CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i32 
@_ZN6test713fooIlE3barIiEET_v(
 }
-
-// https://github.com/llvm/llvm-project/issues/103477
-namespace test72 {
-  template 
-  struct t {
-template 
-static HIDDEN void bar() {}
-  };
-
-  void test() {
-  t::bar<1>();
-  }
-  // CHECK-LABEL: define linkonce_odr hidden void 
@_ZN6test721tIcE3barILi1EEEvv(
-  // CHECK-HIDDEN-LABEL: define linkonce_odr hidden void 
@_ZN6test721tIcE3barILi1EEEvv(
-}
-
-// https://github.com/llvm/llvm-project/issues/31462
-namespace test73 {
-  template  struct s {
-template 
-__attribute__((__visibility__("hidden"))) U should_not_be_exported();
-  };
-
-  template  template  U s::should_not_be_exported() {
-return U();
-  }
-
-  extern template struct __attribute__((__visibility__("default"))) s;
-
-  int f() {
-s o;
-return o.should_not_be_exported();
-  }
-  // CHECK-LABEL: define linkonce_odr noundef i32 
@_ZN6test731sIiE22should_not_be_exportedIiEET_v(
-  // CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 
@_ZN6test731sIiE22should_not_be_exportedIiEET_v(
-}

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


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Jan Patrick Lehr via cfe-commits

jplehr wrote:

I can try later today to get dumps/preprocessed source or maybe some better 
idea on how to reproduce the issue.
@jhuber6 if you have immediate thoughts on how to provide that (or maybe even 
what may be the issue), let me know.

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-format] Fix a bug in BWACS_MultiLine (PR #136281)

2025-04-18 Thread Björn Schäpers via cfe-commits

https://github.com/HazardyKnusperkeks approved this pull request.


https://github.com/llvm/llvm-project/pull/136281
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [RISCV] Add processor definition for XiangShan-KunMingHu-V2R2 (PR #123193)

2025-04-18 Thread Pengcheng Wang via cfe-commits

https://github.com/wangpc-pp approved this pull request.

LGTM! Thanks for the insistence!

https://github.com/llvm/llvm-project/pull/123193
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread Matt Arsenault via cfe-commits

https://github.com/arsenm edited 
https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`llvm-clang-x86_64-sie-ubuntu-fast` running on `sie-linux-worker` while 
building `clang,llvm` at step 6 "test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/144/builds/23079


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang 
-cc1 -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/Inputs/include
-internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c
 -o -  | 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck
 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang 
-cc1 -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/Inputs/include
 -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c
 -o -
+ 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck
 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
1: ; ModuleID = 
'/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c'
 
2: source_filename = 
"/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Headers/gpuintrin_lang.c"
 
3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
4: target triple = "nvptx64" 
5:  
6: ; Function Attrs: convergent noinline 
nounwind optnone 
7: define dso_local i32 @foo() #0 
{ 
label:36'0 ^~
label:36'1 ^~
same:37'0^~
same:37'1   ^captured var 
"ATTR0"
8: entry: 
next:38'0  ^~
next:38'1  ^~  captured var "ENTRY"
next:39'0X error: no match found
9:  %0 = call i32 
@llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0  
next:39'1   ?   
possible intended match
   10:  ret i32 %0 
next:39'0  ~~

[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-aarch64-quick` 
running on `linaro-clang-aarch64-quick` while building `clang,llvm` at step 5 
"ninja check 1".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/65/builds/15490


Here is the relevant piece of the build log for the reference

```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang -cc1 
-internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/Inputs/include
-internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -  | /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang -cc1 
-internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/Inputs/include
 -internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c'
 
   2: source_filename = 
"/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/Headers/gpuintrin_lang.c"
 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`openmp-offload-sles-build-only` running on `rocm-worker-hw-04-sles` while 
building `clang,llvm` at step 6 "Add check check-clang".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/140/builds/21497


Here is the relevant piece of the build log for the reference

```
Step 6 (Add check check-clang) failure: test (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/clang -cc1 
-internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/Inputs/include
-internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c
 -o -  | 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/clang 
-cc1 -internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/Inputs/include
 -internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c
 -o -
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c'
 
   2: source_filename = 
"/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/Headers/gpuintrin_lang.c"
 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `arc-builder` running on 
`arc-worker` while building `clang,llvm` at step 6 
"test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/3/builds/14713


Here is the relevant piece of the build log for the reference

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/buildbot/worker/arc-folder/build/bin/clang -cc1 -internal-isystem 
/buildbot/worker/arc-folder/build/lib/clang/21/include -nostdsysteminc 
-internal-isystem 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/Inputs/include
-internal-isystem 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/../../lib/Headers/  
  -fcuda-is-device -triple nvptx64 -emit-llvm 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c -o 
-  | /buildbot/worker/arc-folder/build/bin/FileCheck 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c 
--check-prefix=CUDA # RUN: at line 2
+ /buildbot/worker/arc-folder/build/bin/clang -cc1 -internal-isystem 
/buildbot/worker/arc-folder/build/lib/clang/21/include -nostdsysteminc 
-internal-isystem 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/Inputs/include 
-internal-isystem 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/../../lib/Headers/ 
-fcuda-is-device -triple nvptx64 -emit-llvm 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c -o 
-
+ /buildbot/worker/arc-folder/build/bin/FileCheck 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c 
--check-prefix=CUDA
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c' 
   2: source_filename = 
"/buildbot/worker/arc-folder/llvm-project/clang/test/Headers/gpuintrin_lang.c" 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-m68k-linux-cross` 
running on `suse-gary-m68k-cross` while building `clang,llvm` at step 5 "ninja 
check 1".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/27/builds/8828


Here is the relevant piece of the build log for the reference

```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/clang
 -cc1 -internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/Inputs/include
-internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -  | 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck
 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/clang
 -cc1 -internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/lib/clang/21/include
 -nostdsysteminc -internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/Inputs/include
 -internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -
+ 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck
 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c'
 
   2: source_filename = 
"/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/test/Headers/gpuintrin_lang.c"
 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-aarch64-ubuntu` 
running on `linaro-lldb-aarch64-ubuntu` while building `clang,llvm` at step 6 
"test".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/59/builds/16257


Here is the relevant piece of the build log for the reference

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteAttach.py (1201 of 2125)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteFork.py (1202 of 2125)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteForkNonStop.py (1203 of 
2125)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteCompletion.py (1204 of 2125)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteForkResume.py (1205 of 
2125)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteExitCode.py (1206 of 2125)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteHostInfo.py (1207 of 2125)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteModuleInfo.py (1208 of 2125)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteAuxvSupport.py (1209 of 2125)
UNRESOLVED: lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py (1210 of 
2125)
 TEST 'lldb-api :: 
tools/lldb-dap/variables/TestDAP_variables.py' FAILED 
Script:
--
/usr/bin/python3.10 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include 
--env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--arch aarch64 --build-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil 
--make /usr/bin/gmake --llvm-tools-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/variables
 -p TestDAP_variables.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
9bdd9dc895ade41ec24f1a9918f70b23271ac89b)
  clang revision 9bdd9dc895ade41ec24f1a9918f70b23271ac89b
  llvm revision 9bdd9dc895ade41ec24f1a9918f70b23271ac89b
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 
'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_darwin_dwarf_missing_obj (TestDAP_variables.TestDAP_variables) (requires 
one of macosx, darwin, ios, tvos, watchos, bridgeos, iphonesimulator, 
watchsimulator, appletvsimulator) 
UNSUPPORTED: LLDB 
(/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: 
test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled 
(TestDAP_variables.TestDAP_variables) (requires one of macosx, darwin, ios, 
tvos, watchos, bridgeos, iphonesimulator, watchsimulator, appletvsimulator) 
= DEBUG ADAPTER PROTOCOL LOGS =
1744972815.397353411 --> (stdin/stdout) 
{"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1}
1744972815.399456978 <-- (stdin/stdout) {"body":{"$__lldb_version":"lldb 
version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
9bdd9dc895ade41ec24f1a9918f70b23271ac89b)\n  clang revision 
9bdd9dc895ade41ec24f1a9918f70b23271ac89b\n  llvm revision 
9bdd9dc895ade41ec24f1a9918f70b23271ac89b","completionTriggerCharacters":["."," 
","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++
 Catch"},{"default":false,"filter":"cpp_throw","label":"C++ 
Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C 
Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C 
Throw"}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"support

[clang] [llvm] [RISCV] Add processor definition for XiangShan-KunMingHu-V2R2 (PR #123193)

2025-04-18 Thread via cfe-commits

https://github.com/liliumShade updated 
https://github.com/llvm/llvm-project/pull/123193

>From 08f81150949fb97411d6cc6e58c2b9f293cc1bf5 Mon Sep 17 00:00:00 2001
From: Chyaka 
Date: Thu, 16 Jan 2025 19:02:54 +0800
Subject: [PATCH 1/6] [RISCV] Add processor definition for
 XiangShan-KunMingHu-V2R2

Co-Authored-By: Shenglin Tang 
Co-Authored-By: Xu, Zefan 
Co-Authored-By: Tang Haojin 
---
 clang/test/Driver/riscv-cpus.c| 47 +++
 .../test/Misc/target-invalid-cpu-note/riscv.c |  2 +
 llvm/docs/ReleaseNotes.md |  1 +
 llvm/lib/Target/RISCV/RISCVProcessors.td  | 31 
 4 files changed, 81 insertions(+)

diff --git a/clang/test/Driver/riscv-cpus.c b/clang/test/Driver/riscv-cpus.c
index e97b6940662d9..b9b27eec61c6f 100644
--- a/clang/test/Driver/riscv-cpus.c
+++ b/clang/test/Driver/riscv-cpus.c
@@ -31,6 +31,53 @@
 // MCPU-XIANGSHAN-NANHU-SAME: "-target-feature" "+zks" "-target-feature" 
"+zksed" "-target-feature" "+zksh" "-target-feature" "+svinval"
 // MCPU-XIANGSHAN-NANHU-SAME: "-target-abi" "lp64d"
 
+// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mcpu=xiangshan-kunminghu | 
FileCheck -check-prefix=MCPU-XIANGSHAN-KUNMINGHU %s
+// MCPU-XIANGSHAN-KUNMINGHU: "-nostdsysteminc" "-target-cpu" 
"xiangshan-kunminghu"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+m"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+a"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+f"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+d"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+c"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+b"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+v"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zic64b" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zicbom" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zicbop" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zicboz" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+ziccif" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zicclsm" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+ziccrse" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zicntr" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zicond" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zicsr" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zacas" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zfh" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zba" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zbb" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zbc"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zbkb" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zbkc" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zbkx" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zbs"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zkn" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zks" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zvfh"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+zvl128b"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+smcsrind"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+smdbltrp"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+smmpm"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+smnpm"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+smrnmi"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+smstateen"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+sscsrind"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+ssdbltrp"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+sspm"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "+ssstrict"
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "-zawrs" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "-ziccamoa" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-feature" "-zihintntl" 
+// MCPU-XIANGSHAN-KUNMINGHU-SAME: "-target-abi" "lp64d"
+
 // RUN: %clang --target=riscv64 -### -c %s 2>&1 -mcpu=spacemit-x60 | FileCheck 
-check-prefix=MCPU-SPACEMIT-X60 %s
 // MCPU-SPACEMIT-X60: "-nostdsysteminc" "-target-cpu" "spacemit-x60"
 // MCPU-SPACEMIT-X60-SAME: "-target-feature" "+m"
diff --git a/clang/test/Misc/target-invalid-cpu-note/riscv.c 
b/clang/test/Misc/target-invalid-cpu-note/riscv.c
index fb54dcb5b3a93..e9ed7ff476477 100644
--- a/clang/test/Misc/target-invalid-cpu-note/riscv.c
+++ b/clang/test/Misc/target-invalid-cpu-note/riscv.c
@@ -45,6 +45,7 @@
 // RISCV64-SAME: {{^}}, syntacore-scr7
 // RISCV64-SAME: {{^}}, tt-ascalon-d8
 // RISCV64-SAME: {{^}}, veyron-v1
+// RISCV64-SAME: {{^}}, xiangshan-kunminghu
 // RISCV64-SAME: {{^}}, xiangshan-nanhu
 // RISCV64-SAME: {{$}}
 
@@ -94,6 +95,7 @@
 // TUNE-RISCV64-SAME: {{^}}, syntacore-scr7
 // TUNE-RISCV64-SAME: {{^}}, tt-ascalon-d8
 // TUNE-RISCV64-SAME: {{^}}, veyron-v1
+// TUNE-RISCV64-SAME: {{^}}, xiangshan-kunminghu
 // TUNE-RISCV64-SAME: {{^

[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-x86_64-sie-win` 
running on `sie-win-worker` while building `clang,llvm` at step 7 
"test-build-unified-tree-check-all".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/46/builds/15407


Here is the relevant piece of the build log for the reference

```
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
z:\b\llvm-clang-x86_64-sie-win\build\bin\clang.exe -cc1 -internal-isystem 
Z:\b\llvm-clang-x86_64-sie-win\build\lib\clang\21\include -nostdsysteminc 
-internal-isystem 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers/Inputs/include   
 -internal-isystem 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers\gpuintrin_lang.c 
-o -  | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers\gpuintrin_lang.c 
--check-prefix=CUDA
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\clang.exe' -cc1 
-internal-isystem 'Z:\b\llvm-clang-x86_64-sie-win\build\lib\clang\21\include' 
-nostdsysteminc -internal-isystem 
'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers/Inputs/include' 
-internal-isystem 
'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers/../../lib/Headers/cuda_wrappers'
 -internal-isystem 
'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers/../../lib/Headers/'
 -fcuda-is-device -triple nvptx64 -emit-llvm 
'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers\gpuintrin_lang.c'
 -o -
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' 
'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers\gpuintrin_lang.c'
 --check-prefix=CUDA
# .---command stderr
# | 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers\gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
# | // CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
# |   ^
# | :8:7: note: scanning from 
here
# | entry:
# |   ^
# | :9:2: note: possible 
intended match here
# |  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
# |  ^
# | 
# | Input file: 
# | Check file: 
Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers\gpuintrin_lang.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<
# | 1: ; ModuleID = 
'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Headers\gpuintrin_lang.c'
 
# | 2: source_filename = 
"Z:\\b\\llvm-clang-x86_64-sie-win\\llvm-project\\clang\\test\\Headers\\gpuintrin_lang.c"
 
# | 3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
# | 4: target triple = "nvptx64" 
# | 5:  
# | 6: ; Function Attrs: convergent 
noinline nounwind optnone 
# | 7: define dso_local i32 @foo() #0 
{ 
# | label:36'0 ^~
# | label:36'1 ^~
# | same:37'0^~
# | same:37'1   ^
captured var "ATTR0"
# | 8: 
entry: 
# | next:38'0  ^~
# | next:38'1  ^~  captured var "ENTRY"
# | next:39'0X error: no match found
# | 9:  %0 = call i32 
@llvm.nvvm.read.ptx.sreg.tid.x() 
# | next:39'0  
# | next:39'1   ? 
  possible intended match
# |    10:  ret i32 %0 
# | next:39'0  
# |    11: } 
# | next:39'0  ~~
# |    12:  
...

```



https://github.com/llvm/llvm-pr

[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-armv8-quick` running 
on `linaro-clang-armv8-quick` while building `clang,llvm` at step 5 "ninja 
check 1".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/154/builds/15010


Here is the relevant piece of the build log for the reference

```
Step 5 (ninja check 1) failure: stage 1 checked (failure)
 TEST 'Clang :: Headers/gpuintrin_lang.c' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang -cc1 
-internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/Inputs/include
-internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
-internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/../../lib/Headers/
-fcuda-is-device -triple nvptx64 -emit-llvm 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -  | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA # RUN: at line 2
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang -cc1 
-internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/lib/clang/21/include 
-nostdsysteminc -internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/Inputs/include
 -internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/../../lib/Headers/cuda_wrappers
 -internal-isystem 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/../../lib/Headers/
 -fcuda-is-device -triple nvptx64 -emit-llvm 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 -o -
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c
 --check-prefix=CUDA
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c:39:15:
 error: CUDA-NEXT: expected string not found in input
// CUDA-NEXT: [[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
  ^
:8:7: note: scanning from here
entry:
  ^
:9:2: note: possible intended match here
 %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 ^

Input file: 
Check file: 
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c

-dump-input=help explains the following input dump.

Input was:
<<
   1: ; ModuleID = 
'/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c'
 
   2: source_filename = 
"/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/Headers/gpuintrin_lang.c"
 
   3: target datalayout = 
"e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64" 
   4: target triple = "nvptx64" 
   5:  
   6: ; Function Attrs: convergent noinline nounwind optnone 
   7: define dso_local i32 @foo() #0 { 
   8: entry: 
next:39'0   X error: no match found
   9:  %0 = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 
next:39'0 
next:39'1  ?   possible 
intended match
  10:  ret i32 %0 
next:39'0 
  11: } 
next:39'0 ~~
  12:  
next:39'0 ~
  13: ; Function Attrs: nocallback nofree nosync nounwind speculatable 
willreturn memory(none) 
next:39'0 
~
  14: declare noundef i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 
next:39'0 
   .
   .
   .
...

```



https://github.com/llvm/llvm-project/pull/136196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Handle instantiated members to determine visibility (PR #136128)

2025-04-18 Thread Andrew Savonichev via cfe-commits

asavonic wrote:

Sure, I'll post another patch to update release notes.

https://github.com/llvm/llvm-project/pull/136128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [HLSL][RootSignature] Add infastructure to parse parameters (PR #133800)

2025-04-18 Thread Justin Bogner via cfe-commits

https://github.com/bogner approved this pull request.


https://github.com/llvm/llvm-project/pull/133800
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang] enhance loop analysis to handle variable changes inside lambdas (PR #135573)

2025-04-18 Thread Oleksandr T. via cfe-commits

https://github.com/a-tarasyuk updated 
https://github.com/llvm/llvm-project/pull/135573

>From 93c8fc7faba6ab9537039b8745e62f5d79785cd0 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk 
Date: Thu, 17 Apr 2025 23:58:35 +0300
Subject: [PATCH] [Clang] enhance loop analysis to handle variable changes
 inside lambdas

---
 clang/docs/ReleaseNotes.rst   |  2 ++
 clang/lib/Sema/SemaStmt.cpp   | 19 ++--
 clang/test/SemaCXX/warn-loop-analysis.cpp | 35 +++
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c75d83a6d1a7a..8a330c010a73d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -385,6 +385,8 @@ Improvements to Clang's diagnostics
 
   Fixes #GH131127
 
+- The ``-Wloop-analysis`` warning now handles variable modifications inside 
lambda expressions (#GH132038).
+
 Improvements to Clang's time-trace
 --
 
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 39c2e157591df..2bb46dd94cca2 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2002,9 +2002,24 @@ namespace {
 }
 
 void VisitDeclRefExpr(DeclRefExpr *E) {
-  if (VarDecl *VD = dyn_cast(E->getDecl()))
+  if (VarDecl *VD = dyn_cast(E->getDecl())) {
 if (Decls.count(VD))
   FoundDecl = true;
+  } else if (CXXMethodDecl *MD = dyn_cast(E->getDecl());
+ MD && isLambdaCallOperator(MD)) {
+for (const auto &Capture : MD->getParent()->captures()) {
+  if (!Capture.capturesVariable())
+continue;
+
+  LambdaCaptureKind CK = Capture.getCaptureKind();
+  if (CK != LCK_ByRef)
+continue;
+
+  VarDecl *VD = dyn_cast(Capture.getCapturedVar());
+  if (VD && Decls.count(VD))
+FoundDecl = true;
+}
+  }
 }
 
 void VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
@@ -2021,7 +2036,7 @@ namespace {
 
 bool FoundDeclInUse() { return FoundDecl; }
 
-  };  // end class DeclMatcher
+  }; // end class DeclMatcher
 
   void CheckForLoopConditionalStatement(Sema &S, Expr *Second,
 Expr *Third, Stmt *Body) {
diff --git a/clang/test/SemaCXX/warn-loop-analysis.cpp 
b/clang/test/SemaCXX/warn-loop-analysis.cpp
index 324dd386292ac..ec2894a46ee77 100644
--- a/clang/test/SemaCXX/warn-loop-analysis.cpp
+++ b/clang/test/SemaCXX/warn-loop-analysis.cpp
@@ -299,3 +299,38 @@ void test10() {
   for (auto[i, j, k] = arr; i < a; ++i) { }
   for (auto[i, j, k] = arr; i < a; ++arr[0]) { }
 };
+
+namespace GH132038 {
+extern void foo(int);
+void test1() {
+  int a = 0;
+  auto incr_a = [&a]() { ++a; };
+
+  for (int b = 10; a <= b; incr_a())
+foo(a);
+
+  for (int b = 10; a <= b;)
+incr_a();
+
+  for (int b = 10; a <= b; [&a]() { ++a; }()) { }
+  for (int b = 10; a <= b; [&a]() { }()) { }
+}
+
+void test2() {
+  int a = 0;
+  auto incr_a = [a]() {  };
+  auto incr_b = [](int b) { };
+
+  for (int b = 10; a <= b; incr_a()) // expected-warning {{variables 'a' and 
'b' used in loop condition not modified in loop body}}
+foo(a);
+
+  for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used 
in loop condition not modified in loop body}}
+incr_a();
+
+  for (int b = 10; a <= b; incr_b(b)) // expected-warning {{variables 'a' and 
'b' used in loop condition not modified in loop body}}
+foo(a);
+
+  for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used 
in loop condition not modified in loop body}}
+incr_b(b);
+}
+}

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


[clang] [llvm] Fix nvptx range check (PR #136296)

2025-04-18 Thread Rahul Joshi via cfe-commits

https://github.com/jurahul created 
https://github.com/llvm/llvm-project/pull/136296

None

>From 8d0178850b74c568c03e98de47dbc9a94adedd05 Mon Sep 17 00:00:00 2001
From: Rahul Joshi 
Date: Thu, 17 Apr 2025 15:59:56 -0700
Subject: [PATCH 1/2] [NFC][LLVM][TableGen] Use `decodeULEB128` for
 `OPC_SoftFail` emission

- Use `decodeULEB128` to decode +ve/-ve mask in OPC_SoftFail case.
- Use current I/E iterators as inputs to `decodeULEB128`.
---
 llvm/utils/TableGen/DecoderEmitter.cpp | 50 ++
 1 file changed, 18 insertions(+), 32 deletions(-)

diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp 
b/llvm/utils/TableGen/DecoderEmitter.cpp
index 75c8c80aebd6d..a3fe49ef25de7 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -849,8 +849,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, 
DecoderTable &Table,
 
   // ULEB128 encoded start value.
   const char *ErrMsg = nullptr;
-  unsigned Start = decodeULEB128(Table.data() + Pos + 1, nullptr,
- Table.data() + Table.size(), &ErrMsg);
+  unsigned Start = decodeULEB128(&*I, nullptr, &*E, &ErrMsg);
   assert(ErrMsg == nullptr && "ULEB128 value too large!");
   emitULEB128(I, OS);
 
@@ -904,8 +903,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, 
DecoderTable &Table,
   ++I;
   // Decode the Opcode value.
   const char *ErrMsg = nullptr;
-  unsigned Opc = decodeULEB128(Table.data() + Pos + 1, nullptr,
-   Table.data() + Table.size(), &ErrMsg);
+  unsigned Opc = decodeULEB128(&*I, nullptr, &*E, &ErrMsg);
   assert(ErrMsg == nullptr && "ULEB128 value too large!");
 
   OS << Indent << "MCD::OPC_" << (IsTry ? "Try" : "") << "Decode, ";
@@ -934,34 +932,22 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, 
DecoderTable &Table,
 }
 case MCD::OPC_SoftFail: {
   ++I;
-  OS << Indent << "MCD::OPC_SoftFail";
-  // Positive mask
-  uint64_t Value = 0;
-  unsigned Shift = 0;
-  do {
-OS << ", " << (unsigned)*I;
-Value += ((uint64_t)(*I & 0x7f)) << Shift;
-Shift += 7;
-  } while (*I++ >= 128);
-  if (Value > 127) {
-OS << " /* 0x";
-OS.write_hex(Value);
-OS << " */";
-  }
-  // Negative mask
-  Value = 0;
-  Shift = 0;
-  do {
-OS << ", " << (unsigned)*I;
-Value += ((uint64_t)(*I & 0x7f)) << Shift;
-Shift += 7;
-  } while (*I++ >= 128);
-  if (Value > 127) {
-OS << " /* 0x";
-OS.write_hex(Value);
-OS << " */";
-  }
-  OS << ",\n";
+  OS << Indent << "MCD::OPC_SoftFail, ";
+  // Decode the positive mask.
+  const char *ErrMsg = nullptr;
+  uint64_t PositiveMask = decodeULEB128(&*I, nullptr, &*E, &ErrMsg);
+  assert(ErrMsg == nullptr && "ULEB128 value too large!");
+  emitULEB128(I, OS);
+
+  // Decode the negative mask.
+  uint64_t NegativeMask = decodeULEB128(&*I, nullptr, &*E, &ErrMsg);
+  assert(ErrMsg == nullptr && "ULEB128 value too large!");
+  emitULEB128(I, OS);
+  OS << "// +ve mask: 0x";
+  OS.write_hex(PositiveMask);
+  OS << ", -ve mask: 0x";
+  OS.write_hex(NegativeMask);
+  OS << '\n';
   break;
 }
 case MCD::OPC_Fail: {

>From 6d025c7114c7aaac9ba0c00f2f89bb8ce6aed76c Mon Sep 17 00:00:00 2001
From: Rahul Joshi 
Date: Fri, 18 Apr 2025 04:52:05 -0700
Subject: [PATCH 2/2] [Clang][GPU] Fix test to not have range on NVPTX tid.x

- llvm.nvvm.read.ptx.sreg.tid.x intrinsics does not have the
  output range attribute yet.
---
 clang/test/Headers/gpuintrin_lang.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/Headers/gpuintrin_lang.c 
b/clang/test/Headers/gpuintrin_lang.c
index ab660ac5c8a49..b804d46071507 100644
--- a/clang/test/Headers/gpuintrin_lang.c
+++ b/clang/test/Headers/gpuintrin_lang.c
@@ -36,7 +36,7 @@ __device__ int foo() { return __gpu_thread_id_x(); }
 // CUDA-LABEL: define dso_local i32 @foo(
 // CUDA-SAME: ) #[[ATTR0:[0-9]+]] {
 // CUDA-NEXT:  [[ENTRY:.*:]]
-// CUDA-NEXT:[[TMP0:%.*]] = call range(i32 0, 1024) i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
+// CUDA-NEXT:[[TMP0:%.*]] = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 // CUDA-NEXT:ret i32 [[TMP0]]
 //
 // HIP-LABEL: define dso_local i32 @foo(

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


[clang] [Clang] enhance loop analysis to handle variable changes inside lambdas (PR #135573)

2025-04-18 Thread via cfe-commits

cor3ntin wrote:

> @cor3ntin I question if `-Wloop-analysis` should be completely rewritten 
> using dataflow analysis, rather than AST based matching.

That's an interesting idea, but I don't think that should stop us from landing 
this improvement.
Maybe we want to open an issue for that?
@AaronBallman 

https://github.com/llvm/llvm-project/pull/135573
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Remove no-op visibility markers (PR #136271)

2025-04-18 Thread Chandler Carruth via cfe-commits

https://github.com/chandlerc created 
https://github.com/llvm/llvm-project/pull/136271

Richard Smith noticed that these are overridden by the surrounding visibility 
`let` region. Remove them to avoid confusion.

This should be a no-op given how the `.td` file is structured.

>From 541894c25062d69b66ac27632e4f90021956de38 Mon Sep 17 00:00:00 2001
From: Chandler Carruth 
Date: Fri, 18 Apr 2025 06:55:15 +
Subject: [PATCH] Remove no-op visibility markers

Richard Smith noticed that these are overridden by the surrounding
visibility `let` region. Remove them to avoid confusion.

This should be a no-op given how the `.td` file is structured.
---
 clang/include/clang/Driver/Options.td | 30 +--
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 830d3459a1320..ff823eebcfdfe 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -7893,23 +7893,23 @@ defm disable_free : BoolOption<"",
   "disable-free",
   FrontendOpts<"DisableFree">,
   DefaultFalse,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " freeing of memory on exit">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " freeing of memory on exit">>;
 defm clear_ast_before_backend : BoolOption<"",
   "clear-ast-before-backend",
   CodeGenOpts<"ClearASTBeforeBackend">,
   DefaultFalse,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " the Clang AST before running backend code 
generation">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " the Clang AST before running backend code generation">>;
 defm enable_noundef_analysis : BoolOption<"",
   "enable-noundef-analysis",
   CodeGenOpts<"EnableNoundefAttrs">,
   DefaultTrue,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " analyzing function argument and return types 
for mandatory definedness">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " analyzing function argument and return types for 
mandatory definedness">>;
 def discard_value_names : Flag<["-"], "discard-value-names">,
   HelpText<"Discard value names in LLVM IR">,
   MarshallingInfoFlag>;
@@ -7953,7 +7953,7 @@ def fmodules_embed_file_EQ : Joined<["-"], 
"fmodules-embed-file=">,
 defm fimplicit_modules_use_lock : BoolOption<"f", "implicit-modules-use-lock",
   FrontendOpts<"BuildingImplicitModuleUsesLock">, DefaultTrue,
   NegFlag,
-  PosFlag>;
 // FIXME: We only need this in C++ modules if we might textually
@@ -7986,12 +7986,12 @@ def ftest_module_file_extension_EQ :
 defm recovery_ast : BoolOption<"f", "recovery-ast",
   LangOpts<"RecoveryAST">, DefaultTrue,
   NegFlag,
-  PosFlag>;
 defm recovery_ast_type : BoolOption<"f", "recovery-ast-type",
   LangOpts<"RecoveryASTType">, DefaultTrue,
   NegFlag,
-  PosFlag>;
 
 let Group = Action_Group in {
@@ -8068,9 +8068,9 @@ def dump_minimization_hints : Joined<["-"],
 
 defm emit_llvm_uselists : BoolOption<"", "emit-llvm-uselists",
   CodeGenOpts<"EmitLLVMUseLists">, DefaultFalse,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " order of LLVM use-lists when serializing">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " order of LLVM use-lists when serializing">>;
 
 def print_stats : Flag<["-"], "print-stats">,
   HelpText<"Print performance metrics and statistics">,

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


[clang-tools-extra] [include-cleaner] rename enabled flags to `disable-*` (PR #132991)

2025-04-18 Thread Mohamed Emad via cfe-commits

https://github.com/hulxv updated 
https://github.com/llvm/llvm-project/pull/132991

>From c476948593a80ed31765cdd711a626e4e03930ab Mon Sep 17 00:00:00 2001
From: hulxv 
Date: Tue, 25 Mar 2025 22:56:51 +0200
Subject: [PATCH 1/2] [include-cleaner] rename enabled flags to `disable-*`

---
 .../include-cleaner/test/tool.cpp |  4 ++--
 .../include-cleaner/tool/IncludeCleaner.cpp   | 20 +--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/clang-tools-extra/include-cleaner/test/tool.cpp 
b/clang-tools-extra/include-cleaner/test/tool.cpp
index d72d2317ce2b1..8b723a5bf40e2 100644
--- a/clang-tools-extra/include-cleaner/test/tool.cpp
+++ b/clang-tools-extra/include-cleaner/test/tool.cpp
@@ -6,11 +6,11 @@ int x = foo();
 //  CHANGE: - "foobar.h"
 // CHANGE-NEXT: + "foo.h"
 
-// RUN: clang-include-cleaner -remove=0 -print=changes %s -- 
-I%S/Inputs/ | FileCheck --check-prefix=INSERT %s
+// RUN: clang-include-cleaner -disable-remove -print=changes %s -- 
-I%S/Inputs/ | FileCheck --check-prefix=INSERT %s
 //  INSERT-NOT: - "foobar.h"
 //  INSERT: + "foo.h"
 
-// RUN: clang-include-cleaner -insert=0 -print=changes %s -- 
-I%S/Inputs/ | FileCheck --check-prefix=REMOVE %s
+// RUN: clang-include-cleaner -disable-insert -print=changes %s -- 
-I%S/Inputs/ | FileCheck --check-prefix=REMOVE %s
 //  REMOVE: - "foobar.h"
 //  REMOVE-NOT: + "foo.h"
 
diff --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp 
b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index 1d9458ffc4d32..472611073f732 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -91,16 +91,16 @@ cl::opt Edit{
 cl::cat(IncludeCleaner),
 };
 
-cl::opt Insert{
-"insert",
-cl::desc("Allow header insertions"),
-cl::init(true),
+cl::opt DisableInsert{
+"disable-insert",
+cl::desc("DIsable header insertions"),
+cl::init(false),
 cl::cat(IncludeCleaner),
 };
-cl::opt Remove{
-"remove",
-cl::desc("Allow header removals"),
-cl::init(true),
+cl::opt DisableRemove{
+"disable-remove",
+cl::desc("Disable header removals"),
+cl::init(false),
 cl::cat(IncludeCleaner),
 };
 
@@ -183,9 +183,9 @@ class Action : public clang::ASTFrontendAction {
 auto Results =
 analyze(AST.Roots, PP.MacroReferences, PP.Includes, &PI,
 getCompilerInstance().getPreprocessor(), HeaderFilter);
-if (!Insert)
+if (DisableInsert)
   Results.Missing.clear();
-if (!Remove)
+if (DisableRemove)
   Results.Unused.clear();
 std::string Final = fixIncludes(Results, AbsPath, Code, getStyle(AbsPath));
 

>From e2f78ab69f656313fc87b004506abc1deb096189 Mon Sep 17 00:00:00 2001
From: hulxv 
Date: Fri, 18 Apr 2025 08:59:03 +0200
Subject: [PATCH 2/2] [include-cleaner] return `--remove` and `--insert` to be
 in deprecation period

---
 .../include-cleaner/tool/IncludeCleaner.cpp   | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp 
b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index 472611073f732..7a07d09ce277d 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -90,10 +90,21 @@ cl::opt Edit{
 cl::desc("Apply edits to analyzed source files"),
 cl::cat(IncludeCleaner),
 };
-
+cl::opt Insert{
+"insert",
+cl::desc("Allow header insertions"),
+cl::init(true),
+cl::cat(IncludeCleaner),
+};
+cl::opt Remove{
+"remove",
+cl::desc("Allow header removals"),
+cl::init(true),
+cl::cat(IncludeCleaner),
+};
 cl::opt DisableInsert{
 "disable-insert",
-cl::desc("DIsable header insertions"),
+cl::desc("Disable header insertions"),
 cl::init(false),
 cl::cat(IncludeCleaner),
 };
@@ -183,9 +194,9 @@ class Action : public clang::ASTFrontendAction {
 auto Results =
 analyze(AST.Roots, PP.MacroReferences, PP.Includes, &PI,
 getCompilerInstance().getPreprocessor(), HeaderFilter);
-if (DisableInsert)
+if (!Insert || DisableInsert)
   Results.Missing.clear();
-if (DisableRemove)
+if (!Remove || DisableRemove)
   Results.Unused.clear();
 std::string Final = fixIncludes(Results, AbsPath, Code, getStyle(AbsPath));
 

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


[clang] Remove no-op visibility markers (PR #136271)

2025-04-18 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Chandler Carruth (chandlerc)


Changes

Richard Smith noticed that these are overridden by the surrounding visibility 
`let` region. Remove them to avoid confusion.

This should be a no-op given how the `.td` file is structured.

---
Full diff: https://github.com/llvm/llvm-project/pull/136271.diff


1 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+15-15) 


``diff
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 830d3459a1320..ff823eebcfdfe 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -7893,23 +7893,23 @@ defm disable_free : BoolOption<"",
   "disable-free",
   FrontendOpts<"DisableFree">,
   DefaultFalse,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " freeing of memory on exit">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " freeing of memory on exit">>;
 defm clear_ast_before_backend : BoolOption<"",
   "clear-ast-before-backend",
   CodeGenOpts<"ClearASTBeforeBackend">,
   DefaultFalse,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " the Clang AST before running backend code 
generation">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " the Clang AST before running backend code generation">>;
 defm enable_noundef_analysis : BoolOption<"",
   "enable-noundef-analysis",
   CodeGenOpts<"EnableNoundefAttrs">,
   DefaultTrue,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " analyzing function argument and return types 
for mandatory definedness">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " analyzing function argument and return types for 
mandatory definedness">>;
 def discard_value_names : Flag<["-"], "discard-value-names">,
   HelpText<"Discard value names in LLVM IR">,
   MarshallingInfoFlag>;
@@ -7953,7 +7953,7 @@ def fmodules_embed_file_EQ : Joined<["-"], 
"fmodules-embed-file=">,
 defm fimplicit_modules_use_lock : BoolOption<"f", "implicit-modules-use-lock",
   FrontendOpts<"BuildingImplicitModuleUsesLock">, DefaultTrue,
   NegFlag,
-  PosFlag>;
 // FIXME: We only need this in C++ modules if we might textually
@@ -7986,12 +7986,12 @@ def ftest_module_file_extension_EQ :
 defm recovery_ast : BoolOption<"f", "recovery-ast",
   LangOpts<"RecoveryAST">, DefaultTrue,
   NegFlag,
-  PosFlag>;
 defm recovery_ast_type : BoolOption<"f", "recovery-ast-type",
   LangOpts<"RecoveryASTType">, DefaultTrue,
   NegFlag,
-  PosFlag>;
 
 let Group = Action_Group in {
@@ -8068,9 +8068,9 @@ def dump_minimization_hints : Joined<["-"],
 
 defm emit_llvm_uselists : BoolOption<"", "emit-llvm-uselists",
   CodeGenOpts<"EmitLLVMUseLists">, DefaultFalse,
-  PosFlag,
-  NegFlag,
-  BothFlags<[], [ClangOption], " order of LLVM use-lists when serializing">>;
+  PosFlag,
+  NegFlag,
+  BothFlags<[], [], " order of LLVM use-lists when serializing">>;
 
 def print_stats : Flag<["-"], "print-stats">,
   HelpText<"Print performance metrics and statistics">,

``




https://github.com/llvm/llvm-project/pull/136271
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Make the `-disable-free` flag more full featured (PR #136213)

2025-04-18 Thread Chandler Carruth via cfe-commits

chandlerc wrote:

Follow-up PR as requested: #136271

https://github.com/llvm/llvm-project/pull/136213
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   4   5   6   >