[llvm] [LV] Add initial legality checks for ee loops with stores (PR #145663)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 08:49:02 PDT 2025


================
@@ -407,6 +407,14 @@ class LoopVectorizationLegality {
     return hasUncountableEarlyExit() ? getUncountableEdge()->second : nullptr;
   }
 
+  /// Returns true if this is an early exit loop containing a store.
+  bool isConditionCopyRequired() const { return EarlyExitLoad.has_value(); }
+
+  /// Returns the load instruction, if any, directly used for an exit comparison
+  /// in and early exit loop containing state-changing or potentially-faulting
+  /// operations.
----------------
huntergr-arm wrote:

I've refactored this to no longer keep track of the load in the class, as we only need it during initial analysis and not when actually vectorizing. This does mean I have to pass it as a parameter for a couple of functions, but I think that's ok. It can be expanded to a SmallVector later once we have more than one load contributing to the uncounted exit condition.

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


More information about the llvm-commits mailing list