[PATCH] D51474: Consider CSRs in computeRegisterLiveness

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 5 08:04:12 PDT 2018


arsenm added inline comments.


================
Comment at: lib/CodeGen/MachineBasicBlock.cpp:1406
+    const MachineFrameInfo &MFI = MF.getFrameInfo();
+    if (isReturnBlock() && MFI.isCalleeSavedInfoValid()) {
+      const MachineRegisterInfo &MRI = MF.getRegInfo();
----------------
thegameg wrote:
> 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.
I'm not sure what you're saying. If isReturnBlock is safer, then why check getRestoreBlock?

I also don't love making this change blind. Maybe this should just assert if the register is a CSR?


https://reviews.llvm.org/D51474





More information about the llvm-commits mailing list