(or (icmp eq X, 0), (icmp eq X, Pow2OrZero))
--> `(icmp eq (and X, Pow2OrZero), X)`
(and (icmp ne X, 0), (icmp ne X, Pow2OrZero))
--> `(icmp ne (and X, Pow2OrZero), X)`
goldstein.w.n on Aug 7 2023, 10:50 AM.Authored by
Not sure we should do this transform in IR. The original form seems to be a lot simpler to reason about than the new one -- e.g. if you have that as condition, it's obvious that %x can't be zero (as there's an explicit check for it). Afterwards, that would be fairly hard to determine.
Really? We have a fair amount of logic for X & Y eq/ne ... and we do this fold already for constants (and similiar folds for non-constants).