mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
This patch fixes the bug in peephole optimization that folds a load which defines one vreg into the one and only use of that vreg. With debug info, a DBG_VALUE that referenced the vreg considered to be a use, preventing the optimization. The fix is to ignore DBG_VALUE's during the optimization, and undef a DBG_VALUE that references a vreg that gets removed. Patch by Trevor Smigiel! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -127,17 +127,7 @@ bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) {
|
||||
unsigned Reg = MO.getReg();
|
||||
if (!TargetRegisterInfo::isVirtualRegister(Reg))
|
||||
continue;
|
||||
MachineRegisterInfo::use_iterator nextI;
|
||||
for (MachineRegisterInfo::use_iterator I = MRI->use_begin(Reg),
|
||||
E = MRI->use_end(); I!=E; I=nextI) {
|
||||
nextI = std::next(I); // I is invalidated by the setReg
|
||||
MachineOperand& Use = I.getOperand();
|
||||
MachineInstr *UseMI = Use.getParent();
|
||||
if (UseMI==MI)
|
||||
continue;
|
||||
assert(Use.isDebug());
|
||||
UseMI->getOperand(0).setReg(0U);
|
||||
}
|
||||
MRI->markUsesInDebugValueAsUndef(Reg);
|
||||
}
|
||||
AnyChanges = true;
|
||||
MI->eraseFromParent();
|
||||
|
Reference in New Issue
Block a user