[llvm] [VPlan] Strip vp_post_order_{deep,shallow} (NFC) (PR #192787)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 05:27:58 PDT 2026
https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/192787
Post 691a130 ([ADT] Refactor post order traversal, #191047), PostOrderTraversal's lifetime needs to exceed the lifetime of the iterator. The vp_post_order_{deep,shallow} helpers now have the potential for being used incorrectly: hence, strip them, and require the PostOrderTraversal to be constructed explictly, similar to RPOT.
>From 4ebb57e481ecfaf16626ce74e64f2b164cd6349b Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <artagnon at tenstorrent.com>
Date: Sat, 18 Apr 2026 13:22:16 +0100
Subject: [PATCH] [VPlan] Strip vp_post_order_{deep,shallow} (NFC)
Post 691a130 ([ADT] Refactor post order traversal, #191047),
PostOrderTraversal's lifetime needs to exceed the lifetime of the
iterator. The vp_post_order_{deep,shallow} helpers now have the
potential for being used incorrectly: hence, strip them, and require the
PostOrderTraversal to be constructed explictly, similar to RPOT.
---
llvm/lib/Transforms/Vectorize/VPlanCFG.h | 14 --------------
.../lib/Transforms/Vectorize/VPlanConstruction.cpp | 4 +++-
2 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanCFG.h b/llvm/lib/Transforms/Vectorize/VPlanCFG.h
index 58e43a9d81809..451e9a387920f 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanCFG.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanCFG.h
@@ -259,20 +259,6 @@ vp_depth_first_shallow(const VPBlockBase *G) {
return depth_first(VPBlockShallowTraversalWrapper<const VPBlockBase *>(G));
}
-/// Returns an iterator range to traverse the graph starting at \p G in
-/// post order. The iterator won't traverse through region blocks.
-inline PostOrderTraversal<VPBlockShallowTraversalWrapper<VPBlockBase *>>
-vp_post_order_shallow(VPBlockBase *G) {
- return post_order(VPBlockShallowTraversalWrapper<VPBlockBase *>(G));
-}
-
-/// Returns an iterator range to traverse the graph starting at \p G in
-/// post order while traversing through region blocks.
-inline PostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>>
-vp_post_order_deep(VPBlockBase *G) {
- return post_order(VPBlockDeepTraversalWrapper<VPBlockBase *>(G));
-}
-
/// Returns an iterator range to traverse the graph starting at \p G in
/// depth-first order while traversing through region blocks.
inline iterator_range<df_iterator<VPBlockDeepTraversalWrapper<VPBlockBase *>>>
diff --git a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
index c9234b88fb084..af0882dfbad8f 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
@@ -1071,7 +1071,9 @@ void VPlanTransforms::addMiddleCheck(VPlan &Plan, bool TailFolded) {
void VPlanTransforms::createLoopRegions(VPlan &Plan) {
VPDominatorTree VPDT(Plan);
- for (VPBlockBase *HeaderVPB : vp_post_order_shallow(Plan.getEntry()))
+ PostOrderTraversal<VPBlockShallowTraversalWrapper<VPBlockBase *>> POT(
+ Plan.getEntry());
+ for (VPBlockBase *HeaderVPB : POT)
if (canonicalHeaderAndLatch(HeaderVPB, VPDT))
createLoopRegion(Plan, HeaderVPB);
More information about the llvm-commits
mailing list