================
@@ -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) {
----------------
farzonl wrote:

If you are going to have a conditional block for  null checking token why even 
have the terinary? Your IRBuilder isn't used till the for loop this could be 
restructured to do one conditional.

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

Reply via email to