[llvm] [IR] Add CallBr intrinsics support (PR #133907)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 03:51:05 PST 2025


================
@@ -3056,10 +3056,39 @@ 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 is not yet supported for callbr in GlobalISel. As soon as
+  // we add support, we need to handle the indirect asm targets, see
+  // SelectionDAGBuilder::visitCallBr().
+  Intrinsic::ID IID = I.getIntrinsicID();
----------------
nikic wrote:

nit: Move this below the isInlineAsm() check, so the comment is directly next to the check.

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


More information about the llvm-commits mailing list