cache result of operator*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif
2010-07-09 15:40:10 +00:00
parent 7556cf541b
commit 7656018c22
2 changed files with 10 additions and 7 deletions
+7 -5
View File
@@ -1118,17 +1118,19 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
Constant *One = ConstantInt::get(Ty, 1);
for (pred_iterator HPI = pred_begin(Header), HPE = pred_end(Header);
HPI != HPE; ++HPI)
if (L->contains(*HPI)) {
HPI != HPE; ++HPI) {
BasicBlock *HP = *HPI;
if (L->contains(HP)) {
// Insert a unit add instruction right before the terminator
// corresponding to the back-edge.
Instruction *Add = BinaryOperator::CreateAdd(PN, One, "indvar.next",
(*HPI)->getTerminator());
HP->getTerminator());
rememberInstruction(Add);
PN->addIncoming(Add, *HPI);
PN->addIncoming(Add, HP);
} else {
PN->addIncoming(Constant::getNullValue(Ty), *HPI);
PN->addIncoming(Constant::getNullValue(Ty), HP);
}
}
}
// {0,+,F} --> {0,+,1} * F