This is an archive of the discontinued LLVM Phabricator instance.

Added a new transformation " (sub (or A, B) (and A, B)) --> (xor A, B) "
Needs ReviewPublic

Authored by sonamkumari on Oct 9 2014, 11:20 PM.

Details

Summary

Hi All,

The patch does the following transformation :

(sub (or A, B) (and A, B)) --> (xor A, B)

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

Please help in reviewing it.

Regards,
Sonam.

Diff Detail

Event Timeline

sonamkumari retitled this revision from to Added a new transformation " (sub (or A, B) (and A, B)) --> (xor A, B) ".
sonamkumari updated this object.
sonamkumari edited the test plan for this revision. (Show Details)
sonamkumari added reviewers: suyog, majnemer, dexonsmith.
sonamkumari added a subscriber: Unknown Object (MLST).
silvas added a subscriber: silvas.Oct 10 2014, 1:48 PM

Where did you see this pattern come up?

Hi Sean,

Thanks for reviewing the patch.Similar kind of pattern optimizations have been added in visitAdd().

Regards,
Sonam.

Gentle Ping!

The patch won't take much time.

Regards,
Sonam.

asl added a subscriber: asl.Oct 29 2014, 9:58 PM

You still have not answered to Sean's question, namely, which
applications would benefit from this transformation.

Hi Anton,

Thanks for your comments.
While I was going through other patches, I came across D5719 patch and the discussions over these kind of patches.
So, I guess such expressions can be included.

Kindly provide your feedback.

Regards,
Sonam.

asl added a comment.Nov 6 2014, 10:54 PM

The question still applies (and actually is very in-line with Hal's comments in D5719) - you need to provide some evidence that such pattern indeed happens in practice (why it's so hard to count how many times it happens in test-suite? after more than month?). And it's not some random stuff which you simple want to commit in due to some reason you do not want to share with us.

hfinkel edited edge metadata.Nov 7 2014, 8:13 AM
  • Original Message -----

From: "Anton Korobeynikov" <anton@korobeynikov.info>
To: "sonam kumari" <sonam.kumari@samsung.com>, "suyog sarda" <suyog.sarda@samsung.com>, "david majnemer"
<david.majnemer@gmail.com>, dexonsmith@apple.com, hfinkel@anl.gov
Cc: anton@korobeynikov.info, chisophugis@gmail.com, llvm-commits@cs.uiuc.edu
Sent: Friday, November 7, 2014 12:54:49 AM
Subject: Re: [PATCH] Added a new transformation " (sub (or A, B) (and A, B)) --> (xor A, B) "

The question still applies (and actually is very in-line with Hal's
comments in D5719

Just to be clear, I think these (three nodes -> one node) transformations, which don't rely on calls to ValueTracking, should all be added (because, in my experience working on a superoptimizer, they essentially all happen eventually and lacking them leads to surprising behavior in combination with other optimizations).

However, that having been said, it is a perfectly reasonable question to ask what motivated this particular patch? How did you see this? The answer to this question might motivate other work, allow us to better understand the results of other optimizations, etc. and so I still believe that understanding the motivation is important.

Thanks again,
Hal

) - you need to provide some evidence that such
pattern indeed happens in practice (why it's so hard to count how
many times it happens in test-suite? after more than month?). And
it's not some random stuff which you simple want to commit in due to
some reason you do not want to share with us.

http://reviews.llvm.org/D5720

silvas added a comment.Nov 7 2014, 8:01 PM

Upthread Suyog mentions a "similar" transformation in visitAdd, which was
added in r155674 referencing a rdar. I'm not sure how Suyog got from that
transformation to this one though (a script? seems difficult to deduce).

dexonsmith resigned from this revision.Aug 25 2019, 8:22 AM