Page MenuHomePhabricator

RegAllocFast: Improve hinting heuristic
ClosedPublic

Authored by arsenm on Nov 9 2018, 4:35 PM.

Details

Summary
  • Trace through multiple COPYs when looking for a physreg source.
  • Add hinting for vregs that will be copied into physregs (we only hinted for vregs getting copied to a physreg previously).
  • Give hinted a register a bonus when deciding which value to spill.

This is part of my rewrite regallocfast series. In fact this one doesn't even have an effect unless you also flip the allocation to happen from back to front of a basic block. Nonetheless it helps to split this up to ease review of D52010

Diff Detail

Event Timeline

MatzeB created this revision.Nov 9 2018, 4:35 PM
arsenm added inline comments.Nov 9 2018, 5:03 PM
lib/CodeGen/RegAllocFast.cpp
601–602

Isn't this the same as MI.isFullCopy()?

I do see test changes with this (at least with D54366 reverted). At least one of them is a regression for this situation:

%11:sreg_32_xm0 = COPY %0.sub1
%12:sreg_32_xm0 = COPY %0.sub0

This inserts 2 64-bit restores of %0, and each one uses only one of the subregisters. Previously this did the right thing, and only restored once

Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2019, 10:55 AM
arsenm commandeered this revision.Mar 19 2019, 10:34 AM
arsenm updated this revision to Diff 191349.
arsenm edited reviewers, added: MatzeB; removed: arsenm.

Use isFullCopy, add test changes

arsenm updated this revision to Diff 199256.May 13 2019, 5:45 AM

Rebase, test updates

Looks good to me, modulo the order in which we check the hints.

lib/CodeGen/RegAllocFast.cpp
656

I would rather we try the hint that we've been given first. (I.e., Hint1 before Hint0).

arsenm updated this revision to Diff 199481.May 14 2019, 10:47 AM
arsenm marked an inline comment as done.

Swap hint order, which changed no tests

arsenm updated this revision to Diff 199482.May 14 2019, 10:50 AM

Fix rename

This revision is now accepted and ready to land.May 14 2019, 11:05 AM
arsenm closed this revision.May 16 2019, 5:48 AM

r360887