[llvm] 7f59b4e - [VPlan] Skip non-induction phi recipes in legalizeAndOptimizeInductions.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 11 12:34:16 PST 2025
Author: Florian Hahn
Date: 2025-01-11T20:33:02Z
New Revision: 7f59b4e9982f92431f3069645dab6171363c3404
URL: https://github.com/llvm/llvm-project/commit/7f59b4e9982f92431f3069645dab6171363c3404
DIFF: https://github.com/llvm/llvm-project/commit/7f59b4e9982f92431f3069645dab6171363c3404.diff
LOG: [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
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 8f6fb07b1e4f27..878db522be1bd3 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -592,9 +592,9 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
bool HasOnlyVectorVFs = !Plan.hasVF(ElementCount::getFixed(1));
VPBuilder Builder(HeaderVPBB, HeaderVPBB->getFirstNonPhi());
for (VPRecipeBase &Phi : HeaderVPBB->phis()) {
- auto *PhiR = dyn_cast<VPHeaderPHIRecipe>(&Phi);
+ auto *PhiR = dyn_cast<VPWidenInductionRecipe>(&Phi);
if (!PhiR)
- break;
+ continue;
// Check if any uniform VPReplicateRecipes using the phi recipe are used by
// ExtractFromEnd. Those must be replaced by a regular VPReplicateRecipe to
@@ -641,9 +641,7 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
// Replace widened induction with scalar steps for users that only use
// scalars.
- auto *WideIV = dyn_cast<VPWidenIntOrFpInductionRecipe>(&Phi);
- if (!WideIV)
- continue;
+ auto *WideIV = cast<VPWidenIntOrFpInductionRecipe>(&Phi);
if (HasOnlyVectorVFs && none_of(WideIV->users(), [WideIV](VPUser *U) {
return U->usesScalars(WideIV);
}))
More information about the llvm-commits
mailing list