This is an archive of the discontinued LLVM Phabricator instance.

[PEI][WebAssembly] Switch to backwards frame index elimination
ClosedPublic

Authored by foad on Jul 31 2023, 7:00 AM.

Details

Summary

Backwards frame index elimination uses backwards register scavenging,
which is preferred because it does not rely on accurate kill flags.

Diff Detail

Event Timeline

foad created this revision.Jul 31 2023, 7:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 7:00 AM
foad requested review of this revision.Jul 31 2023, 7:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 7:00 AM

Would it be possible to add a test that shows benefit from this? All the test changes in this diff seem to merely renumber virtual registers.

arsenm added a subscriber: arsenm.Aug 2 2023, 3:47 PM

Would it be possible to add a test that shows benefit from this? All the test changes in this diff seem to merely renumber virtual registers.

Probably not, any improvement implies there's a bug somewhere from not setting a kill flag. This avoids that maintenance cost

tlively accepted this revision.Aug 2 2023, 7:07 PM

LGTM, then. Is there somewhere I can read more about the context for this change?

This revision is now accepted and ready to land.Aug 2 2023, 7:07 PM
foad added a comment.Aug 3 2023, 2:10 AM

LGTM, then. Is there somewhere I can read more about the context for this change?

Thanks. I am not aware of a good overall summary, but there are various comments scattered around like:

include/llvm/CodeGen/MachinePassRegistry.def
71-// LiveVariables currently requires pure SSA form.
72:// FIXME: Once TwoAddressInstruction pass no longer uses kill flags,
73-// LiveVariables can be removed completely, and LiveIntervals can be directly
74-// computed. (We still either need to regenerate kill flags after regalloc, or
75-// preferably fix the scavenger to not depend on them).