aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-22 00:12:30 +0000
committerChris Lattner <sabre@nondot.org>2009-03-22 00:12:30 +0000
commitd972678a053d4785772b75cf6c8d4ab74ac2c7f6 (patch)
tree84404e3a5739cedbc8aab728d68d20958f1e0c93 /lib/CodeGen/CodeGenModule.cpp
parentb7beee9f2b52f34a3b0800a5f0038f0e4295b260 (diff)
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% git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67457 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index b259a5dc2c..4cd046d74e 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/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.