[PATCH] InstCombine ((x | ~y) ^ (~x ^ y)) to (x & ~y)
Richard Smith
richard at metafoo.co.uk
Fri Aug 22 12:11:52 PDT 2014
On Fri, Aug 22, 2014 at 11:14 AM, David Majnemer <david.majnemer at gmail.com>
wrote:
> This can be generalized:
>
> `(X | (Y ^ Z)) ^ ((X ^ Z) ^ Y)` -> `X & (Y ^ Z)`
Is matching that really the right approach? I would (perhaps naively) think
we should instead CSE that to
(X | A) ^ X ^ A (with A = Y ^ Z)
... and we should be able to perform these more primitive transformations:
(X | A) ^ X -> ~X & A
(~X & A) ^ A -> X & A
... which together reduce your expression to X & (Y ^ Z). Perhaps one of
those takes us further from canonical form, though. What are the rules for
canonicity here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140822/25052704/attachment.html>
More information about the llvm-commits
mailing list