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
- Repository
- rG LLVM Github Monorepo
Event Timeline
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.
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.
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.
clang-format: please reformat the code