[MachineCombiner] Removal of dangling DBG_VALUES after combining [20598]

This is a cleaner solution to the problem described in r215431.
When instructions are combined a dangling DBG_VALUE is removed.
This resolves bug 20598.

llvm-svn: 215587
This commit is contained in:
Gerolf Hoflehner 2014-08-13 22:07:36 +00:00
parent 2b98e393f2
commit fe2c11ffd6
2 changed files with 2 additions and 3 deletions

View File

@ -380,7 +380,7 @@ bool MachineCombiner::combineInstructions(MachineBasicBlock *MBB) {
MBB->insert((MachineBasicBlock::iterator) & MI,
(MachineInstr *)InstrPtr);
for (auto *InstrPtr : DelInstrs)
InstrPtr->eraseFromParent();
InstrPtr->eraseFromParentAndMarkDBGValuesForRemoval();
Changed = true;
++NumInstCombined;

View File

@ -2293,8 +2293,7 @@ static bool canCombineWithMUL(MachineBasicBlock &MBB, MachineOperand &MO,
return false;
// Must only used by the user we combine with.
// FIXME: handle the case of DBG uses gracefully
if (!MRI.hasOneUse(MI->getOperand(0).getReg()))
if (!MRI.hasOneNonDBGUse(MI->getOperand(0).getReg()))
return false;
return true;