[PATCH] D39536: [PowerPC] Eliminate redundant register copys after register allocation

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 00:59:30 PST 2018


inouehrs marked an inline comment as done.
inouehrs added inline comments.


================
Comment at: lib/Target/PowerPC/PPCRegCopyElim.cpp:267
+            if (Reg == PPC::X1 || Reg == PPC::R1 ||
+                Reg == PPC::X2 || Reg == PPC::R2 ||
+                (TFI->needsFP(*MF) && (Reg == PPC::X31 || Reg == PPC::R31)) ||
----------------
hfinkel wrote:
> X2 is not always special (in leaf functions, it might be allocatable). You can check using:
>   MF->getRegInfo().isAllocatable(PPC::X2) or !getReservedRegs(*MF).test(PPC::X2) or similar.
Thank you so much for the suggestion. I totally replaced my own check with `getReservedRegs` (not only for X2). It makes the code cleaner.


https://reviews.llvm.org/D39536





More information about the llvm-commits mailing list