[PATCH] D34870: [InstCombine] Fold (a | b) ^ (~a | ~b) --> ~(a ^ b) and (a & b) ^ (~a & ~b) --> ~(a ^ b)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 00:37:14 PDT 2017


craig.topper created this revision.

I came across this while thinking about what would happen if one of the operands in this xor pattern was itself a inverted (A & ~B) ^ (~A & B)-> (A^B).

The patterns here assume that the (~a | ~b) will be demorganed to ~(a & b) first. Though I wonder if there's a multiple use case that would prevent the demorgan.


https://reviews.llvm.org/D34870

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/Transforms/InstCombine/and-or-not.ll
  test/Transforms/InstCombine/or-xor.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34870.104827.patch
Type: text/x-patch
Size: 6625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170630/01baa32a/attachment.bin>


More information about the llvm-commits mailing list