[PATCH] D70043: [ConstantRange] Add `mulWithNoWrap()` method

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 29 00:22:30 PST 2019


lebedev.ri added a comment.

In D70043#1756686 <https://reviews.llvm.org/D70043#1756686>, @nikic wrote:

> @lebedev.ri Haven't looked too closely at the implementation yet, but
>  my general feeling is that trying this hard to be precise about the
>  empty set case is a bad tradeoff in terms of utility vs compilation time.




> Note in particular that a) we don't actually make use of empty sets in CVP
>  (I believe they map to overdefined rather than undefined)
>  and b) all the remaining calculations are only precise for non-wrapping sets
>  (and the tests only check that).

Aha, indeed. https://godbolt.org/z/N3KggA Interesting.

To not lose all that "mul is guaranteed to wrap" logic,
should i move it into `signedMulMayOverflow()` instead of just completely dropping?

> I think it would make more sense to move the AllOverflow check in the
>  to !isWrappedSet branches in the tests, which should make it possible
>  to use a more naive, but for practical purposes probably equally good, implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70043





More information about the llvm-commits mailing list