Add urem support to ConstantRange, so we can handle in in LVI. This is an approximate implementation that tries to capture the most useful conditions: If the LHS is always strictly smaller than the RHS, then the urem is a no-op and the result is the same as the LHS range. Otherwise the lower bound is zero and the upper bound is min(LHSMax, RHSMax - 1).
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
While i understand that you can't do a traditional exhaustive test that this produces *identical* results,
can't you at least test that the ConstantRange::urem() is still always conservatively correct?
Comment Actions
LG other than exhaustive test suggestion.
Even in the cases where we can't test that exhaustive test produces identical results,
we should be able to at least test that ConstantRange is conservatively correct,
in the sense that ConstantRange returns a superset of the exhaustive test, no?
Comment Actions
Yup. I've extended TestUnsignedBinOpExhaustive to support checking correctness only and used it here.