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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 17 07:12:55 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.
+  std::optional<LoadInst *> getEarlyExitLoad() const { return EarlyExitLoad; }
----------------
david-arm wrote:

Given the similarity between getEarlyExitLoad and isConditionCopyRequired, it might be better to rename isConditionCopyRequired to hasEarlyExitLoad? That way `hasEarlyExitLoad` at least reflects what it's actually testing. If you still need a function called `isConditionCopyRequired` you can always have one like this:

```
  bool isConditionCopyRequired() const { return hasEarlyExitLoad(); }
```

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


More information about the llvm-commits mailing list