This is an archive of the discontinued LLVM Phabricator instance.

Moving few patterns from visitAnd/visitOr/visitXor to SimplifyUsingDistributiveLaws()
ClosedPublic

Authored by dinesh.d on Aug 18 2014, 12:44 AM.

Details

Summary

This patch enables SimplifyUsingDistributiveLaws() to handle following pattens.

(X >> Z) & (Y >> Z)  -> (X&Y) >> Z  for all shifts.
(X >> Z) | (Y >> Z)  -> (X|Y) >> Z  for all shifts.
(X >> Z) ^ (Y >> Z)  -> (X^Y) >> Z  for all shifts.

These patterns were previously handled separately in visitAnd()/visitOr()/visitXor().

Diff Detail

Repository
rL LLVM

Event Timeline

dinesh.d updated this revision to Diff 12610.Aug 18 2014, 12:44 AM
dinesh.d retitled this revision from to Moving few patterns from visitAnd/visitOr/visitXor to SimplifyUsingDistributiveLaws().
dinesh.d updated this object.
dinesh.d edited the test plan for this revision. (Show Details)
dinesh.d added reviewers: rafael, bkramer, jingyue.
dinesh.d added a subscriber: Unknown Object (MLST).
jingyue accepted this revision.Aug 23 2014, 8:38 PM
jingyue edited edge metadata.

LGTM. Thanks!

lib/Transforms/InstCombine/InstructionCombining.cpp
435 ↗(On Diff #12610)

Need a comment explaining what TopLevelOpcode means.

560 ↗(On Diff #12610)

I'd declare and define LHSOpcode/RHSOpcode together like what you did previously.

This revision is now accepted and ready to land.Aug 23 2014, 8:38 PM
dinesh.d updated this revision to Diff 12894.Aug 25 2014, 1:36 AM
dinesh.d edited edge metadata.

Updated as per comments.

Diffusion closed this revision.Aug 26 2014, 2:02 AM
Diffusion updated this revision to Diff 12941.

Closed by commit rL216443 (authored by dinesh).