This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Cleanup some duplicated one use checks
ClosedPublic

Authored by craig.topper on Jun 16 2017, 5:38 PM.

Details

Summary

These 4 patterns have the same one use check repeated twice for each. Once without a cast and one with. But the cast has no effect on what method is called.

For the OR case I believe it is always profitable regardless of the number of uses since we'll never increase the instruction count.

For the AND case I believe it is profitable if the pair of xors has one use such that we'll get rid of it completely. Or if the C value is something freely invertible, in which case the not doesn't cost anything.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Jun 16 2017, 5:38 PM
spatel accepted this revision.Jun 19 2017, 8:49 AM

LGTM.

This revision is now accepted and ready to land.Jun 19 2017, 8:49 AM
This revision was automatically updated to reflect the committed changes.