[clang] [Clang][SPIR-V] Fix convergence tokens for dtor (PR #133469)

Steven Perron via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 28 11:52:55 PDT 2025


================
@@ -57,22 +58,37 @@ void main(unsigned GI : SV_GroupIndex) {
 // CHECK:      define void @main()
 // CHECK-NEXT: entry:
 // Verify destructor is emitted
-// NOINLINE-NEXT:   call void @_GLOBAL__sub_I_GlobalDestructors.hlsl()
-// NOINLINE-NEXT:   %0 = call i32 @llvm.dx.flattened.thread.id.in.group()
-// NOINLINE-NEXT:   call void @_Z4mainj(i32 %0)
-// NOINLINE-NEXT:   call void @_GLOBAL__D_a()
-// NOINLINE-NEXT:   ret void
+// NOINLINE-DXIL-NEXT:   call void @_GLOBAL__sub_I_GlobalDestructors.hlsl()
+// NOINLINE-DXIL-NEXT:   %0 = call i32 @llvm.dx.flattened.thread.id.in.group()
+// NOINLINE-DXIL-NEXT:   call void @_Z4mainj(i32 %0)
+// NOINLINE-DXIL-NEXT:   call void @_GLOBAL__D_a()
+// NOINLINE-DXIL-NEXT:   ret void
+
+// NOINLINE-SPIRV-NEXT:   %0 = call token @llvm.experimental.convergence.entry()
+// NOINLINE-SPIRV-NEXT:   call spir_func void @_GLOBAL__sub_I_GlobalDestructors.hlsl() [ "convergencectrl"(token %0) ]
----------------
s-perron wrote:

Does the definition of the destructor have the convergence tokens in it? I believe the inliner gets confused if some functions have convergence tokens and others do not.

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


More information about the cfe-commits mailing list