@@ -2449,12 +2449,9 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
24492449 } else if (!SE.isKnownPredicate (CmpInst::getInversePredicate (P),
24502450 TripCountSCEV, SE.getSCEV (Step))) {
24512451 // Generate the minimum iteration check only if we cannot prove the
2452- // check is known to be true, or known to be false
2452+ // check is known to be true, or known to be false.
24532453 CheckMinIters = Builder.CreateICmp (P, Count, Step, " min.iters.check" );
2454-
2455- // else step is known to be smaller than trip count, use CheckMinIters
2456- // preset to false.
2457- }
2454+ } // else step known to be < trip count, use CheckMinIters preset to false.
24582455 } else if (VF.isScalable () &&
24592456 !isIndvarOverflowCheckKnownFalse (Cost, VF, UF) &&
24602457 Style != TailFoldingStyle::DataAndControlFlowWithoutRuntimeCheck) {
@@ -2470,11 +2467,12 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
24702467 Value *Step = CreateStep ();
24712468#ifndef NDEBUG
24722469 ScalarEvolution &SE = *PSE.getSE ();
2473- const SCEV *TripCountSCEV = SE.applyLoopGuards (SE.getSCEV (LHS), OrigLoop);
2470+ const SCEV *TC2OverflowSCEV = SE.applyLoopGuards (SE.getSCEV (LHS), OrigLoop);
24742471 assert (
2472+ !isIndvarOverflowCheckKnownFalse (Cost, VF * UF) &&
24752473 !SE.isKnownPredicate (CmpInst::getInversePredicate (ICmpInst::ICMP_ULT),
2476- TripCountSCEV , SE.getSCEV (Step)) &&
2477- " SCEV unexpectedly proved overflow check to be known" );
2474+ TC2OverflowSCEV , SE.getSCEV (Step)) &&
2475+ " unexpectedly proved overflow check to be known" );
24782476#endif
24792477 // Don't execute the vector loop if (UMax - n) < (VF * UF).
24802478 CheckMinIters = Builder.CreateICmp (ICmpInst::ICMP_ULT, LHS, Step);
0 commit comments