[llvm] [InstrRef] Preserve debug instr num in aarch64-ldst-opt. (PR #136009)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 18:10:46 PDT 2025


================
@@ -1227,6 +1261,30 @@ AArch64LoadStoreOpt::mergePairedInsns(MachineBasicBlock::iterator I,
             .addImm(0)
             .addImm(31);
     (void)MIBSXTW;
+
+    if (I->peekDebugInstrNum()) {
+      auto InstrNum = I->peekDebugInstrNum();
+      // If I is the instruction which got sign extended, restore the debug
+      // instruction number from I to the SBFMXri instruction
+      if (DstRegX == I->getOperand(0).getReg())
+        MIBSXTW->setDebugInstrNum(InstrNum);
+      else {
+        MIB->setDebugInstrNum(InstrNum);
+        setDebugInstrNum(I, MIB, InstrNum, InstrNum, MBB);
+      }
+    }
+    if (Paired->peekDebugInstrNum()) {
----------------
felipepiovezan wrote:

the same idea that Adrian suggested above applies here

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


More information about the llvm-commits mailing list