Fix debug_value handling.
authorDale Johannesen <dalej@apple.com>
Thu, 11 Mar 2010 02:10:24 +0000 (02:10 +0000)
committerDale Johannesen <dalej@apple.com>
Thu, 11 Mar 2010 02:10:24 +0000 (02:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98224 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineCSE.cpp

index ce95d8d05ea635858f059531b95489e94502b8ed..91d36358829539325e768009c22c9f0cf5bac8c8 100644 (file)
@@ -122,8 +122,12 @@ bool MachineCSE::isPhysDefTriviallyDead(unsigned Reg,
       // Reached end of block, register is obviously dead.
       return true;
 
-    if (I->isDebugValue())
+    if (I->isDebugValue()) {
+      // These must not count against the limit.
+      ++LookAheadLeft;
+      ++I;
       continue;
+    }
     bool SeenDef = false;
     for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {
       const MachineOperand &MO = I->getOperand(i);
@@ -188,7 +192,7 @@ static bool isCopy(const MachineInstr *MI, const TargetInstrInfo *TII) {
 
 bool MachineCSE::isCSECandidate(MachineInstr *MI) {
   if (MI->isLabel() || MI->isPHI() || MI->isImplicitDef() ||
-      MI->isKill() || MI->isInlineAsm())
+      MI->isKill() || MI->isInlineAsm() || MI->isDebugValue())
     return false;
 
   // Ignore copies.