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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 02:24:45 PDT 2024


================
@@ -898,6 +901,13 @@ class ScalarEvolution {
     return getBackedgeTakenCount(L, ConstantMaximum);
   }
 
+  /// Similar to getConstantMaxBackedgeTakenCount, except it will add a set of
+  /// SCEV predicates to Predicates that are required to be true in order for
+  /// the answer to be correct. Predicates can be checked with run-time
+  /// checks and can be used to perform loop versioning.
+  const SCEV *getPredicatedConstantMaxBackedgeTakenCount(
----------------
david-arm wrote:

True, but it feels a bit unnecessary/artificial to split the patch up given the main motivation for this work is precisely to improve code quality from the vectoriser - see the tests in Transforms/LoopVectorize/load-deref-pred-align.ll. It will obviously benefit PR #88385 too, but as a standalone patch it makes some existing vectorised loops better.

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


More information about the llvm-commits mailing list