This is an archive of the discontinued LLVM Phabricator instance.

[XCore] Use backwards scavenging in frame index elimination
ClosedPublic

Authored by foad on May 16 2023, 7:50 AM.

Details

Summary

This is preferred because it does not rely on accurate kill flags.

Diff Detail

Event Timeline

foad created this revision.May 16 2023, 7:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 7:50 AM
foad requested review of this revision.May 16 2023, 7:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 7:50 AM
arsenm accepted this revision.May 16 2023, 8:01 AM
This revision is now accepted and ready to land.May 16 2023, 8:01 AM
foad added a comment.May 16 2023, 8:25 AM

The lit test shows increased spilling/reloading of scavenged registers. Previously it was:

spill r4
  use r4
spill r5
  use r4 and r5
  use r5
reload r4
reload r5

Now it is:

spill r0
  use r0
reload r0
spill r1
spill r2
  use r1 and r2
reload r2
reload r1
spill r2
  use r2
reload r2

@fhahn this is because RegScavenger::findSurvivorReg[forwards] returns with a "restore point" as late as possible, but findSurvivorBackwards does not return with a "spill before" point as early as possible. It only chooses the earlier To and the earliest vreg operand it saw.

I assume the special handling of vreg operands is because it was designed to be used for PrologEpilogInserter::doScavengeFrameVirtualRegs (D21885). Now that it is being used for frame index elimination too, would it make sense to handle frame index operands similarly?

This revision was landed with ongoing or failed builds.May 18 2023, 2:05 AM
This revision was automatically updated to reflect the committed changes.