[llvm-branch-commits] [llvm] [polly] [IR] Add CallBr intrinsics support (PR #133907)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 5 23:42:18 PDT 2025


================
@@ -3006,10 +3024,41 @@ bool IRTranslator::translateInvoke(const User &U,
   return true;
 }
 
+/// The intrinsics currently supported by callbr are implicit control flow
+/// intrinsics such as amdgcn.kill.
 bool IRTranslator::translateCallBr(const User &U,
                                    MachineIRBuilder &MIRBuilder) {
-  // FIXME: Implement this.
-  return false;
+  if (containsBF16Type(U))
+    return false; // see translateCall
+
+  const CallBrInst &I = cast<CallBrInst>(U);
+  MachineBasicBlock *CallBrMBB = &MIRBuilder.getMBB();
+
+  // FIXME: inline asm not yet supported for callbr in GlobalISel As soon as we
+  // add support, we need to handle the indirect asm targets, see
+  // SelectionDAGBuilder::visitCallBr().
+  if (I.isInlineAsm())
+    return false;
+  if (I.getIntrinsicID() == Intrinsic::not_intrinsic)
+    return false;
+  if (!translateTargetIntrinsic(I, I.getIntrinsicID(), MIRBuilder))
+    return false;
----------------
arsenm wrote:

```suggestion
Intrinsic::ID IID = I.getIntrinsicID()
  if (IID == Intrinsic::not_intrinsic)
    return false;
  if (!translateTargetIntrinsic(I, IID, MIRBuilder))
    return false;
```

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


More information about the llvm-branch-commits mailing list