[llvm] [LV] Allow loops with multiple early exits in legality checks. (PR #176403)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 16 07:37:22 PST 2026


================
@@ -1434,13 +1435,10 @@ bool LoopVectorizationLegality::isFixedOrderRecurrence(
 bool LoopVectorizationLegality::blockNeedsPredication(
     const BasicBlock *BB) const {
   // When vectorizing early exits, create predicates for the latch block only.
-  // The early exiting block must be a direct predecessor of the latch at the
-  // moment.
+  // For a single early exit, it must be a direct predecessor of the latch.
+  // For multiple early exits, they form a chain leading to the latch.
   BasicBlock *Latch = TheLoop->getLoopLatch();
   if (hasUncountableEarlyExit()) {
----------------
david-arm wrote:

nit: I think you remove the braces `{}` now.

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


More information about the llvm-commits mailing list