[llvm-commits] [llvm] r60192 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Chris Lattner sabre at nondot.org
Thu Nov 27 15:00:21 PST 2008


Author: lattner
Date: Thu Nov 27 17:00:20 2008
New Revision: 60192

URL: http://llvm.org/viewvc/llvm-project?rev=60192&view=rev
Log:
use continue to reduce indentation

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=60192&r1=60191&r2=60192&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Nov 27 17:00:20 2008
@@ -2076,25 +2076,26 @@
       //
       // FIXME: this needs to eliminate an induction variable even if it's being
       // compared against some value to decide loop termination.
-      if (PN->hasOneUse()) {
-        SmallPtrSet<PHINode *, 2> PHIs;
-        for (Instruction *J = dyn_cast<Instruction>(*PN->use_begin());
-             J && J->hasOneUse() && !J->mayWriteToMemory();
-             J = dyn_cast<Instruction>(*J->use_begin())) {
-          // If we find the original PHI, we've discovered a cycle.
-          if (J == PN) {
-            // Break the cycle and mark the PHI for deletion.
-            SE->deleteValueFromRecords(PN);
-            PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
-            DeadInsts.insert(PN);
-            Changed = true;
-            break;
-          }
-          // If we find a PHI more than once, we're on a cycle that
-          // won't prove fruitful.
-          if (isa<PHINode>(J) && !PHIs.insert(cast<PHINode>(J)))
-            break;
+      if (!PN->hasOneUse())
+        continue;
+      
+      SmallPtrSet<PHINode *, 4> PHIs;
+      for (Instruction *J = dyn_cast<Instruction>(*PN->use_begin());
+           J && J->hasOneUse() && !J->mayWriteToMemory();
+           J = dyn_cast<Instruction>(*J->use_begin())) {
+        // If we find the original PHI, we've discovered a cycle.
+        if (J == PN) {
+          // Break the cycle and mark the PHI for deletion.
+          SE->deleteValueFromRecords(PN);
+          PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+          DeadInsts.insert(PN);
+          Changed = true;
+          break;
         }
+        // If we find a PHI more than once, we're on a cycle that
+        // won't prove fruitful.
+        if (isa<PHINode>(J) && !PHIs.insert(cast<PHINode>(J)))
+          break;
       }
     }
     DeleteTriviallyDeadInstructions(DeadInsts);





More information about the llvm-commits mailing list