summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-03-02 01:59:21 +0000
committerDan Gohman <gohman@apple.com>2010-03-02 01:59:21 +0000
commit52f55639732cffc7615f71d4f7521a19c1db43d8 (patch)
tree9763a21029cbfbe1eb00941bb29905a8635c3efc /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent78c5b7a76d825f01e8519b5a7fd74a645c4a9ad5 (diff)
downloadbcm5719-llvm-52f55639732cffc7615f71d4f7521a19c1db43d8.tar.gz
bcm5719-llvm-52f55639732cffc7615f71d4f7521a19c1db43d8.zip
Non-affine post-inc SCEV expansions have more code which must be
emitted after the increment. Make sure the insert position reflects this. This fixes PR6453. llvm-svn: 97537
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 8bbf19345ab..14274296de7 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2793,8 +2793,12 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
if (Instruction *I =
dyn_cast<Instruction>(cast<ICmpInst>(LF.UserInst)->getOperand(1)))
Inputs.push_back(I);
- if (LF.PostIncLoop && !L->contains(LF.UserInst))
- Inputs.push_back(L->getLoopLatch()->getTerminator());
+ if (LF.PostIncLoop) {
+ if (!L->contains(LF.UserInst))
+ Inputs.push_back(L->getLoopLatch()->getTerminator());
+ else
+ Inputs.push_back(IVIncInsertPos);
+ }
// Then, climb up the immediate dominator tree as far as we can go while
// still being dominated by the input positions.
OpenPOWER on IntegriCloud