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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 06:38:46 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;
----------------
fhahn wrote:

The middle-block may or may not be included by `VPBlockUtils::blocksOnly<VPIRBasicBlock>`, but the middle block will never be considered as an exit block, as it has successors.

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


More information about the llvm-commits mailing list