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

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 31 07:53:36 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) ]
----------------
Keenuts wrote:

Yes it does. If it didn't, LLVM would complain there there is a mix of controlled and un-controlled convergence (hence why I noticed I had to fix this :) )

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


More information about the cfe-commits mailing list