[PATCH] D51474: Consider CSRs in computeRegisterLiveness

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 13:25:38 PDT 2018


thegameg added inline comments.


================
Comment at: lib/CodeGen/MachineBasicBlock.cpp:1406
+    const MachineFrameInfo &MFI = MF.getFrameInfo();
+    if (isReturnBlock() && MFI.isCalleeSavedInfoValid()) {
+      const MachineRegisterInfo &MRI = MF.getRegInfo();
----------------
MatzeB wrote:
> thegameg wrote:
> > I wonder if this shouldn't be checking `MFI.getRestoreBlock()` instead/along with `isReturnBlock()`. IIUC CSRs are live after the epilogue, so I assume checking for `isReturnBlock()` is always safer.
> No, we really should encode liveness with the livein lists and not add special cases. The problem is just that with the return block you have no successors where you could actually look at the live-in lists (and you already see here how complicted things become once you start special casing). For RestoreBlock != ReturnBlock we should have correct live-in lists so no special handling necessary here.
I understand it better now, thanks for the explanation.


https://reviews.llvm.org/D51474





More information about the llvm-commits mailing list