This is an archive of the discontinued LLVM Phabricator instance.

Added InstCombine transform for pattern " ( ( A ^ B ) ^ ( ( ~A ) | B ) -> ( A | ( ~ B ) ) ".
Needs ReviewPublic

Authored by sonamkumari on Aug 21 2014, 2:18 AM.

Details

Summary

Hi All,

This patch implements transform for pattern " ( ( A ^ B ) ^ ( ( ~A ) | B ) -> ( A | ( ~ B ) ) ".

Z3 Link : http://rise4fun.com/Z3/jS88

Please help in reviewing the same.

David,

I tried to generalize the expression for " ( ~ A ) " by using " (A ^ C) " as you mentioned in few of my previous patches. But by doing that, I found the following result.

( ( A ^ B ) ^ ( ( A ^ C ) | B ) -> ( ( A & B) | ( ( ~B ) & C ) )

So, I think by doing this we are not reducing the number of operations. Am I thinking in the right direction.

Your inputs are highly welcomed. :)

Thanks,
Sonam.

Diff Detail

Event Timeline

sonamkumari retitled this revision from to Added InstCombine transform for pattern " ( ( A ^ B ) ^ ( ( ~A ) | B ) -> ( A | ( ~ B ) ) ". .
sonamkumari updated this object.
sonamkumari edited the test plan for this revision. (Show Details)
sonamkumari added a subscriber: Unknown Object (MLST).
majnemer edited edge metadata.Aug 22 2014, 10:49 AM

We actually do a better job CodeGen'ing the ((A & B) | ( ( ~B ) & C )) form, I think you should canonicalize to that form.

Looking at it some more, the generalized from can be simplified.

(A ^ B) ^ ((A ^ C) | B) -> C ^ (B & (A ^ C))

This takes us from four binops to three binops.

sonamkumari edited edge metadata.

Hi David,

Thanks for your time and support. :)
I have modified the patch based on your review comments.
Kindly review it.Your comments are highly welcomed.

Regards,
Sonam.

Gentle Ping !

asl added a subscriber: asl.Sep 4 2014, 11:11 PM

Please provide the information asked in other thread for similar pattern:

  1. How often this transformation triggers in LLVM testsuite. Where, in which tests.
  2. How often this transformation triggers in SPEC. Where, in which tests.
silvas resigned from this revision.Jul 8 2016, 11:38 PM
silvas removed a reviewer: silvas.
dexonsmith resigned from this revision.Jul 11 2016, 6:41 PM
dexonsmith removed a reviewer: dexonsmith.
espindola retitled this revision from Added InstCombine transform for pattern " ( ( A ^ B ) ^ ( ( ~A ) | B ) -> ( A | ( ~ B ) ) ". to Added InstCombine transform for pattern " ( ( A ^ B ) ^ ( ( ~A ) | B ) -> ( A | ( ~ B ) ) "..Mar 15 2018, 11:04 AM
espindola edited reviewers, added: espindola; removed: rafael.