diff options
author | Matthias Braun <matze@braunis.de> | 2015-09-25 23:50:53 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2015-09-25 23:50:53 +0000 |
commit | 93ab942c2403f9f5cca7d02c5964e61d9a41b733 (patch) | |
tree | e880ea28c86dd036f900d82e3fe64e4fa64d6344 /llvm/lib/CodeGen/LivePhysRegs.cpp | |
parent | cc8c7773c5587a888a06b771b323a29e5f5b41b1 (diff) | |
download | bcm5719-llvm-93ab942c2403f9f5cca7d02c5964e61d9a41b733.tar.gz bcm5719-llvm-93ab942c2403f9f5cca7d02c5964e61d9a41b733.zip |
LivePhysRegs: Fix live-outs of return blocks
I realized that the live-out set computed for the return block is
missing the callee saved registers (the non-pristine ones to be exact).
This only affects the liveness computed for instructions inside the
function epilogue which currently none of the LivePhysRegs users in llvm
cares about, so this is just a drive-by fix without a testcase.
Differential Revision: http://reviews.llvm.org/D13180
llvm-svn: 248636
Diffstat (limited to 'llvm/lib/CodeGen/LivePhysRegs.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LivePhysRegs.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp index 61226b7472a..efbbcbe23e1 100644 --- a/llvm/lib/CodeGen/LivePhysRegs.cpp +++ b/llvm/lib/CodeGen/LivePhysRegs.cpp @@ -147,11 +147,19 @@ static void addPristines(LivePhysRegs &LiveRegs, const MachineFunction &MF, } 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); } |