[KnownBits][RISCV] Improve known bits for srem.
The result must be less than or equal to the LHS side, so any leading zeros in the left hand side must also exist in the result. This is stronger than the previous behavior where we only considered the sign bit being 0. The affected test case used the sign bit being known 0 to change a sign extend to a zero extend pre type legalization. After type legalization the types were promoted to i64, but we no longer knew bit 31 was zero. This shifts are are the equivalent of an AND with 0xffffffff or zext_inreg X, i32. This patch allows us to see that bit 31 is zero and remove the shifts. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D97124
Loading
Please register or sign in to comment