dbg_value may end a block.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 24 Mar 2010 01:50:28 +0000 (01:50 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 24 Mar 2010 01:50:28 +0000 (01:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99378 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineCSE.cpp

index 355acfcd46c979f324208ced53708ba269fd3f0a..fc9dea8e8276bc8369b5efb5d032bc1ec5cd1c0b 100644 (file)
@@ -118,14 +118,14 @@ bool MachineCSE::isPhysDefTriviallyDead(unsigned Reg,
                                         MachineBasicBlock::const_iterator E) {
   unsigned LookAheadLeft = 5;
   while (LookAheadLeft) {
+    // Skip over dbg_value's.
+    while (I != E && I->isDebugValue())
+      ++I;
+
     if (I == E)
       // Reached end of block, register is obviously dead.
       return true;
 
-    // Skip over dbg_value's.
-    while (I->isDebugValue())
-      ++I;
-
     bool SeenDef = false;
     for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {
       const MachineOperand &MO = I->getOperand(i);