[llvm] [VPlan] Strip redundant code in VPTransformState::get (NFC) (PR #166145)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 08:35:56 PST 2025
https://github.com/artagnon updated https://github.com/llvm/llvm-project/pull/166145
>From 596b9d1f0065bc339076efe873afd9b94ace30d7 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Mon, 3 Nov 2025 10:16:40 +0000
Subject: [PATCH 1/2] [VPlan] Strip bad assert in VPTransformState::get (NFC)
The assert only currently holds by chance, as vputils::isSingleScalar
handles a lot more recipes.
---
llvm/lib/Transforms/Vectorize/VPlan.cpp | 5 -----
1 file changed, 5 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 428a8f4c1348f..5b712d796496a 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -308,11 +308,6 @@ Value *VPTransformState::get(const VPValue *Def, bool NeedsScalar) {
VPLane LastLane(IsSingleScalar ? 0 : VF.getFixedValue() - 1);
// Check if there is a scalar value for the selected lane.
if (!hasScalarValue(Def, LastLane)) {
- // At the moment, VPWidenIntOrFpInductionRecipes, VPScalarIVStepsRecipes and
- // VPExpandSCEVRecipes can also be a single scalar.
- assert((isa<VPWidenIntOrFpInductionRecipe, VPScalarIVStepsRecipe,
- VPExpandSCEVRecipe>(Def->getDefiningRecipe())) &&
- "unexpected recipe found to be invariant");
IsSingleScalar = true;
LastLane = 0;
}
>From e8e57d57f7019dfe3a81d0a06224d67f303340f8 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Tue, 4 Nov 2025 16:34:11 +0000
Subject: [PATCH 2/2] [VPlan] Strip entire block
---
llvm/lib/Transforms/Vectorize/VPlan.cpp | 6 ------
1 file changed, 6 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 5b712d796496a..dd26a059d56ad 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -304,13 +304,7 @@ Value *VPTransformState::get(const VPValue *Def, bool NeedsScalar) {
}
bool IsSingleScalar = vputils::isSingleScalar(Def);
-
VPLane LastLane(IsSingleScalar ? 0 : VF.getFixedValue() - 1);
- // Check if there is a scalar value for the selected lane.
- if (!hasScalarValue(Def, LastLane)) {
- IsSingleScalar = true;
- LastLane = 0;
- }
// We need to construct the vector value for a single-scalar value by
// broadcasting the scalar to all lanes.
More information about the llvm-commits
mailing list