From edfe9b61156815dcc4b5f95e2ea1ef527461b550 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sun, 23 Nov 2025 22:11:38 +0000 Subject: [PATCH 1/2] [VPlan] Treat VPVector(End)PointerRecipe as single-scalar, if ops are. VPVector(End)PointerRecipes are single-scalar if all their operands are. This should be effectively NFC currently, but it should re-enable cost checking for some more VPWidenMemoryRecipe after https://github.com/llvm/llvm-project/pull/157387 as discovered by @john-brawn-arm. --- llvm/lib/Transforms/Vectorize/VPlanUtils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp index 939216fe162a4..334ad973c5428 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp @@ -185,7 +185,8 @@ bool vputils::isSingleScalar(const VPValue *VPV) { all_of(Rep->operands(), isSingleScalar)); } if (isa(VPV)) + VPWidenSelectRecipe, VPVectorPointerRecipe, VPVectorEndPointerRecipe>( + VPV)) return all_of(VPV->getDefiningRecipe()->operands(), isSingleScalar); if (auto *WidenR = dyn_cast(VPV)) { return preservesUniformity(WidenR->getOpcode()) && From 96cc4bad890ed02b50475f6ce1bdfbe199b882b3 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Tue, 25 Nov 2025 12:37:23 +0000 Subject: [PATCH 2/2] !fixup treat them always as single-scalar. --- llvm/lib/Transforms/Vectorize/VPlanUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp index 334ad973c5428..839a304904e8b 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp @@ -185,8 +185,7 @@ bool vputils::isSingleScalar(const VPValue *VPV) { all_of(Rep->operands(), isSingleScalar)); } if (isa( - VPV)) + VPWidenSelectRecipe>(VPV)) return all_of(VPV->getDefiningRecipe()->operands(), isSingleScalar); if (auto *WidenR = dyn_cast(VPV)) { return preservesUniformity(WidenR->getOpcode()) && @@ -198,7 +197,8 @@ bool vputils::isSingleScalar(const VPValue *VPV) { all_of(VPI->operands(), isSingleScalar)); if (isa(VPV)) return false; - if (isa(VPV)) + if (isa( + VPV)) return true; if (auto *Expr = dyn_cast(VPV)) return Expr->isSingleScalar();