@@ -7213,11 +7213,9 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
72137213 BestVPlan, BestVF, VScale);
72147214 }
72157215
7216- if (!VectorizingEpilogue) {
7217- // Checks are the same for all VPlans, added to BestVPlan only for
7218- // compactness.
7219- attachRuntimeChecks (BestVPlan, ILV.RTChecks , HasBranchWeights);
7220- }
7216+ // Checks are the same for all VPlans, added to BestVPlan only for
7217+ // compactness.
7218+ attachRuntimeChecks (BestVPlan, ILV.RTChecks , HasBranchWeights);
72217219
72227220 // Retrieving VectorPH now when it's easier while VPlan still has Regions.
72237221 VPBasicBlock *VectorPH = cast<VPBasicBlock>(BestVPlan.getVectorPreheader ());
@@ -9248,15 +9246,15 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
92489246void LoopVectorizationPlanner::attachRuntimeChecks (
92499247 VPlan &Plan, GeneratedRTChecks &RTChecks, bool HasBranchWeights) const {
92509248 const auto &[SCEVCheckCond, SCEVCheckBlock] = RTChecks.getSCEVChecks ();
9251- if (SCEVCheckBlock) {
9249+ if (SCEVCheckBlock && SCEVCheckBlock-> hasNPredecessors ( 0 ) ) {
92529250 assert ((!CM.OptForSize ||
92539251 CM.Hints ->getForce () == LoopVectorizeHints::FK_Enabled) &&
92549252 " Cannot SCEV check stride or overflow when optimizing for size" );
92559253 VPlanTransforms::attachCheckBlock (Plan, SCEVCheckCond, SCEVCheckBlock,
92569254 HasBranchWeights);
92579255 }
92589256 const auto &[MemCheckCond, MemCheckBlock] = RTChecks.getMemRuntimeChecks ();
9259- if (MemCheckBlock) {
9257+ if (MemCheckBlock && MemCheckBlock-> hasNPredecessors ( 0 ) ) {
92609258 // VPlan-native path does not do any analysis for runtime checks
92619259 // currently.
92629260 assert ((!EnableVPlanNativePath || OrigLoop->isInnermost ()) &&
0 commit comments