@@ -2385,24 +2385,21 @@ void VPlanTransforms::simplifyEVLIVs(VPlan &Plan) {
2385
2385
// Find the latch-exiting block and convert to variable-length stepping.
2386
2386
// Before: (branch-on-count CanonicalIVInc, VectorTripCount)
2387
2387
// After: (branch-on-count EVLIVInc, TripCount)
2388
- auto FindLatchExiting = [](VPBasicBlock *Entry) {
2389
- auto Range =
2390
- VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow (Entry));
2391
- auto It = find_if (Range, [&](VPBasicBlock *VPBB) {
2392
- return any_of (VPBB->successors (),
2393
- [&](VPBlockBase *Succ) { return Succ == Entry; });
2394
- });
2395
- return It != Range.end () ? *It : nullptr ;
2396
- };
2397
- VPBasicBlock *LatchExiting = FindLatchExiting (Entry);
2398
- assert (LatchExiting && " LatchExiting is not found" );
2388
+ auto Range =
2389
+ VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow (Entry));
2390
+ auto It = find_if (Range, [&](VPBasicBlock *VPBB) {
2391
+ return any_of (VPBB->successors (),
2392
+ [&](VPBlockBase *Succ) { return Succ == Entry; });
2393
+ });
2394
+ assert ((It != Range.end ()) && " LatchExiting is not found" );
2395
+ VPBasicBlock *LatchExiting = *It;
2399
2396
auto *LatchExitingBr = cast<VPInstruction>(LatchExiting->getTerminator ());
2400
2397
VPValue *ScalarIVInc;
2401
- if (! LatchExitingBr ||
2402
- ! match (LatchExitingBr,
2403
- m_BranchOnCount (m_VPValue (ScalarIVInc),
2404
- m_Specific (&Plan.getVectorTripCount ()))))
2405
- return ;
2398
+ assert ( LatchExitingBr &&
2399
+ match (LatchExitingBr,
2400
+ m_BranchOnCount (m_VPValue (ScalarIVInc),
2401
+ m_Specific (&Plan.getVectorTripCount ()))) &&
2402
+ " Unexpected terminator in EVL loop " ) ;
2406
2403
LatchExitingBr->setOperand (1 , Plan.getTripCount ());
2407
2404
ScalarIVInc->replaceAllUsesWith (EVLIncrement);
2408
2405
VPRecipeBase *IVIncR = ScalarIVInc->getDefiningRecipe ();
0 commit comments