[llvm-commits] [llvm] r52837 - /llvm/trunk/lib/VMCore/Module.cpp

Chris Lattner sabre at nondot.org
Fri Jun 27 14:25:24 PDT 2008


Author: lattner
Date: Fri Jun 27 16:25:24 2008
New Revision: 52837

URL: http://llvm.org/viewvc/llvm-project?rev=52837&view=rev
Log:
simplify some code to avoid string thrashing.

Modified:
    llvm/trunk/lib/VMCore/Module.cpp

Modified: llvm/trunk/lib/VMCore/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=52837&r1=52836&r2=52837&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Module.cpp (original)
+++ llvm/trunk/lib/VMCore/Module.cpp Fri Jun 27 16:25:24 2008
@@ -156,10 +156,12 @@
 
   // Okay, the function exists.  Does it have externally visible linkage?
   if (F->hasInternalLinkage()) {
-    // Rename the function.
-    F->setName(SymTab.getUniqueName(F->getName()));
+    // Clear the function's name.
+    F->setName("");
     // Retry, now there won't be a conflict.
-    return getOrInsertFunction(Name, Ty);
+    Constant *NewF = getOrInsertFunction(Name, Ty);
+    F->setName(&Name[0], Name.size());
+    return NewF;
   }
 
   // If the function exists but has the wrong type, return a bitcast to the





More information about the llvm-commits mailing list