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

Dale Johannesen dalej at apple.com
Tue Dec 2 10:40:09 PST 2008


Author: johannes
Date: Tue Dec  2 12:40:09 2008
New Revision: 60431

URL: http://llvm.org/viewvc/llvm-project?rev=60431&view=rev
Log:
Make the code do what the comment says it does.


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=60431&r1=60430&r2=60431&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Dec  2 12:40:09 2008
@@ -598,10 +598,11 @@
   
   // If InsertLoop is not L, and InsertLoop is nested inside of L, figure out
   // the preheader of the outer-most loop where NewBase is not loop invariant.
-  while (InsertLoop && NewBase->isLoopInvariant(InsertLoop)) {
-    BaseInsertPt = InsertLoop->getLoopPreheader()->getTerminator();
-    InsertLoop = InsertLoop->getParentLoop();
-  }
+  if (L->contains(IP->getParent()))
+    while (InsertLoop && NewBase->isLoopInvariant(InsertLoop)) {
+      BaseInsertPt = InsertLoop->getLoopPreheader()->getTerminator();
+      InsertLoop = InsertLoop->getParentLoop();
+    }
   
   // If there is no immediate value, skip the next part.
   if (Imm->isZero())





More information about the llvm-commits mailing list