diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-22 00:12:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-22 00:12:30 +0000 |
commit | 4ff71de88073dc44f8d15f4787307157c7c60cc8 (patch) | |
tree | f04106c1b29394d36b3c40ad16b72341607e1792 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 17556b2d9581bb9d03932c1b447611a6f62bc2de (diff) | |
download | bcm5719-llvm-4ff71de88073dc44f8d15f4787307157c7c60cc8.tar.gz bcm5719-llvm-4ff71de88073dc44f8d15f4787307157c7c60cc8.zip |
set function/global names with setName instead of passing the name into the
ctor function. This avoids creating a temporary std::string for the name,
speeding up the testcase in PR3810 by 3.8%
llvm-svn: 67457
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b259a5dc2cf..4cd046d74ed 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -630,7 +630,8 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(const FunctionDecl *D, } llvm::Function *F = llvm::Function::Create(cast<llvm::FunctionType>(Ty), llvm::Function::ExternalLinkage, - MangledName, &getModule()); + "", &getModule()); + F->setName(MangledName); if (ShouldSetAttributes) SetFunctionAttributes(D, F); Entry = F; @@ -677,8 +678,9 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, llvm::GlobalVariable *GV = new llvm::GlobalVariable(Ty, false, llvm::GlobalValue::ExternalLinkage, - 0, MangledName, &getModule(), + 0, "", &getModule(), 0, ASTTy.getAddressSpace()); + GV->setName(MangledName); // Handle things which are present even on external declarations. |