aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-28 21:01:47 +0000
committerDan Gohman <gohman@apple.com>2009-09-28 21:01:47 +0000
commitf3f1be6f065d1b90afe80ca80c9d6473c10deb5a (patch)
tree66f177717cd65358fcfc81281c7cbf02b9b22175 /lib/Analysis
parent18f0c263e65da094ef5ba49bb7f66f58cf1cbd0f (diff)
downloadexternal_llvm-f3f1be6f065d1b90afe80ca80c9d6473c10deb5a.zip
external_llvm-f3f1be6f065d1b90afe80ca80c9d6473c10deb5a.tar.gz
external_llvm-f3f1be6f065d1b90afe80ca80c9d6473c10deb5a.tar.bz2
When extending the operands of an addrec, iterate through all
the operands, rather than trying to partition them into a start and a step. This handles non-affine add recurrences correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index 02cfed7..f5df026 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -620,11 +620,11 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
if (CanonicalIV &&
SE.getTypeSizeInBits(CanonicalIV->getType()) >
SE.getTypeSizeInBits(Ty)) {
- const SCEV *Start = SE.getAnyExtendExpr(S->getStart(),
- CanonicalIV->getType());
- const SCEV *Step = SE.getAnyExtendExpr(S->getStepRecurrence(SE),
- CanonicalIV->getType());
- Value *V = expand(SE.getAddRecExpr(Start, Step, S->getLoop()));
+ const SmallVectorImpl<const SCEV *> &Ops = S->getOperands();
+ SmallVector<const SCEV *, 4> NewOps(Ops.size());
+ for (unsigned i = 0, e = Ops.size(); i != e; ++i)
+ NewOps[i] = SE.getAnyExtendExpr(Ops[i], CanonicalIV->getType());
+ Value *V = expand(SE.getAddRecExpr(NewOps, S->getLoop()));
BasicBlock *SaveInsertBB = Builder.GetInsertBlock();
BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint();
BasicBlock::iterator NewInsertPt =