summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-12-02 18:40:09 +0000
committerDale Johannesen <dalej@apple.com>2008-12-02 18:40:09 +0000
commit70060013d2df183ac1c78104f4de65db25a346e4 (patch)
treeb9fd7e720f4c333d964e929e05cf3ded672e914e
parenteae373ea328c4bc1d5741b3b7d6e78268fa60e45 (diff)
downloadbcm5719-llvm-70060013d2df183ac1c78104f4de65db25a346e4.tar.gz
bcm5719-llvm-70060013d2df183ac1c78104f4de65db25a346e4.zip
Make the code do what the comment says it does.
llvm-svn: 60431
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 35bfae8121b..96ed932edac 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -598,10 +598,11 @@ Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase,
// 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())
OpenPOWER on IntegriCloud