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