[llvm] [Analysis] Teach isDereferenceableAndAlignedInLoop about SCEV predicates (PR #106562)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 07:59:34 PDT 2024
================
@@ -8604,15 +8612,22 @@ const SCEV *ScalarEvolution::BackedgeTakenInfo::getSymbolicMax(
}
/// getConstantMax - Get the constant max backedge taken count for the loop.
-const SCEV *
-ScalarEvolution::BackedgeTakenInfo::getConstantMax(ScalarEvolution *SE) const {
- auto PredicateNotAlwaysTrue = [](const ExitNotTakenInfo &ENT) {
- return !ENT.hasAlwaysTruePredicate();
- };
-
- if (!getConstantMax() || any_of(ExitNotTaken, PredicateNotAlwaysTrue))
+const SCEV *ScalarEvolution::BackedgeTakenInfo::getConstantMax(
+ ScalarEvolution *SE,
+ SmallVectorImpl<const SCEVPredicate *> *Predicates) const {
+ if (!getConstantMax())
return SE->getCouldNotCompute();
+ for (const auto &ENT : ExitNotTaken)
+ if (!ENT.hasAlwaysTruePredicate()) {
+ if (!Predicates)
+ return SE->getCouldNotCompute();
+ else {
----------------
huntergr-arm wrote:
Thought about it some more, and the else isn't needed. Nor is the loop over the ENT's predicates. :)
```suggestion
Predicates->append(ENT.Predicates.begin(), ENT.Predicates.end());
```
https://github.com/llvm/llvm-project/pull/106562
More information about the llvm-commits
mailing list