[llvm] [LoopVectorize] Add support for vectorisation of more early exit loops (PR #88385)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 23:39:04 PDT 2024


================
@@ -1439,6 +1498,74 @@ bool LoopVectorizationLegality::canVectorizeLoopNestCFG(
   return Result;
 }
 
+bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
+  // At least one of the exiting blocks must be the latch.
+  BasicBlock *LatchBB = TheLoop->getLoopLatch();
+  if (!LatchBB) {
+    reportVectorizationFailure("Loop does not have a latch",
+                               "Cannot vectorize early exit loop",
+                               "NoLatchEarlyExit", ORE, TheLoop);
+    LLVM_DEBUG(dbgs() << "LV: Loop does not have a latch.\n");
+    return false;
+  }
+
+  if (!LAI)
+    LAI = &LAIs.getInfo(*TheLoop);
----------------
fhahn wrote:

why is this need?


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


More information about the llvm-commits mailing list