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

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 05:28:31 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-vectorizers

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/192787.diff


2 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/VPlanCFG.h (-14) 
- (modified) llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp (+3-1) 


``````````diff
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);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/192787


More information about the llvm-commits mailing list