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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215587
91177308-0d34-0410-b5e6-
96231b3b80d8
MBB->insert((MachineBasicBlock::iterator) & MI,
(MachineInstr *)InstrPtr);
for (auto *InstrPtr : DelInstrs)
- InstrPtr->eraseFromParent();
+ InstrPtr->eraseFromParentAndMarkDBGValuesForRemoval();
Changed = true;
++NumInstCombined;
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;