[llvm] [LoopVectorize] Enable vectorisation of early exit loops with live-outs (PR #120567)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 03:47:53 PST 2025


================
@@ -306,6 +306,24 @@ template <> struct GraphTraits<VPlan *> {
   }
 };
 
+inline bool VPlan::isExitBlock(VPBlockBase *VPBB) {
+  if (!isa<VPIRBasicBlock>(VPBB) || VPBB->getNumSuccessors() ||
+      VPBB == getScalarHeader())
+    return false;
+
+  VPRegionBlock *RegionBlock = getVectorLoopRegion();
+  if (!RegionBlock)
+    return false;
+
+  // The block must be a successor of the region block.
+  for (auto *OtherVPBB :
----------------
huntergr-arm wrote:

nit: `return any_of(vp_depth_first_shallow(RegionBlock->getSingleSuccessor()), ...` would be a bit neater.

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


More information about the llvm-commits mailing list