Add URem support to SCEV.
In LLVM IR the following code:
%r = urem <ty> %t, %b
is equivalent to:
%q = udiv <ty> %t, %b %s = mul <ty> nuw %q, %b %r = sub <ty> nuw %t, %q ; (t / b) * b + (t % b) = t
As UDiv, Mul and Sub are already supported by SCEV, URem can be implemented with minimal effort this way.
We implement two special cases:
- if %b is 1, the result is always 0
- if %b is a power-of-two, we produce a zext(trunc(%t)) instead