[llvm] [LV] Add initial legality checks for loops with unbound loads. (PR #152422)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 21:44:24 PDT 2025
================
@@ -1760,16 +1760,31 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
assert(LatchBB->getUniquePredecessor() == SingleUncountableExitingBlock &&
"Expected latch predecessor to be the early exiting block");
- // TODO: Handle loops that may fault.
Predicates.clear();
- if (!isDereferenceableReadOnlyLoop(TheLoop, PSE.getSE(), DT, AC,
- &Predicates)) {
+ SmallVector<LoadInst *, 4> NonDerefLoads;
+ if (!isLoopSafeWithLoadOnlyFaults(TheLoop, PSE.getSE(), DT, AC,
+ &NonDerefLoads, &Predicates)) {
reportVectorizationFailure(
"Loop may fault",
- "Cannot vectorize potentially faulting early exit loop",
- "PotentiallyFaultingEarlyExitLoop", ORE, TheLoop);
+ "Cannot vectorize early exit loop with non-load faults",
+ "EarlyExitLoopWithNonLoadFaults", ORE, TheLoop);
----------------
lukel97 wrote:
IIUC if we reach here it's because the loop isn't read only, not necessarily that the stores etc. don't fault?
```suggestion
"Cannot vectorize non-read-only early exit loop",
"NonReadOnlyEarlyExitLoop", ORE, TheLoop);
```
https://github.com/llvm/llvm-project/pull/152422
More information about the llvm-commits
mailing list