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