Skip to content

Commit 013aa77

Browse files
committed
use subst
1 parent db89b6b commit 013aa77

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

llvm/lib/Target/X86/X86FixupSetCC.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,16 @@ bool X86FixupSetCCPass::runOnMachineFunction(MachineFunction &MF) {
131131
ZeroReg);
132132
}
133133

134-
MachineInstr *NewMI =
135-
BuildMI(*ZExt->getParent(), ZExt, ZExt->getDebugLoc(),
136-
TII->get(X86::INSERT_SUBREG), ZExt->getOperand(0).getReg())
137-
.addReg(ZeroReg)
138-
.addReg(Reg0)
139-
.addImm(X86::sub_8bit);
140-
// Copy the debug info instr-ref number from the zext to its replacement.
134+
BuildMI(*ZExt->getParent(), ZExt, ZExt->getDebugLoc(),
135+
TII->get(X86::INSERT_SUBREG), ZExt->getOperand(0).getReg())
136+
.addReg(ZeroReg)
137+
.addReg(Reg0)
138+
.addImm(X86::sub_8bit);
139+
141140
if (unsigned InstrNum = ZExt->peekDebugInstrNum())
142-
NewMI->setDebugInstrNum(InstrNum);
141+
ZExt->getParent()->getParent()->makeDebugValueSubstitution(
142+
{InstrNum, 0}, {MI.getDebugInstrNum(), 0});
143+
143144
ToErase.push_back(ZExt);
144145
}
145146
}

llvm/test/DebugInfo/X86/x86fixupsetcc-debug-instr-num.mir

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
## Check the debug-isntr-number transfers from MOVZX32rr8
44
## to its replacement INSERT_SUBREG.
55

6-
# CHECK: %[[#]]:gr32 = INSERT_SUBREG %[[#]], %[[#]], %subreg.sub_8bit, debug-instr-number 1
7-
# CHECK-NEXT: DBG_INSTR_REF !4, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)
6+
# CHECK: debugValueSubstitutions:
7+
# CHECK: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 0, subreg: 0 }
8+
9+
# CHECK: %[[#]]:gr8 = SETCCr 15, implicit $eflags, debug-instr-number 2
10+
# CHECK: INSERT_SUBREG
11+
# CHECK-NOT: debug-instr-number
12+
# CHECK-NEXT: DBG_INSTR_REF ![[#]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)
813

914
--- |
1015
source_filename = "reduced.ll"

0 commit comments

Comments
 (0)