[llvm] 7aedeba - [VPlan] Populate ExitBlocks when cloning VPlan (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 13:18:00 PDT 2025


Author: Florian Hahn
Date: 2025-04-07T21:17:42+01:00
New Revision: 7aedebac8cb473555aa8a2928ac3851b0142921e

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

LOG: [VPlan] Populate ExitBlocks when cloning VPlan (NFC).

Update VPlan::duplicate to add cloned exit blocks to ExitBlocks.

Currently there are no uses of the exit blocks after cloning so this is
NFC at the moment.

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 bc3957f573d82..4688eef194b32 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1216,6 +1216,13 @@ VPlan *VPlan::duplicate() {
     NewPlan->CreatedBlocks.push_back(this->CreatedBlocks[I]);
   CreatedBlocks.truncate(NumBlocksBeforeCloning);
 
+  // Update ExitBlocks of the new plan.
+  for (VPBlockBase *VPB : NewPlan->CreatedBlocks) {
+    if (VPB->getNumSuccessors() == 0 && isa<VPIRBasicBlock>(VPB) &&
+        VPB != NewScalarHeader)
+      NewPlan->ExitBlocks.push_back(cast<VPIRBasicBlock>(VPB));
+  }
+
   return NewPlan;
 }
 


        


More information about the llvm-commits mailing list