@@ -1665,7 +1665,7 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
16651665
16661666 // Keep a record of all the exiting blocks.
16671667 SmallVector<const SCEVPredicate *, 4 > Predicates;
1668- std::optional<std::pair< BasicBlock *, BasicBlock *>> SingleUncountableEdge ;
1668+ BasicBlock *SingleUncountableExitingBlock = nullptr ;
16691669 for (BasicBlock *BB : ExitingBlocks) {
16701670 const SCEV *EC =
16711671 PSE.getSE ()->getPredicatedExitCount (TheLoop, BB, &Predicates);
@@ -1687,15 +1687,15 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
16871687 ExitBlock = Succs[1 ];
16881688 }
16891689
1690- if (SingleUncountableEdge ) {
1690+ if (SingleUncountableExitingBlock ) {
16911691 reportVectorizationFailure (
16921692 " Loop has too many uncountable exits" ,
16931693 " Cannot vectorize early exit loop with more than one early exit" ,
16941694 " TooManyUncountableEarlyExits" , ORE, TheLoop);
16951695 return false ;
16961696 }
16971697
1698- SingleUncountableEdge = {BB, ExitBlock} ;
1698+ SingleUncountableExitingBlock = BB ;
16991699 } else
17001700 CountableExitingBlocks.push_back (BB);
17011701 }
@@ -1705,15 +1705,15 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
17051705 // PSE.getSymbolicMaxBackedgeTakenCount() below.
17061706 Predicates.clear ();
17071707
1708- if (!SingleUncountableEdge ) {
1708+ if (!SingleUncountableExitingBlock ) {
17091709 LLVM_DEBUG (dbgs () << " LV: Cound not find any uncountable exits" );
17101710 return false ;
17111711 }
17121712
17131713 // The only supported early exit loops so far are ones where the early
17141714 // exiting block is a unique predecessor of the latch block.
17151715 BasicBlock *LatchPredBB = LatchBB->getUniquePredecessor ();
1716- if (LatchPredBB != SingleUncountableEdge-> first ) {
1716+ if (LatchPredBB != SingleUncountableExitingBlock ) {
17171717 reportVectorizationFailure (" Early exit is not the latch predecessor" ,
17181718 " Cannot vectorize early exit loop" ,
17191719 " EarlyExitNotLatchPredecessor" , ORE, TheLoop);
@@ -1766,7 +1766,7 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
17661766 }
17671767
17681768 // The vectoriser cannot handle loads that occur after the early exit block.
1769- assert (LatchBB->getUniquePredecessor () == SingleUncountableEdge-> first &&
1769+ assert (LatchBB->getUniquePredecessor () == SingleUncountableExitingBlock &&
17701770 " Expected latch predecessor to be the early exiting block" );
17711771
17721772 // TODO: Handle loops that may fault.
@@ -1789,7 +1789,7 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
17891789 LLVM_DEBUG (dbgs () << " LV: Found an early exit loop with symbolic max "
17901790 " backedge taken count: "
17911791 << *SymbolicMaxBTC << ' \n ' );
1792- UncountableEdge = SingleUncountableEdge ;
1792+ UncountableExitingBB = SingleUncountableExitingBlock ;
17931793 return true ;
17941794}
17951795
@@ -1861,7 +1861,8 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) {
18611861 return false ;
18621862 } else {
18631863 if (!isVectorizableEarlyExitLoop ()) {
1864- UncountableEdge = std::nullopt ;
1864+ assert (!hasUncountableEarlyExit () &&
1865+ " Must be false without vectorizable early-exit loop" );
18651866 if (DoExtraAnalysis)
18661867 Result = false ;
18671868 else
0 commit comments