[llvm] AArch64: Don't duplicate the branch's implicit defs in call pseudo expansion (PR #225064)

Nathan Corbyn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 05:51:44 PDT 2026


================
@@ -899,10 +899,14 @@ static MachineInstr *createCallWithOps(MachineBasicBlock &MBB,
                                        unsigned Opcode,
                                        ArrayRef<MachineOperand> ExplicitOps,
                                        unsigned RegMaskStartIdx) {
-  // Build the MI, with explicit operands first (including the call target).
-  MachineInstr *Call = BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII->get(Opcode))
-                           .add(ExplicitOps)
-                           .getInstr();
+  // Be careful not to duplicate the LR def which the original instruction
+  // already carries.
+  MachineFunction &MF = *MBB.getParent();
+  MachineInstr *Call =
+      MF.CreateMachineInstr(TII->get(Opcode), MBBI->getDebugLoc(),
+                            /*NoImplicit=*/true);
----------------
cofibrant wrote:

It's a shame we have to manually inline one of the `BuildMI` family just to set `NoImplicit` to true

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


More information about the llvm-commits mailing list