diff --git a/lib/CodeGen/MachineCombiner.cpp b/lib/CodeGen/MachineCombiner.cpp index 032b4ee5cbb..aeb864efa34 100644 --- a/lib/CodeGen/MachineCombiner.cpp +++ b/lib/CodeGen/MachineCombiner.cpp @@ -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; diff --git a/lib/Target/AArch64/AArch64InstrInfo.cpp b/lib/Target/AArch64/AArch64InstrInfo.cpp index fcf04dd2c04..df883d35fa1 100644 --- a/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -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;