From: Eric Christopher Date: Fri, 31 Mar 2017 23:12:27 +0000 (+0000) Subject: Reduce the number of times we query the subtarget for the same information. X-Git-Tag: llvmorg-5.0.0-rc1~8706 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60a245e0ffc94a877f1a2e826c310a91a38d3e62;p=platform%2Fupstream%2Fllvm.git Reduce the number of times we query the subtarget for the same information. llvm-svn: 299278 --- diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp index 8c0cdc1..550174b 100644 --- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -266,14 +266,13 @@ static unsigned findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB) { if (&MF->front() == MBB) return AArch64::X9; - const TargetRegisterInfo &TRI = *MF->getSubtarget().getRegisterInfo(); - LivePhysRegs LiveRegs(&TRI); + const AArch64Subtarget &Subtarget = MF->getSubtarget(); + const AArch64RegisterInfo *TRI = Subtarget.getRegisterInfo(); + LivePhysRegs LiveRegs(TRI); LiveRegs.addLiveIns(*MBB); // Mark callee saved registers as used so we will not choose them. - const AArch64Subtarget &Subtarget = MF->getSubtarget(); - const AArch64RegisterInfo *RegInfo = Subtarget.getRegisterInfo(); - const MCPhysReg *CSRegs = RegInfo->getCalleeSavedRegs(MF); + const MCPhysReg *CSRegs = TRI->getCalleeSavedRegs(MF); for (unsigned i = 0; CSRegs[i]; ++i) LiveRegs.addReg(CSRegs[i]);