This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Reduce number of virtual registers used when eliminating frameindex
AbandonedPublic

Authored by lkail on Sep 8 2021, 1:45 AM.

Details

Reviewers
nemanjai
jsji
shchenz
Group Reviewers
Restricted Project
Summary

When eliminating frameindex, we don't need two virtual registers to materialize a int32 immediate. No test is changed since SRegHi is set killed and Scavenger allocates the same physical register for SReg and SRegHi.

Diff Detail

Event Timeline

lkail created this revision.Sep 8 2021, 1:45 AM
lkail requested review of this revision.Sep 8 2021, 1:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2021, 1:45 AM

Can you please describe why this change is desired? The description seems to indicate that this is completely unnecessary.

While I do realize that we are out of SSA form at this point, I find it a nice conceptual abstraction that code we add only defines each virtual register once. The register scavenger then allocates appropriate physical registers. Unless there is a known problem where the scavenger ends up doing a bad job or the additional virtual registers add significantly to the compilation time, I am not really in favour of this change.

lkail added a comment.Sep 8 2021, 7:31 PM

Can you please describe why this change is desired?

When I work on https://reviews.llvm.org/D107886, I observe there are duplicated codes in PPCFrameLowering and PPCRegisterInfo to materialize immediates. I implemented a routine to get it work https://reviews.llvm.org/D107886#C2797592NL3233. I realized it also applies to virtual registers in non-SSA form. Before applying the routine mentioned above, I have to refactor this part of code a bit.

lkail abandoned this revision.Sep 9 2021, 12:23 AM

I just realized this was designed in purpose https://github.com/llvm/llvm-project/commit/d8a423cd71bb2a9b7666fd58fc82db16b4666d1d, though I don't know the motivation to keep it SSA, I'll abandon this patch first.

nice conceptual abstraction that code we add only defines each virtual register once

I agree with it. But in other way, we can still assert(!MRI->isSSA()) here and define virtual registers more than once.