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

Chris Lattner sabre at nondot.org
Sat Mar 21 01:07:08 PDT 2009


Author: lattner
Date: Sat Mar 21 03:06:59 2009
New Revision: 67440

URL: http://llvm.org/viewvc/llvm-project?rev=67440&view=rev
Log:
reduce redundant calls of getMangledName.

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=67440&r1=67439&r2=67440&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Mar 21 03:06:59 2009
@@ -398,13 +398,13 @@
       continue;
     }
 
+    const char *MangledName = getMangledName(D);
     llvm::GlobalValue *GA = 
       new llvm::GlobalAlias(aliasee->getType(),
                             llvm::Function::ExternalLinkage,
-                            getMangledName(D), aliasee, 
-                            &getModule());
+                            MangledName, aliasee, &getModule());
     
-    llvm::GlobalValue *&Entry = GlobalDeclMap[getMangledName(D)];
+    llvm::GlobalValue *&Entry = GlobalDeclMap[MangledName];
     if (Entry) {
       // If we created a dummy function for this then replace it.
       GA->takeName(Entry);
@@ -597,7 +597,8 @@
   const llvm::Type *Ty = getTypes().ConvertTypeForMem(ASTTy);
 
   // Lookup the entry, lazily creating it if necessary.
-  llvm::GlobalValue *&Entry = GlobalDeclMap[getMangledName(D)];
+  const char *MangledName = getMangledName(D);
+  llvm::GlobalValue *&Entry = GlobalDeclMap[MangledName];
   if (Entry) {
     const llvm::Type *PTy = llvm::PointerType::get(Ty, ASTTy.getAddressSpace());
     
@@ -610,7 +611,7 @@
   llvm::GlobalVariable *GV = 
     new llvm::GlobalVariable(Ty, false, 
                              llvm::GlobalValue::ExternalLinkage,
-                             0, getMangledName(D), &getModule(), 
+                             0, MangledName, &getModule(), 
                              0, ASTTy.getAddressSpace());
 
   // Handle things which are present even on external declarations.
@@ -665,13 +666,14 @@
   }
   const llvm::Type* InitType = Init->getType();
 
-  llvm::GlobalValue *&Entry = GlobalDeclMap[getMangledName(D)];
+  const char *MangledName = getMangledName(D);
+  llvm::GlobalValue *&Entry = GlobalDeclMap[MangledName];
   llvm::GlobalVariable *GV = cast_or_null<llvm::GlobalVariable>(Entry);
   
   if (!GV) {
     GV = new llvm::GlobalVariable(InitType, false, 
                                   llvm::GlobalValue::ExternalLinkage,
-                                  0, getMangledName(D), 
+                                  0, MangledName, 
                                   &getModule(), 0, ASTTy.getAddressSpace());
 
   } else if (GV->hasInitializer() && !GV->getInitializer()->isNullValue()) {
@@ -715,7 +717,7 @@
     // Make a new global with the correct type
     GV = new llvm::GlobalVariable(InitType, false, 
                                   llvm::GlobalValue::ExternalLinkage,
-                                  0, getMangledName(D), 
+                                  0, MangledName,
                                   &getModule(), 0, ASTTy.getAddressSpace());
     // Steal the name of the old global
     GV->takeName(OldGV);





More information about the cfe-commits mailing list