[llvm] [LoopVectorize] Teach LoopVectorizationLegality about more early exits (PR #107004)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 08:50:07 PDT 2024
================
@@ -1442,6 +1487,126 @@ bool LoopVectorizationLegality::canVectorizeLoopNestCFG(
return Result;
}
+bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
+ // At least one of the exiting blocks must be the latch.
----------------
david-arm wrote:
Hmm, I should move the comment lower down to the code where it's checked:
```
if (isa<SCEVCouldNotCompute>(
PSE.getSE()->getPredicatedExitCount(TheLoop, LatchBB, &Predicates))) {
reportVectorizationFailure(
"Cannot determine exact exit count for latch block",
"Cannot vectorize early exit loop",
"UnknownLatchExitCountEarlyExitLoop", ORE, TheLoop);
return false;
}
```
There is a test for this - see `@early_exit_infinite_loop`
https://github.com/llvm/llvm-project/pull/107004
More information about the llvm-commits
mailing list