[llvm] bdb299a - [VPlan] Simplify code in single scalar transform code (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 28 14:53:30 PDT 2025
Author: Florian Hahn
Date: 2025-06-28T22:53:14+01:00
New Revision: bdb299a67eb863b1b1e6241d7964e7108f1a42aa
URL: https://github.com/llvm/llvm-project/commit/bdb299a67eb863b1b1e6241d7964e7108f1a42aa
DIFF: https://github.com/llvm/llvm-project/commit/bdb299a67eb863b1b1e6241d7964e7108f1a42aa.diff
LOG: [VPlan] Simplify code in single scalar transform code (NFC).
Adjust code as suggested post-commit 3b7b95f78e2.
https://github.com/llvm/llvm-project/commit/3b7b95f78e24aca5175b8f864bfea2953a2dd34f#r160997427
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
llvm/lib/Transforms/Vectorize/VPlanUtils.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 962c789884b57..bcfb889469ea1 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -1220,9 +1220,9 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
vp_depth_first_shallow(Plan.getVectorLoopRegion()->getEntry()))) {
for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
- auto *RepR = dyn_cast<VPReplicateRecipe>(&R);
- if (!RepR && !isa<VPWidenRecipe, VPWidenSelectRecipe>(&R))
+ if (!isa<VPWidenRecipe, VPWidenSelectRecipe, VPReplicateRecipe>(&R))
continue;
+ auto *RepR = dyn_cast<VPReplicateRecipe>(&R);
if (RepR && (RepR->isSingleScalar() || RepR->isPredicated()))
continue;
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.h b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
index 962f676a07b2f..8dcd57f1b3598 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
@@ -69,14 +69,13 @@ inline bool isSingleScalar(const VPValue *VPV) {
return Rep->isSingleScalar() || (PreservesUniformity(Rep->getOpcode()) &&
all_of(Rep->operands(), isSingleScalar));
}
- if (isa<VPWidenGEPRecipe, VPDerivedIVRecipe, VPBlendRecipe>(VPV))
+ if (isa<VPWidenGEPRecipe, VPDerivedIVRecipe, VPBlendRecipe,
+ VPWidenSelectRecipe>(VPV))
return all_of(VPV->getDefiningRecipe()->operands(), isSingleScalar);
if (auto *WidenR = dyn_cast<VPWidenRecipe>(VPV)) {
return PreservesUniformity(WidenR->getOpcode()) &&
all_of(WidenR->operands(), isSingleScalar);
}
- if (auto *WidenR = dyn_cast<VPWidenSelectRecipe>(VPV))
- return all_of(WidenR->operands(), isSingleScalar);
if (auto *VPI = dyn_cast<VPInstruction>(VPV))
return VPI->isSingleScalar() || VPI->isVectorToScalar() ||
(PreservesUniformity(VPI->getOpcode()) &&
More information about the llvm-commits
mailing list