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

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 07:26:41 PDT 2025


================
@@ -407,6 +407,13 @@ class LoopVectorizationLegality {
     return hasUncountableEarlyExit() ? getUncountableEdge()->second : nullptr;
   }
 
+  /// Returns true if this is an early exit loop containing a store.
+  bool isConditionCopyRequired() const { return RequiresEarlyExitConditionCopy; }
----------------
huntergr-arm wrote:

The store can be anywhere in the loop, since we either execute a full vector iteration as normal or we bail out to the scalar tail if an exit would occur in the middle.

We need to do this for all exits, so a single transformation to copy and reorder the exit condition IR is sufficient.

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


More information about the llvm-commits mailing list