4 Commits

Author SHA1 Message Date
Noah Goldstein
124547eae8 [ValueTracking] Use KnownBits::sdiv for sdiv opcode in computeKnownBits
We now of an implementation of `KnownBits::sdiv` so we can implement
this case.

Differential Revision: https://reviews.llvm.org/D150096
2023-05-16 18:58:12 -05:00
Noah Goldstein
99795afb28 [ValueTracking] Pass exact flag to KnownBits::udiv in computeKnownBits
This information was previously missing but we can use it for
determining the low-bits.

Differential Revision: https://reviews.llvm.org/D150095
2023-05-16 18:58:12 -05:00
Noah Goldstein
7d05ab99ed [KnownBits] Improve KnownBits::udiv
We can more precisely determine the upper bits doing `MaxNum /
MinDenum` as opposed to only using the MSB.

As well, if the `exact` flag is set, we can sometimes determine some
of the low-bits.

Differential Revision: https://reviews.llvm.org/D150094
2023-05-16 18:58:12 -05:00
Noah Goldstein
53a079c8f7 [ValueTracking] Add tests for knownbits of sdiv and udiv; NFC
Differential Revision: https://reviews.llvm.org/D150092
2023-05-16 18:58:12 -05:00