Skip to content

Commit ee61308

Browse files
author
Max Kazantsev
committed
[NFC] Factor out some local vars
llvm-svn: 351416
1 parent ba2a2fb commit ee61308

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,15 +1264,17 @@ LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(
12641264
Increasing
12651265
? (IsSignedPredicate ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT)
12661266
: (IsSignedPredicate ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT);
1267-
EnterLoopCond = B.CreateICmp(Pred, LS.IndVarStart, ExitSubloopAt);
1267+
Value *IndVarStart = LS.IndVarStart;
1268+
Value *IndVarBase = LS.IndVarBase;
1269+
Value *LoopExitAt = LS.LoopExitAt;
1270+
EnterLoopCond = B.CreateICmp(Pred, IndVarStart, ExitSubloopAt);
12681271

12691272
B.CreateCondBr(EnterLoopCond, LS.Header, RRI.PseudoExit);
12701273
PreheaderJump->eraseFromParent();
12711274

12721275
LS.LatchBr->setSuccessor(LS.LatchBrExitIdx, RRI.ExitSelector);
12731276
B.SetInsertPoint(LS.LatchBr);
1274-
Value *TakeBackedgeLoopCond = B.CreateICmp(Pred, LS.IndVarBase,
1275-
ExitSubloopAt);
1277+
Value *TakeBackedgeLoopCond = B.CreateICmp(Pred, IndVarBase, ExitSubloopAt);
12761278

12771279
Value *CondForBranch = LS.LatchBrExitIdx == 1
12781280
? TakeBackedgeLoopCond
@@ -1285,7 +1287,7 @@ LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(
12851287
// IterationsLeft - are there any more iterations left, given the original
12861288
// upper bound on the induction variable? If not, we branch to the "real"
12871289
// exit.
1288-
Value *IterationsLeft = B.CreateICmp(Pred, LS.IndVarBase, LS.LoopExitAt);
1290+
Value *IterationsLeft = B.CreateICmp(Pred, IndVarBase, LoopExitAt);
12891291
B.CreateCondBr(IterationsLeft, RRI.PseudoExit, LS.LatchExit);
12901292

12911293
BranchInst *BranchToContinuation =
@@ -1304,10 +1306,10 @@ LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(
13041306
RRI.PHIValuesAtPseudoExit.push_back(NewPHI);
13051307
}
13061308

1307-
RRI.IndVarEnd = PHINode::Create(LS.IndVarBase->getType(), 2, "indvar.end",
1309+
RRI.IndVarEnd = PHINode::Create(IndVarBase->getType(), 2, "indvar.end",
13081310
BranchToContinuation);
1309-
RRI.IndVarEnd->addIncoming(LS.IndVarStart, Preheader);
1310-
RRI.IndVarEnd->addIncoming(LS.IndVarBase, RRI.ExitSelector);
1311+
RRI.IndVarEnd->addIncoming(IndVarStart, Preheader);
1312+
RRI.IndVarEnd->addIncoming(IndVarBase, RRI.ExitSelector);
13111313

13121314
// The latch exit now has a branch from `RRI.ExitSelector' instead of
13131315
// `LS.Latch'. The PHI nodes need to be updated to reflect that.

0 commit comments

Comments
 (0)