[llvm] [VPlan] Assert VPRegionValues are not used VPTransformState::get (NFC) (PR #199420)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 20 03:28:27 PDT 2026
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/199420
>From 0314da01fe2adb78ed39827ae8bf90e3c855acf1 Mon Sep 17 00:00:00 2001
From: Florian Hahn <flo at fhahn.com>
Date: Sun, 24 May 2026 14:36:49 +0100
Subject: [PATCH 1/2] [VPlan] Assert VPRegionValues are not used
VPTransformState::get (NFC)
VPRegionValues must be replaced with concrete VPValues before execute
and never passed to VPTransformState::get. Add assert to guard against
violations.
---
llvm/lib/Transforms/Vectorize/VPlan.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index d2a1161984d9a..99d03eca762db 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -279,6 +279,8 @@ VPTransformState::VPTransformState(const TargetTransformInfo *TTI,
CurrentParentLoop(CurrentParentLoop), TypeAnalysis(*Plan), VPDT(*Plan) {}
Value *VPTransformState::get(const VPValue *Def, const VPLane &Lane) {
+ assert(!isa<VPRegionValue>(Def) &&
+ "VPRegionValue must be materialized before VPTransformState::get");
if (isa<VPIRValue, VPSymbolicValue>(Def))
return Def->getUnderlyingValue();
@@ -311,6 +313,8 @@ Value *VPTransformState::get(const VPValue *Def, const VPLane &Lane) {
}
Value *VPTransformState::get(const VPValue *Def, bool NeedsScalar) {
+ assert(!isa<VPRegionValue>(Def) &&
+ "VPRegionValue must be materialized before VPTransformState::get");
if (NeedsScalar) {
assert((VF.isScalar() || isa<VPIRValue, VPSymbolicValue>(Def) ||
hasVectorValue(Def) || !vputils::onlyFirstLaneUsed(Def) ||
>From 0a2cea527c925dd0e98a8455c8256a4954e20f24 Mon Sep 17 00:00:00 2001
From: Florian Hahn <flo at fhahn.com>
Date: Mon, 20 Jul 2026 11:04:04 +0100
Subject: [PATCH 2/2] !fixup add note to VPRegionValue declaration
---
llvm/lib/Transforms/Vectorize/VPlanValue.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index 738902519fe90..b318c38c796a3 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -246,7 +246,9 @@ class VPSymbolicValue : public VPValue {
}
};
-/// VPValues defined by a VPRegionBlock, like the canonical IV.
+/// VPValues are defined by a VPRegionBlock, like the canonical IV. They must
+/// be materialized when the containing region is dissolved, before VPlan
+/// execution.
class VPRegionValue : public VPSymbolicValue {
VPRegionBlock *DefiningRegion;
DebugLoc DL;
More information about the llvm-commits
mailing list