Reverse the order for collecting the parts of an addrec. The order

doesn't matter, except that ScalarEvolution tends to need less time
to fold the results this way.

llvm-svn: 95979
This commit is contained in:
Dan Gohman 2010-02-12 11:08:26 +00:00
parent c40eb525ad
commit 2f46f79492

View File

@ -1902,10 +1902,10 @@ static void CollectSubexprs(const SCEV *S, const SCEVConstant *C,
} else if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S)) {
// Split a non-zero base out of an addrec.
if (!AR->getStart()->isZero()) {
CollectSubexprs(AR->getStart(), C, Ops, SE);
CollectSubexprs(SE.getAddRecExpr(SE.getIntegerSCEV(0, AR->getType()),
AR->getStepRecurrence(SE),
AR->getLoop()), C, Ops, SE);
CollectSubexprs(AR->getStart(), C, Ops, SE);
return;
}
} else if (const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(S)) {