This is an archive of the discontinued LLVM Phabricator instance.

[x86] refine conditions for immediate hoisting to save code-size
ClosedPublic

Authored by spatel on Jun 9 2020, 6:37 AM.

Details

Summary

As shown in PR46237:
https://bugs.llvm.org/show_bug.cgi?id=46237

The size-savings win for hoisting an 8-bit ALU immediate (intentionally excluding store constants) requires extreme conditions; it may not even be possible when including REX prefix bytes on x86-64.

I did draft a version of this patch that included use counts after the loop, but I suspect that accounting is not working as expected. I think that is because the number of constant uses are changing as we select instructions (for example as we transform shl/add into LEA).

Diff Detail

Event Timeline

spatel created this revision.Jun 9 2020, 6:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2020, 6:37 AM
spatel updated this revision to Diff 269530.Jun 9 2020, 6:51 AM

Patch updated:

  1. Removed the existing special-case for 0/-1 immediates.
  2. Updated comments in test files.
This revision is now accepted and ready to land.Jun 9 2020, 9:54 AM
This revision was automatically updated to reflect the committed changes.