This transform is never a pessimization at the IR level (since it
replaces an icmp with another), and has potentiall payoffs:
- It may make the icmp fold away or become loop invariant.
- It may make the A & (L - 1) computation dead.
This shows up in Java, in range checks generated by array accesses of
the form a[i & (a.length - 1)].
Is it just me, or does this never even look at the RHS of the comparison?
It seems to be matching the following, despite the comment: A & (L - 1) ult M -> L != 0 for any M.