[llvm] [ARM] Use helper class for emitting CFI instructions into MIR (PR #135994)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 10:55:44 PDT 2025


================
@@ -6722,11 +6660,12 @@ MachineBasicBlock::iterator ARMBaseInstrInfo::insertOutlinedCall(
     // Save and restore LR from that register.
     copyPhysReg(MBB, It, DebugLoc(), Reg, ARM::LR, true);
     if (!AFI.isLRSpilled())
-      emitCFIForLRSaveToReg(MBB, It, Reg);
+      CFIInstBuilder(MBB, It, MachineInstr::FrameSetup)
+          .buildRegister(ARM::LR, Reg);
     CallPt = MBB.insert(It, CallMIB);
     copyPhysReg(MBB, It, DebugLoc(), ARM::LR, Reg, true);
     if (!AFI.isLRSpilled())
-      emitCFIForLRRestoreFromReg(MBB, It);
+      CFIInstBuilder(MBB, It, MachineInstr::FrameDestroy).buildRestore(ARM::LR);
----------------
s-barannikov wrote:

These probably don't need FrameSetup/FrameDestroy, but that's what the original code does, and I wanted to keep this PR NFC-ish.


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


More information about the llvm-commits mailing list