[llvm-commits] [llvm] r99319 - /llvm/trunk/lib/CodeGen/MachineCSE.cpp

Evan Cheng evan.cheng at apple.com
Tue Mar 23 13:33:48 PDT 2010


Author: evancheng
Date: Tue Mar 23 15:33:48 2010
New Revision: 99319

URL: http://llvm.org/viewvc/llvm-project?rev=99319&view=rev
Log:
Code clean up.

Modified:
    llvm/trunk/lib/CodeGen/MachineCSE.cpp

Modified: llvm/trunk/lib/CodeGen/MachineCSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCSE.cpp?rev=99319&r1=99318&r2=99319&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineCSE.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineCSE.cpp Tue Mar 23 15:33:48 2010
@@ -117,17 +117,15 @@
                                         MachineBasicBlock::const_iterator I,
                                         MachineBasicBlock::const_iterator E) {
   unsigned LookAheadLeft = 5;
-  while (LookAheadLeft--) {
+  while (LookAheadLeft) {
     if (I == E)
       // Reached end of block, register is obviously dead.
       return true;
 
-    if (I->isDebugValue()) {
-      // These must not count against the limit.
-      ++LookAheadLeft;
+    // Skip over dbg_value's.
+    while (I->isDebugValue())
       ++I;
-      continue;
-    }
+
     bool SeenDef = false;
     for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {
       const MachineOperand &MO = I->getOperand(i);
@@ -143,6 +141,8 @@
       // See a def of Reg (or an alias) before encountering any use, it's 
       // trivially dead.
       return true;
+
+    --LookAheadLeft;
     ++I;
   }
   return false;





More information about the llvm-commits mailing list