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.

llvm-svn: 274955
This commit is contained in:
Matthias Braun 2016-07-09 01:31:36 +00:00
parent 1322b6f8bb
commit 3f80043224
1 changed files with 2 additions and 1 deletions

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);
}
}