[MachineCombiner] Removal of dangling DBG_VALUES after combining [20598]
authorGerolf Hoflehner <ghoflehner@apple.com>
Wed, 13 Aug 2014 22:07:36 +0000 (22:07 +0000)
committerGerolf Hoflehner <ghoflehner@apple.com>
Wed, 13 Aug 2014 22:07:36 +0000 (22:07 +0000)
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

lib/CodeGen/MachineCombiner.cpp
lib/Target/AArch64/AArch64InstrInfo.cpp

index 032b4ee5cbb123d30b7c168a102addba9470905a..aeb864efa340243c59c5528308894c7f634bbf36 100644 (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;
index fcf04dd2c04e680e0aa0950c87ea30297d95c9ba..df883d35fa18be09ad7ba9616a7b5b857a449e13 100644 (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;