From c720405b2a234a6d6be9ef90c3d0078722e04e07 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 8 Oct 2014 07:51:41 +0000 Subject: [PATCH] Use cached subtarget rather than looking it up on the TargetMachine again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219285 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineFunction.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 97a0c93b48b..6a304abef2d 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -57,7 +57,7 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM, GCModuleInfo *gmi) : Fn(F), Target(TM), STI(TM.getSubtargetImpl()), Ctx(mmi.getContext()), MMI(mmi), GMI(gmi) { - if (TM.getSubtargetImpl()->getRegisterInfo()) + if (STI->getRegisterInfo()) RegInfo = new (Allocator) MachineRegisterInfo(this); else RegInfo = nullptr; @@ -72,15 +72,13 @@ MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM, getStackAlignment(AttributeSet::FunctionIndex)); ConstantPool = new (Allocator) MachineConstantPool(TM); - Alignment = - TM.getSubtargetImpl()->getTargetLowering()->getMinFunctionAlignment(); + Alignment = STI->getTargetLowering()->getMinFunctionAlignment(); // FIXME: Shouldn't use pref alignment if explicit alignment is set on Fn. if (!Fn->getAttributes().hasAttribute(AttributeSet::FunctionIndex, Attribute::OptimizeForSize)) - Alignment = std::max( - Alignment, - TM.getSubtargetImpl()->getTargetLowering()->getPrefFunctionAlignment()); + Alignment = std::max(Alignment, + STI->getTargetLowering()->getPrefFunctionAlignment()); FunctionNumber = FunctionNum; JumpTableInfo = nullptr; -- 2.34.1