[llvm] [InstrRef] Preserve debug instr num in aarch64-ldst-opt. (PR #136009)
Shubham Sandeep Rastogi via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 29 14:53:09 PDT 2025
================
@@ -965,6 +965,28 @@ static void updateDefinedRegisters(MachineInstr &MI, LiveRegUnits &Units,
Units.addReg(MOP.getReg());
}
+/// This function will add a new entry into the debugValueSubstitutions table
+/// when two instruction have been merged into a new one represented by \p
+/// MergedInstr.
+static void addDebugSubstitutionsToTable(MachineFunction *MF,
+ unsigned InstrNumToSet,
+ MachineInstr &OriginalInstr,
+ MachineInstr &MergedInstr) {
+
+ // Figure out the Operand Index of the destination register of the
+ // OriginalInstr in the new MergedInstr.
+ auto Reg = OriginalInstr.getOperand(0).getReg();
+ unsigned OperandNo = 0;
+ for (auto Op : MergedInstr.operands()) {
+ if (Op.getReg() == Reg)
+ break;
+ OperandNo++;
----------------
rastogishubham wrote:
I changed it so that we only make the substitution if we find the correct Reg Operand.
https://github.com/llvm/llvm-project/pull/136009
More information about the llvm-commits
mailing list