[llvm] [LoopVectorize] Teach LoopVectorizationLegality about more early exits (PR #107004)
    David Sherwood via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Sep 10 02:04:56 PDT 2024
    
    
  
================
@@ -1442,6 +1486,95 @@ 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);
+    return false;
+  }
+
+  SmallVector<BasicBlock *, 8> ExitingBlocks;
+  TheLoop->getExitingBlocks(ExitingBlocks);
+
+  // Keep a record of all the exiting blocks with exact exit counts, as well as
+  // those with inexact counts.
----------------
david-arm wrote:
Done
https://github.com/llvm/llvm-project/pull/107004
    
    
More information about the llvm-commits
mailing list