[clang] [clang][AMDGPU] Clean-up handling of named barrier type (PR #207687)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 13 12:46:34 PDT 2026


================
@@ -1,18 +1,30 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature
- // REQUIRES: amdgpu-registered-target
- // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu verde -emit-llvm -o - %s | FileCheck %s
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-globals
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -target-cpu gfx1250 -emit-llvm -o - %s | FileCheck %s
 
 #define __shared__ __attribute__((shared))
 
 __shared__ __amdgpu_named_workgroup_barrier_t bar;
 __shared__ __amdgpu_named_workgroup_barrier_t arr[2];
-__shared__ struct {
+
+//.
+// CHECK: @bar = addrspace(3) global target("amdgcn.named.barrier", 0) undef, align 4
+// CHECK: @arr = addrspace(3) global [2 x target("amdgcn.named.barrier", 0)] undef, align 4
+// CHECK: @wrapper_str = addrspace(3) global %struct.WrapperStruct undef, align 4
+// CHECK: @wrapperwrapper_str = addrspace(3) global %struct.WrapperWrapperStruct undef, align 4
+// CHECK: @__hip_cuid_ = addrspace(1) global i8 0
----------------
yxsamliu wrote:

Can we drop the unrelated autogenerated checks here?

The `__hip_cuid_`, `llvm.compiler.used`, attribute groups, and module metadata checks do not seem related to named barrier lowering. Keeping the test focused on the globals and address-space casts should make it less brittle.

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


More information about the cfe-commits mailing list