[PATCH] D51474: Consider CSRs in computeRegisterLiveness

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 17:00:38 PDT 2018


MatzeB 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:
> - 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...


https://reviews.llvm.org/D51474





More information about the llvm-commits mailing list