Mips: Don't create a dangling IR function just to get the address of a symbol.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 11 Dec 2011 12:21:34 +0000 (12:21 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 11 Dec 2011 12:21:34 +0000 (12:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146340 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsISelLowering.cpp

index 4bd3d8afb840de9be8c772997071cc29e2c72dee..4df84ee3cdf935509055cb77a0ba27cbbd79b15d 100644 (file)
@@ -1553,12 +1553,7 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
     unsigned PtrSize = PtrVT.getSizeInBits();
     IntegerType *PtrTy = Type::getIntNTy(*DAG.getContext(), PtrSize);
 
-    SmallVector<Type*, 1> Params;
-    Params.push_back(PtrTy);
-    FunctionType *FuncTy = FunctionType::get(PtrTy, Params, false);
-    Function *Func = Function::Create(FuncTy, GlobalValue::ExternalLinkage,
-                                      "__tls_get_addr");
-    SDValue TlsGetAddr = DAG.getGlobalAddress(Func, dl, PtrVT);
+    SDValue TlsGetAddr = DAG.getExternalSymbol("__tls_get_addr", PtrVT);
 
     ArgListTy Args;
     ArgListEntry Entry;