[llvm] ec22b1a - [VPlan] Iterate over blocks in VPlan::execute in RPOT (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 7 02:20:07 PST 2024


Author: Florian Hahn
Date: 2024-12-07T10:19:27Z
New Revision: ec22b1ab47828677b1a5fe035e13d3c8ccd50998

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

LOG: [VPlan] Iterate over blocks in VPlan::execute in RPOT (NFC).

This prepares for more complex CFGs in VPlan, as in
    https://github.com/llvm/llvm-project/pull/114292
    https://github.com/llvm/llvm-project/pull/112138

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index bfe93c36077dcf..15a9db8eb0c64f 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1033,8 +1033,11 @@ void VPlan::execute(VPTransformState *State) {
   State->CFG.DTU.applyUpdates(
       {{DominatorTree::Delete, ScalarPh, ScalarPh->getSingleSuccessor()}});
 
-  // Generate code in the loop pre-header and body.
-  for (VPBlockBase *Block : vp_depth_first_shallow(Entry))
+  ReversePostOrderTraversal<VPBlockShallowTraversalWrapper<VPBlockBase *>> RPOT(
+      Entry);
+  // Generate code for the VPlan, in parts of the vector skeleton, loop body and
+  // successor blocks including the middle, exit and scalar preheader blocks.
+  for (VPBlockBase *Block : RPOT)
     Block->execute(State);
 
   VPBasicBlock *LatchVPBB = getVectorLoopRegion()->getExitingBasicBlock();


        


More information about the llvm-commits mailing list