Name: sub or and to xor %or = or i32 %y, %x %and = and i32 %x, %y %sub = sub i32 %or, %and => %sub = xor i32 %x, %y Optimization: sub or and to xor Done: 1 Optimization is correct!
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
LG.
There's also sub(and(x, y), or(x, y)) -> neg(xor(x, y))
https://rise4fun.com/Alive/VI6
https://godbolt.org/z/OMu71B
/home/xbolva00/LLVM/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | ||
---|---|---|
1724 ↗ | (On Diff #218643) | extra unneeded braces |
test/Transforms/InstCombine/sub-or-and-xor.ll | ||
69–78 | Precommit. |
Comment Actions
Thanks!
There's also sub(and(x, y), or(x, y)) -> neg(xor(x, y))
Ok, I will prepare a patch soon.
Precommit.