forked from OSchip/llvm-project
parent
f2c6198eef
commit
2cd8982002
|
@ -705,8 +705,9 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
// variable.
|
// variable.
|
||||||
while (!IndVars.empty()) {
|
while (!IndVars.empty()) {
|
||||||
PHINode *PN = IndVars.back().first;
|
PHINode *PN = IndVars.back().first;
|
||||||
Value *NewVal = Rewriter.expandCodeFor(IndVars.back().second, InsertPt);
|
SCEVAddRecExpr *AR = cast<SCEVAddRecExpr>(IndVars.back().second);
|
||||||
DOUT << "INDVARS: Rewrote IV '" << *IndVars.back().second << "' " << *PN
|
Value *NewVal = Rewriter.expandCodeFor(AR, InsertPt);
|
||||||
|
DOUT << "INDVARS: Rewrote IV '" << *AR << "' " << *PN
|
||||||
<< " into = " << *NewVal << "\n";
|
<< " into = " << *NewVal << "\n";
|
||||||
NewVal->takeName(PN);
|
NewVal->takeName(PN);
|
||||||
|
|
||||||
|
@ -718,9 +719,9 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
UI != UE; ++UI) {
|
UI != UE; ++UI) {
|
||||||
if (isa<SExtInst>(UI) && NoSignedWrap) {
|
if (isa<SExtInst>(UI) && NoSignedWrap) {
|
||||||
SCEVHandle ExtendedStart =
|
SCEVHandle ExtendedStart =
|
||||||
SE->getSignExtendExpr(cast<SCEVAddRecExpr>(IndVars.back().second)->getStart(), LargestType);
|
SE->getSignExtendExpr(AR->getStart(), LargestType);
|
||||||
SCEVHandle ExtendedStep =
|
SCEVHandle ExtendedStep =
|
||||||
SE->getSignExtendExpr(cast<SCEVAddRecExpr>(IndVars.back().second)->getStepRecurrence(*SE), LargestType);
|
SE->getSignExtendExpr(AR->getStepRecurrence(*SE), LargestType);
|
||||||
SCEVHandle ExtendedAddRec =
|
SCEVHandle ExtendedAddRec =
|
||||||
SE->getAddRecExpr(ExtendedStart, ExtendedStep, L);
|
SE->getAddRecExpr(ExtendedStart, ExtendedStep, L);
|
||||||
if (LargestType != UI->getType())
|
if (LargestType != UI->getType())
|
||||||
|
@ -732,9 +733,9 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
}
|
}
|
||||||
if (isa<ZExtInst>(UI) && NoUnsignedWrap) {
|
if (isa<ZExtInst>(UI) && NoUnsignedWrap) {
|
||||||
SCEVHandle ExtendedStart =
|
SCEVHandle ExtendedStart =
|
||||||
SE->getZeroExtendExpr(cast<SCEVAddRecExpr>(IndVars.back().second)->getStart(), LargestType);
|
SE->getZeroExtendExpr(AR->getStart(), LargestType);
|
||||||
SCEVHandle ExtendedStep =
|
SCEVHandle ExtendedStep =
|
||||||
SE->getZeroExtendExpr(cast<SCEVAddRecExpr>(IndVars.back().second)->getStepRecurrence(*SE), LargestType);
|
SE->getZeroExtendExpr(AR->getStepRecurrence(*SE), LargestType);
|
||||||
SCEVHandle ExtendedAddRec =
|
SCEVHandle ExtendedAddRec =
|
||||||
SE->getAddRecExpr(ExtendedStart, ExtendedStep, L);
|
SE->getAddRecExpr(ExtendedStart, ExtendedStep, L);
|
||||||
if (LargestType != UI->getType())
|
if (LargestType != UI->getType())
|
||||||
|
|
Loading…
Reference in New Issue