[PATCH] D51474: Consider CSRs in computeRegisterLiveness

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 5 08:17:05 PDT 2018


kparzysz added inline comments.


================
Comment at: lib/CodeGen/MachineBasicBlock.cpp:1412-1418
+      const MachineFrameInfo &MFI = MF.getFrameInfo();
+      if (MFI.isCalleeSavedInfoValid()) {
+        for (const CalleeSavedInfo &Info : MFI.getCalleeSavedInfo()) {
+          if (Info.isRestored() && Info.getReg() == Reg)
+            return LQR_Live;
+        }
+      }
----------------
MatzeB wrote:
> MatzeB wrote:
> > - Thinking about it, the CSRs are only considered live-out of the return block after prolog epilog insertion, so the whole code here needs to be guarded with `MFI.isCalleeSavedInfoValid()`.
> > - CalleeeSavedInfo() must be a subset of MRI.getCalleeSavedRegs() so we shouldn't need the 2nd loop.
> > CalleeeSavedInfo() must be a subset of MRI.getCalleeSavedRegs() so we shouldn't need the 2nd loop.
> Ignore this 2nd part of my comment. I just realized we can have callee saved registers that are not live-out of the return block...
Callee-saved registers are always live out of the return block, regardless of whether they have actually been saved or not.


https://reviews.llvm.org/D51474





More information about the llvm-commits mailing list