[PATCH] D106331: [WIP][ScalarEvolution] Try harder to prove overflow in howManyLessThans.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 21:53:04 PDT 2021


efriedma added a comment.

The easiest thing here would be if SCEV recorded the flags somewhere... but unfortunately, we don't; when we discover the flags aren't universally applicable, we throw them away.  We could try to construct some sort of side-table, I guess, to provide an API `getNoWrapFlagsWithContext(SCEV*, Instruction*)`.  So basically the same logic as this, but factored away.

One alternative I considered is looking at the nowrap flags of the AddRec "IV - Stride".  We do often manage to deduce nsw/nuw, and if the backedge is taken, it proves Start - Stride doesn't overflow.  But if we're doing that, I'm not sure how we prove the case where the backedge isn't taken.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106331



More information about the llvm-commits mailing list