[llvm] [VPlan] Dispatch to multiple exit blocks via middle blocks. (PR #112138)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 02:32:00 PST 2024


================
@@ -1375,6 +1375,17 @@ bool LoopVectorizationLegality::isFixedOrderRecurrence(
 }
 
 bool LoopVectorizationLegality::blockNeedsPredication(BasicBlock *BB) const {
+  // When vectorizing early exits, create predicates for the latch block. The
+  // early exiting block must be a direct predecessor of the latch at the
+  // moment.
+  BasicBlock *Latch = TheLoop->getLoopLatch();
+  if (hasUncountableEarlyExit()) {
+    assert(
+        getUncountableExitingBlocks().size() == 1 &&
----------------
ayalz wrote:

Better have getUncountableExitingBlock() return a single block if one exists, and check/bailout elsewhere if multiple uncountable exiting blocks exist? Introducing getUncountableExitingBlocks() when this case is supported.

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


More information about the llvm-commits mailing list