[llvm] [LoopVectorize] Add support for vectorisation of more early exit loops (PR #88385)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 04:10:25 PDT 2024
================
@@ -1439,6 +1496,103 @@ bool LoopVectorizationLegality::canVectorizeLoopNestCFG(
return Result;
}
+void LoopVectorizationLegality::recordExitingBlocks() {
+ SmallVector<BasicBlock *, 8> ExitingBlocks;
+ TheLoop->getExitingBlocks(ExitingBlocks);
+
+ SmallVector<BasicBlock *, 4> CountableExitingBBs;
+ PSE.getSE()->getCountableExitingBlocks(TheLoop, &CountableExitingBBs);
----------------
huntergr-arm wrote:
I don't think we need to add this method to ScalarEvolution; I tried the following and all tests still passed:
```
for (BasicBlock *BB1 : ExitingBlocks)
if (isa<SCEVCouldNotCompute>(PSE.getSE()->getExitCount(TheLoop, BB1)))
UncountableExitingBlocks.push_back(BB1);
else
CountableExitingBlocks.push_back(BB1);
```
If there is a difference in semantics (maybe about the predicates?) then could you please add a test to demonstrate.
https://github.com/llvm/llvm-project/pull/88385
More information about the llvm-commits
mailing list