[llvm] [VPlan] Generalize collectUsersInExitBlocks for multiple exit bbs. (PR #115066)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 05:48:03 PST 2024


================
@@ -306,6 +306,15 @@ template <> struct GraphTraits<VPlan *> {
   }
 };
 
+inline auto VPlan::getExitBlocks() {
+  VPBlockBase *ScalarHeader = getScalarHeader();
+  return make_filter_range(
+      VPBlockUtils::blocksOnly<VPIRBasicBlock>(
+          vp_depth_first_shallow(getVectorLoopRegion()->getSingleSuccessor())),
+      [ScalarHeader](VPIRBasicBlock *VPIRBB) {
+        return VPIRBB != ScalarHeader && VPIRBB->getNumSuccessors() == 0;
----------------
david-arm wrote:

Yes, because currently isn't the middle block was the single successor of the loop region? Perhaps I've misunderstood what `VPBlockUtils::blocksOnly<VPIRBasicBlock>` does but it looks like it may or may not include the middle block depending upon the timing. In VPlan::execute we replace the VPBasicBlock for the middle block with a VPIRBasicBlock.

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


More information about the llvm-commits mailing list