Skip to content

Commit 7f59b4e

Browse files
committed
[VPlan] Skip non-induction phi recipes in legalizeAndOptimizeInductions.
The body of the loop only applies to wide induction recipes, skip any other header phi recipes up-frond
1 parent 2914ba1 commit 7f59b4e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,9 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
592592
bool HasOnlyVectorVFs = !Plan.hasVF(ElementCount::getFixed(1));
593593
VPBuilder Builder(HeaderVPBB, HeaderVPBB->getFirstNonPhi());
594594
for (VPRecipeBase &Phi : HeaderVPBB->phis()) {
595-
auto *PhiR = dyn_cast<VPHeaderPHIRecipe>(&Phi);
595+
auto *PhiR = dyn_cast<VPWidenInductionRecipe>(&Phi);
596596
if (!PhiR)
597-
break;
597+
continue;
598598

599599
// Check if any uniform VPReplicateRecipes using the phi recipe are used by
600600
// ExtractFromEnd. Those must be replaced by a regular VPReplicateRecipe to
@@ -641,9 +641,7 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
641641

642642
// Replace widened induction with scalar steps for users that only use
643643
// scalars.
644-
auto *WideIV = dyn_cast<VPWidenIntOrFpInductionRecipe>(&Phi);
645-
if (!WideIV)
646-
continue;
644+
auto *WideIV = cast<VPWidenIntOrFpInductionRecipe>(&Phi);
647645
if (HasOnlyVectorVFs && none_of(WideIV->users(), [WideIV](VPUser *U) {
648646
return U->usesScalars(WideIV);
649647
}))

0 commit comments

Comments
 (0)