[PATCH] D32725: [InstCombine] Apply deMorgan to (and/or (not cmp1), cmp2) when cmp1 has multiple uses, but cmp2 has a single use

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 17:19:17 PDT 2017


craig.topper created this revision.

This patch applies demorgan when we detect an icmp of 2 cmps where one cmp is inverted, but the not can't be folded into the predicate because the cmp has another usage. If we are able to fold a not into the other cmp, we can do the transform and hope the remaining not can be folded away further up the chain. And even if its not folded away, we haven't increased the number of operations.

I plan to add more test cases in the InstCombine directory before committing this, but wanted to get an opinion on whether it makes sense.

Interestingly, the one test that changed here is for the transformation that caused the extra xors in my test case too.


https://reviews.llvm.org/D32725

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/Transforms/SimplifyCFG/merge-cond-stores.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32725.97370.patch
Type: text/x-patch
Size: 5182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170502/82d8fea7/attachment.bin>


More information about the llvm-commits mailing list