@@ -2406,24 +2406,21 @@ void VPlanTransforms::simplifyEVLIVs(VPlan &Plan) {
2406
2406
// Find the latch-exiting block and convert to variable-length stepping.
2407
2407
// Before: (branch-on-count CanonicalIVInc, VectorTripCount)
2408
2408
// After: (branch-on-count EVLIVInc, TripCount)
2409
- auto FindLatchExiting = [](VPBasicBlock *Entry) {
2410
- auto Range =
2411
- VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow (Entry));
2412
- auto It = find_if (Range, [&](VPBasicBlock *VPBB) {
2413
- return any_of (VPBB->successors (),
2414
- [&](VPBlockBase *Succ) { return Succ == Entry; });
2415
- });
2416
- return It != Range.end () ? *It : nullptr ;
2417
- };
2418
- VPBasicBlock *LatchExiting = FindLatchExiting (Entry);
2419
- assert (LatchExiting && " LatchExiting is not found" );
2409
+ auto Range =
2410
+ VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow (Entry));
2411
+ auto It = find_if (Range, [&](VPBasicBlock *VPBB) {
2412
+ return any_of (VPBB->successors (),
2413
+ [&](VPBlockBase *Succ) { return Succ == Entry; });
2414
+ });
2415
+ assert ((It != Range.end ()) && " LatchExiting is not found" );
2416
+ VPBasicBlock *LatchExiting = *It;
2420
2417
auto *LatchExitingBr = cast<VPInstruction>(LatchExiting->getTerminator ());
2421
2418
VPValue *ScalarIVInc;
2422
- if (! LatchExitingBr ||
2423
- ! match (LatchExitingBr,
2424
- m_BranchOnCount (m_VPValue (ScalarIVInc),
2425
- m_Specific (&Plan.getVectorTripCount ()))))
2426
- return ;
2419
+ assert ( LatchExitingBr &&
2420
+ match (LatchExitingBr,
2421
+ m_BranchOnCount (m_VPValue (ScalarIVInc),
2422
+ m_Specific (&Plan.getVectorTripCount ()))) &&
2423
+ " Unexpected terminator in EVL loop " ) ;
2427
2424
LatchExitingBr->setOperand (1 , Plan.getTripCount ());
2428
2425
ScalarIVInc->replaceAllUsesWith (EVLIncrement);
2429
2426
VPRecipeBase *IVIncR = ScalarIVInc->getDefiningRecipe ();
0 commit comments