[llvm] [InstrRef] Preserve debug instr num in aarch64-ldst-opt. (PR #136009)
Shubham Sandeep Rastogi via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 18 17:47:41 PDT 2025
================
@@ -965,6 +965,40 @@ static void updateDefinedRegisters(MachineInstr &MI, LiveRegUnits &Units,
Units.addReg(MOP.getReg());
}
+/// Find the DBG_INSTR_REF instruction that references the \p InstrNum
+static std::optional<MachineInstr *> findDebugInstrRef(MachineBasicBlock *MBB,
+ unsigned InstrNum) {
+
+ for (auto &MI : *MBB) {
+ if (MI.isDebugRef())
+ if (MI.getOperand(2).getInstrRefInstrIndex() == InstrNum)
----------------
rastogishubham wrote:
I did come across a case where the third operand was the MO_DbgInstrRef operand, so I added a function with a loop to find the correct operand instead
https://github.com/llvm/llvm-project/pull/136009
More information about the llvm-commits
mailing list