[cfe-commits] r67457 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Chris Lattner sabre at nondot.org
Sat Mar 21 17:12:30 PDT 2009


Author: lattner
Date: Sat Mar 21 19:12:30 2009
New Revision: 67457

URL: http://llvm.org/viewvc/llvm-project?rev=67457&view=rev
Log:
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%

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=67457&r1=67456&r2=67457&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Mar 21 19:12:30 2009
@@ -630,7 +630,8 @@
   }
   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::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.
 





More information about the cfe-commits mailing list