[PATCH] D105216: [ScalarEvolution] Fix overflow in computeBECount.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 5 21:27:52 PDT 2021


efriedma added a comment.

In D105216#2858946 <https://reviews.llvm.org/D105216#2858946>, @mkazantsev wrote:

> How much worse does it become if we simply check that `start <= MAX_INT - step` and bail if we can't prove it?

I assume that isn't the expression you meant to write?

Practically, I expect the most important cases to recognize are:

1. Power-of-two stride.
2. Post-increment loops: `Start == Stride`.  (This is a special case of `Start >= Stride - 1`).

I'm not sure how well isLoopEntryGuardedByCond/isKnownViaNonRecursiveReasoning would do if I just throw `Start >= Stride - 1` for unsigned, or the signed equivalent, at it. I can try, I guess.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105216



More information about the llvm-commits mailing list