[llvm] r219285 - Use cached subtarget rather than looking it up on the

Eric Christopher echristo at gmail.com
Wed Oct 8 00:51:41 PDT 2014


Author: echristo
Date: Wed Oct  8 02:51:41 2014
New Revision: 219285

URL: http://llvm.org/viewvc/llvm-project?rev=219285&view=rev
Log:
Use cached subtarget rather than looking it up on the
TargetMachine again.

Modified:
    llvm/trunk/lib/CodeGen/MachineFunction.cpp

Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=219285&r1=219284&r2=219285&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Oct  8 02:51:41 2014
@@ -57,7 +57,7 @@ MachineFunction::MachineFunction(const F
                                  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 F
                                 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;





More information about the llvm-commits mailing list