Name: sub(and(x, y), or(x, y)) -> neg(xor(x, y)) %or = or i32 %y, %x %and = and i32 %x, %y %sub = sub i32 %and, %or => %sub1 = xor i32 %x, %y %sub = sub i32 0, %sub1 Optimization: sub(and(x, y), or(x, y)) -> neg(xor(x, y)) Done: 1 Optimization is correct!
https://rise4fun.com/Alive/VI6
Found by @lebedev.ri. Also author of the proof.
&& (Op0.hasOneUse() || Op1.hasOneUse())