[PATCH] D105865: [ScalarEvolution][NFC] Refactor howManyLessThans

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 01:38:37 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11728
+  if (isLoopEntryGuardedByCond(L, CondGT, RHS,
+                               getMinusSCEV(OrigStart, Stride))) {
+    // FIXME: Missing check:
----------------
Thinking about this a bit more, we might be able to get away with using this path even if we can't prove `RHS > Start - Stride`.  We could use something like `(max(RHS, Start - (Stride - 1)) - (Start - (Stride - 1))) /u Stride`, I think.  Not confident I wrote that exactly right.

Not sure how much that improves things in practice, though; the logic on this path is still predicated on the assumption that `Start - (Stride - 1)` doesn't overflow.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105865/new/

https://reviews.llvm.org/D105865



More information about the llvm-commits mailing list