This is an archive of the discontinued LLVM Phabricator instance.

[MachineSink] Sink instruction copies when they can replace copy into hard register
AbandonedPublic

Authored by chill on Mar 9 2023, 10:36 AM.

Details

Summary

With this change, the MachineSink will try to find cheap instructions (isAsCheapAsMove), such
that their destination register is used only by a tree of COPY instructions, with leaf nodes
being copies into a hard register. Then the pass will replace the final COPY instructions
with a copies of the original (non-COPY) instruction, and delete it, as long as the
register pressure at the destination would not exceed the limit.

Diff Detail

Event Timeline

chill created this revision.Mar 9 2023, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2023, 10:36 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
chill requested review of this revision.Mar 9 2023, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2023, 10:36 AM
chill edited the summary of this revision. (Show Details)Mar 10 2023, 8:22 AM
chill updated this revision to Diff 508545.EditedMar 27 2023, 2:33 AM

Update:

  • don't sink instructions with non-register operands which could affect register pressure
  • when checking register pressure use the source of the replaced copy instruction (not the destination of the instructions being sunk)
chill abandoned this revision.Oct 23 2023, 10:40 AM

Finished through GitHub.