[llvm] da6ca20 - [VPlan] Strip vp_post_order_{deep, shallow} (NFC) (#192787)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 07:59:00 PDT 2026


Author: Ramkumar Ramachandra
Date: 2026-04-18T15:58:56+01:00
New Revision: da6ca203a677f51764cc9dfa1bbc9660a5c199e3

URL: https://github.com/llvm/llvm-project/commit/da6ca203a677f51764cc9dfa1bbc9660a5c199e3
DIFF: https://github.com/llvm/llvm-project/commit/da6ca203a677f51764cc9dfa1bbc9660a5c199e3.diff

LOG: [VPlan] Strip vp_post_order_{deep,shallow} (NFC) (#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.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanCFG.h
    llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp

Removed: 
    


################################################################################
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