diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-28 21:01:47 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-28 21:01:47 +0000 |
commit | f230656a02524237a5a5dc124b63b5bcf1224024 (patch) | |
tree | 6c7d610ea1a7a0bca155399b1103bf832358cdc9 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | 565371b4c9bbf023259a5a0f5c500a9480787685 (diff) | |
download | bcm5719-llvm-f230656a02524237a5a5dc124b63b5bcf1224024.tar.gz bcm5719-llvm-f230656a02524237a5a5dc124b63b5bcf1224024.zip |
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.
llvm-svn: 83011
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 02cfed7ad01..f5df026c8fa 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/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 = |