diff options
author | Dale Johannesen <dalej@apple.com> | 2008-12-02 18:40:09 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-12-02 18:40:09 +0000 |
commit | eccdd08d4c1a81ede221bbccf3045fe6f11e1003 (patch) | |
tree | 6fb0a31f6527c0c33e257dc64b0821cb2035600c /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | 01c8e0233d086354b55d2047506ac6a8fc3c9f65 (diff) |
Make the code do what the comment says it does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 35bfae8121..96ed932eda 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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()) |