[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

Steven Perron via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 07:41:35 PDT 2024


================
@@ -469,14 +479,22 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
   for (auto &F : M.functions()) {
     if (!F.hasFnAttribute("hlsl.shader"))
       continue;
-    IRBuilder<> B(&F.getEntryBlock(), F.getEntryBlock().begin());
+    auto *Token = getConvergenceToken(F.getEntryBlock());
+    Instruction *IP =
+        Token ? Token->getNextNode() : &*F.getEntryBlock().begin();
+    IRBuilder<> B(IP);
+    SmallVector<OperandBundleDef, 1> OB;
+    if (Token) {
----------------
s-perron wrote:

Good call. Done.

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


More information about the cfe-commits mailing list