LivePhysRegs: addLiveOuts() can skip addPristines() in ret block

Drive-by improvement: We would 1) add CSRs, 2) remove callee saved CSRs
and 3) add all CSRs again for the return block.  Just adding CSRs once
obviously gives the same results.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274955 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun 2016-07-09 01:31:36 +00:00
parent c39550268e
commit c7bb08fdc6

View File

@ -167,12 +167,13 @@ void LivePhysRegs::addLiveOuts(const MachineBasicBlock &MBB) {
const MachineFunction &MF = *MBB.getParent();
const MachineFrameInfo &MFI = *MF.getFrameInfo();
if (MFI.isCalleeSavedInfoValid()) {
addPristines(*this, MF, MFI, *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);
} else {
addPristines(*this, MF, MFI, *TRI);
}
}