This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Don't let folding (select (icmp eq (and X, C1), 0), Y, (or Y, C2)) create more instructions than it removes
ClosedPublic

Authored by craig.topper on Jun 20 2017, 11:16 PM.

Details

Summary

Previously this folding had no checks to see if it was going to result in less instructions. This was pointed out during the review of D34184

This patch adds code to count how many instructions its going to create vs how many its going to remove so we can make a proper decision.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 20 2017, 11:16 PM
spatel accepted this revision.Jun 21 2017, 6:20 AM

LGTM. Don't forget to remove the 'TODO' comments from the test file.

This revision is now accepted and ready to land.Jun 21 2017, 6:20 AM
This revision was automatically updated to reflect the committed changes.