[PATCH] D33050: [InstCombine] remove fold that swaps xor/or with constants

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 13:33:33 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D33050#751261, @efriedma wrote:

> It's a canonicalization of sorts; could help pick up more complicated patterns like `((a ^ c1) | c2) ^ c3`.  Please make sure we have a regression test like this for instcombine.
>
> https://reviews.llvm.org/rL7264 for reference.


Ah, the commit message makes the motivation clear - we want to sink xors down/out, so it's easier to combine the constant operands. There's surprisingly little regression testing for this (otherwise, I would've found the inf-loop potential of https://reviews.llvm.org/rL300977 sooner!). I'll add tests. For reference, the 'and' side of https://reviews.llvm.org/rL7264 was removed here:
https://reviews.llvm.org/rL299384


https://reviews.llvm.org/D33050





More information about the llvm-commits mailing list