[PATCH] D13180: LivePhysRegs: Fix live-outs of return block.
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 16:52:30 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248636: LivePhysRegs: Fix live-outs of return blocks (authored by matze).
Changed prior to commit:
http://reviews.llvm.org/D13180?vs=35770&id=35783#toc
Repository:
rL LLVM
http://reviews.llvm.org/D13180
Files:
llvm/trunk/include/llvm/CodeGen/LivePhysRegs.h
llvm/trunk/lib/CodeGen/LivePhysRegs.cpp
Index: llvm/trunk/include/llvm/CodeGen/LivePhysRegs.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/LivePhysRegs.h
+++ llvm/trunk/include/llvm/CodeGen/LivePhysRegs.h
@@ -122,9 +122,9 @@
void addLiveIns(const MachineBasicBlock *MBB, bool AddPristines = false);
/// \brief Adds all live-out registers of basic block @p MBB; After prologue/
- /// epilogue insertion \p AddPristines should be set to true to insert the
- /// pristine registers.
- void addLiveOuts(const MachineBasicBlock *MBB, bool AddPristines = false);
+ /// epilogue insertion \p AddPristinesAndCSRs should be set to true.
+ void addLiveOuts(const MachineBasicBlock *MBB,
+ bool AddPristinesAndCSRs = false);
typedef SparseSet<unsigned>::const_iterator const_iterator;
const_iterator begin() const { return LiveRegs.begin(); }
Index: llvm/trunk/lib/CodeGen/LivePhysRegs.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/LivePhysRegs.cpp
+++ llvm/trunk/lib/CodeGen/LivePhysRegs.cpp
@@ -147,11 +147,19 @@
}
void LivePhysRegs::addLiveOuts(const MachineBasicBlock *MBB,
- bool AddPristines) {
- if (AddPristines) {
+ bool AddPristinesAndCSRs) {
+ if (AddPristinesAndCSRs) {
const MachineFunction &MF = *MBB->getParent();
addPristines(*this, MF, *TRI);
+ if (!MBB->isReturnBlock()) {
+ // The return block has no successors whose live-ins we could merge
+ // below. So instead we add the callee saved registers manually.
+ for (const MCPhysReg *I = TRI->getCalleeSavedRegs(&MF); *I; ++I)
+ addReg(*I);
+ }
}
+
+ // To get the live-outs we simply merge the live-ins of all successors.
for (const MachineBasicBlock *Succ : MBB->successors())
::addLiveIns(*this, *Succ);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13180.35783.patch
Type: text/x-patch
Size: 1894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150925/185f3447/attachment.bin>
More information about the llvm-commits
mailing list