[llvm-commits] [llvm] r83011 - /llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
Dan Gohman
gohman at apple.com
Mon Sep 28 14:01:48 PDT 2009
Author: djg
Date: Mon Sep 28 16:01:47 2009
New Revision: 83011
URL: http://llvm.org/viewvc/llvm-project?rev=83011&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=83011&r1=83010&r2=83011&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Mon Sep 28 16:01:47 2009
@@ -620,11 +620,11 @@
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 =
More information about the llvm-commits
mailing list