llvm.org GIT mirror llvm / e178dff
[LFTR] Stylistic cleanup as suggested in last review comment of D62939 [NFC] (Resumbit of r363292 which was reverted along w/an earlier patch) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363877 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 3 months ago
1 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
23872387 linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB,
23882388 const SCEV *ExitCount,
23892389 PHINode *IndVar, SCEVExpander &Rewriter) {
2390 assert(L->getLoopLatch() && "Loop no longer in simplified form?");
2391 assert(isLoopCounter(IndVar, L, SE));
2392 Instruction * const IncVar =
2393 cast(IndVar->getIncomingValueForBlock(L->getLoopLatch()));
2394
23902395 // Initialize CmpIndVar and IVCount to their preincremented values.
23912396 Value *CmpIndVar = IndVar;
23922397 const SCEV *IVCount = ExitCount;
2393
2394 assert(L->getLoopLatch() && "Loop no longer in simplified form?");
23952398
23962399 // If the exiting block is the same as the backedge block, we prefer to
23972400 // compare against the post-incremented value, otherwise we must compare
24032406 // to add a potentially UB introducing use. We need to either a) show
24042407 // the loop test we're modifying is already in post-inc form, or b) show
24052408 // that adding a use must not introduce UB.
2406 Instruction *Inc =
2407 cast(IndVar->getIncomingValueForBlock(L->getLoopLatch()));
24082409 if (ICmpInst *LoopTest = getLoopTest(L, ExitingBB))
2409 SafeToPostInc = LoopTest->getOperand(0) == Inc ||
2410 LoopTest->getOperand(1) == Inc;
2410 SafeToPostInc = LoopTest->getOperand(0) == IncVar ||
2411 LoopTest->getOperand(1) == IncVar;
24112412 if (!SafeToPostInc)
24122413 SafeToPostInc =
2413 mustExecuteUBIfPoisonOnPathTo(Inc, ExitingBB->getTerminator(), DT);
2414 mustExecuteUBIfPoisonOnPathTo(IncVar, ExitingBB->getTerminator(), DT);
24142415 }
24152416 if (SafeToPostInc) {
24162417 // Add one to the "backedge-taken" count to get the trip count.
24212422 // The BackedgeTaken expression contains the number of times that the
24222423 // backedge branches to the loop header. This is one less than the
24232424 // number of times the loop executes, so use the incremented indvar.
2424 CmpIndVar = IndVar->getIncomingValueForBlock(ExitingBB);
2425 CmpIndVar = IncVar;
24252426 }
24262427 }
24272428
24372438 // dynamically dead IV that wraps on the first loop iteration only, which is
24382439 // not covered by the post-inc addrec. (If the new IV was not dynamically
24392440 // dead, it could not be poison on the first iteration in the first place.)
2440 Value *IncVar = IndVar->getIncomingValueForBlock(L->getLoopLatch());
24412441 if (auto *BO = dyn_cast(IncVar)) {
24422442 const SCEVAddRecExpr *AR = cast(SE->getSCEV(IncVar));
24432443 if (BO->hasNoUnsignedWrap())