[llvm] [VPlan] Don't calculate VPDT in non-side-effect early exit loops. NFC (PR #203476)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 00:48:02 PDT 2026
https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/203476
Follow up from https://github.com/llvm/llvm-project/pull/203233/changes/BASE..6c916678df65787d524558919cee233bf2329aa8#r3398107262
>From 0481becd3b76d16d5026af7c2afa15ae6937fe36 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Fri, 12 Jun 2026 15:42:55 +0800
Subject: [PATCH] [VPlan] Don't calculate VPDT in non-side-effect early exit
loops. NFC
Follow up from https://github.com/llvm/llvm-project/pull/203233/changes/BASE..6c916678df65787d524558919cee233bf2329aa8#r3398107262
---
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index cd0fddd4489d8..f2984267e776c 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -4235,7 +4235,7 @@ static bool handleUncountableExitsWithSideEffects(
VPlan &Plan, SmallVectorImpl<EarlyExitInfo> &Exits,
VPBasicBlock *HeaderVPBB, VPBasicBlock *LatchVPBB, VPBasicBlock *MiddleVPBB,
Loop *TheLoop, PredicatedScalarEvolution &PSE, DominatorTree &DT,
- AssumptionCache *AC, VPDominatorTree &VPDT) {
+ AssumptionCache *AC) {
// Disconnect early exiting blocks from successors, remove branches. We
// currently don't support multiple uses for recipes involved in creating
@@ -4250,7 +4250,7 @@ static bool handleUncountableExitsWithSideEffects(
VPBlockUtils::disconnectBlocks(Exit.EarlyExitingVPBB, Exit.EarlyExitVPBB);
}
- VPDT.recalculate(Plan);
+ VPDominatorTree VPDT(Plan);
// We can abandon a VPlan entirely if we return false here, so we shouldn't
// crash if some earlier assumptions on scalar IR don't hold for the vplan
@@ -4391,7 +4391,9 @@ bool VPlanTransforms::handleUncountableEarlyExits(
VPlan &Plan, VPBasicBlock *HeaderVPBB, VPBasicBlock *LatchVPBB,
VPBasicBlock *MiddleVPBB, Loop *TheLoop, PredicatedScalarEvolution &PSE,
DominatorTree &DT, AssumptionCache *AC, UncountableExitStyle Style) {
+#ifndef NDEBUG
VPDominatorTree VPDT(Plan);
+#endif
VPBuilder LatchBuilder(LatchVPBB->getTerminator());
SmallVector<EarlyExitInfo> Exits;
for (VPIRBasicBlock *ExitBlock : Plan.getExitBlocks()) {
@@ -4483,9 +4485,8 @@ bool VPlanTransforms::handleUncountableEarlyExits(
LatchVPBB->setSuccessors({MiddleVPBB, MiddleVPBB, HeaderVPBB});
MiddleVPBB->clearPredecessors();
MiddleVPBB->setPredecessors({LatchVPBB, LatchVPBB});
- return handleUncountableExitsWithSideEffects(Plan, Exits, HeaderVPBB,
- LatchVPBB, MiddleVPBB, TheLoop,
- PSE, DT, AC, VPDT);
+ return handleUncountableExitsWithSideEffects(
+ Plan, Exits, HeaderVPBB, LatchVPBB, MiddleVPBB, TheLoop, PSE, DT, AC);
}
// Create the vector.early.exit blocks.
More information about the llvm-commits
mailing list