[llvm] 439c7ca - [VPlan] Simplify&clarify skipping VPValues in calculateRegisterUse (NFC)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 16 08:24:41 PDT 2026
Author: Florian Hahn
Date: 2026-03-16T15:24:21Z
New Revision: 439c7ca9ad01d7bf3858f79b4c4b553faa998879
URL: https://github.com/llvm/llvm-project/commit/439c7ca9ad01d7bf3858f79b4c4b553faa998879
DIFF: https://github.com/llvm/llvm-project/commit/439c7ca9ad01d7bf3858f79b4c4b553faa998879.diff
LOG: [VPlan] Simplify&clarify skipping VPValues in calculateRegisterUse (NFC)
Split off as suggested in https://github.com/llvm/llvm-project/pull/156262/.
This refactors the code to clarify comments and code, in preparation for #156262.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
index 55f2a626c293a..5adb786475176 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
@@ -455,25 +455,21 @@ SmallVector<VPRegisterUsage, 8> llvm::calculateRegisterUsageForPlan(
// Save the end location of each USE.
for (VPValue *U : R.operands()) {
- auto *DefR = U->getDefiningRecipe();
-
- // Ignore non-recipe values such as arguments, constants, etc.
- // FIXME: Might need some motivation why these values are ignored. If
- // for example an argument is used inside the loop it will increase the
- // register pressure (so shouldn't we add it to LoopInvariants).
- auto *IRV = dyn_cast<VPIRValue>(U);
- if (!DefR && (!IRV || !isa<Instruction>(IRV->getValue())))
- continue;
-
- // If this recipe is outside the loop then record it and continue.
- if (!DefR) {
+ if (auto *DefR = U->getDefiningRecipe()) {
+ // Overwrite previous end points.
+ EndPoint[U] = Idx2Recipe.size();
+ Ends.insert(U);
+ } else if (auto *IRV = dyn_cast<VPIRValue>(U)) {
+ // Ignore non-recipe values such as arguments, constants, etc.
+ // FIXME: Might need some motivation why these values are ignored. If
+ // for example an argument is used inside the loop it will increase
+ // the register pressure (so shouldn't we add it to LoopInvariants).
+ if (!isa<Instruction>(IRV->getValue()))
+ continue;
+ // This recipe is outside the loop, record it and continue.
LoopInvariants.insert(U);
- continue;
}
-
- // Overwrite previous end points.
- EndPoint[U] = Idx2Recipe.size();
- Ends.insert(U);
+ // Other types of VPValue are currently not tracked.
}
}
if (VPBB == LoopRegion->getExiting()) {
More information about the llvm-commits
mailing list