[llvm] [LV] Initial support for stores in early exit loops (PR #137774)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 07:28:01 PDT 2025


================
@@ -1656,6 +1688,21 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
         return false;
       }
 
+      // For loops with stores.
+      // Record load for analysis by isDereferenceableAndAlignedInLoop
+      // and later by dependence analysis.
+      if (BranchInst *Br = dyn_cast<BranchInst>(BB->getTerminator())) {
+        // FIXME: Handle exit conditions with multiple users, more complex exit
+        //        conditions than br(icmp(load, loop_inv)).
+        ICmpInst *Cmp = dyn_cast<ICmpInst>(Br->getCondition());
----------------
david-arm wrote:

I guess there is no reason to restrict this to integer comparisons, right? It should work fine with `FCmpInst` too.

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


More information about the llvm-commits mailing list