forked from OSchip/llvm-project
[GlobalISel][DebugInfo] Salvage trivially dead instructions
Use salvageDebugInfo for instructions erased as trivially dead in GlobalISel. It would be helpful to implement support of G_PTR_ADD and G_FRAME_INDEX in salvageDebugInfo in future in order to preserve more variable location. Reviewed by: arsenm Differential Revision: https://reviews.llvm.org/D133986
This commit is contained in:
parent
f1a11d770e
commit
6cf11f4462
llvm
lib/CodeGen/GlobalISel
test/CodeGen/AArch64/GlobalISel
|
@ -160,6 +160,7 @@ bool InstructionSelect::runOnMachineFunction(MachineFunction &MF) {
|
|||
// If so, erase it.
|
||||
if (isTriviallyDead(MI, MRI)) {
|
||||
LLVM_DEBUG(dbgs() << "Is dead; erasing.\n");
|
||||
salvageDebugInfo(MRI, MI);
|
||||
MI.eraseFromParent();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -225,6 +225,7 @@ Legalizer::legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
|
|||
assert(isPreISelGenericOpcode(MI.getOpcode()) &&
|
||||
"Expecting generic opcode");
|
||||
if (isTriviallyDead(MI, MRI)) {
|
||||
salvageDebugInfo(MRI, MI);
|
||||
eraseInstr(MI, MRI, &LocObserver);
|
||||
continue;
|
||||
}
|
||||
|
@ -272,6 +273,7 @@ Legalizer::legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
|
|||
assert(isPreISelGenericOpcode(MI.getOpcode()) &&
|
||||
"Expecting generic opcode");
|
||||
if (isTriviallyDead(MI, MRI)) {
|
||||
salvageDebugInfo(MRI, MI);
|
||||
eraseInstr(MI, MRI, &LocObserver);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,8 @@ body: |
|
|||
; CHECK-LABEL: name: test_dbg_value_dead
|
||||
; CHECK: liveins: $w0
|
||||
; CHECK-NEXT: {{ $}}
|
||||
; CHECK-NEXT: DBG_VALUE %0:gpr32, $noreg, !7, !DIExpression(), debug-location !9
|
||||
; CHECK-NEXT: DBG_VALUE %1:gpr64, $noreg, !7, !DIExpression(), debug-location !9
|
||||
%0:gpr(s32) = COPY $w0
|
||||
DBG_VALUE %0(s32), $noreg, !7, !DIExpression(), debug-location !9
|
||||
%1:gpr(s64) = G_ZEXT %0:gpr(s32)
|
||||
DBG_VALUE %1(s64), $noreg, !7, !DIExpression(), debug-location !9
|
||||
...
|
||||
|
|
Loading…
Reference in New Issue