[llvm] [Analysis] Teach isDereferenceableAndAlignedInLoop about SCEV predicates (PR #106562)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 03:32:42 PDT 2024


================
@@ -8604,15 +8612,21 @@ 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())
----------------
huntergr-arm wrote:

I think this would benefit from explicit braces to make sure the `else` is associated with the correct `if`. I get a warning from clang as-is.

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


More information about the llvm-commits mailing list