[llvm] [CodeGen] Use findPHICopyInsertPoint to put insert point (PR #155421)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 08:07:25 PDT 2025


================
@@ -32,7 +32,12 @@ llvm::findPHICopyInsertPoint(MachineBasicBlock* MBB, MachineBasicBlock* SuccMBB,
   // instructions that are Calls with EHPad successors or INLINEASM_BR in a
   // block.
   bool EHPadSuccessor = SuccMBB->isEHPad();
-  if (!EHPadSuccessor && !SuccMBB->isInlineAsmBrIndirectTarget())
+  // Bypass fast path if the block itself contains INLINEASM_BR.
+  bool HasInlineAsmBr = llvm::any_of(*MBB, [](const MachineInstr &MI) {
+    return MI.getOpcode() == TargetOpcode::INLINEASM_BR;
+  });
+
+  if (!EHPadSuccessor && !HasInlineAsmBr)
----------------
arsenm wrote:

This is walking the entire block to find an instruction in the terminator, then calling getFirstTerminator. You should only scan from getFirstTerminator 

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


More information about the llvm-commits mailing list