simplify name juggling through the use of Value::takeName.

llvm-svn: 34175
diff --git a/llvm/lib/Transforms/IPO/ExtractFunction.cpp b/llvm/lib/Transforms/IPO/ExtractFunction.cpp
index ae1eb22..afaf38d 100644
--- a/llvm/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/llvm/lib/Transforms/IPO/ExtractFunction.cpp
@@ -90,16 +90,15 @@
       for (Module::iterator I = M.begin(); ; ++I) {
         if (&*I != Named) {
           Function *New = new Function(I->getFunctionType(),
-                                       GlobalValue::ExternalLinkage,
-                                       I->getName());
+                                       GlobalValue::ExternalLinkage);
           New->setCallingConv(I->getCallingConv());
-          I->setName("");  // Remove Old name
 
           // If it's not the named function, delete the body of the function
           I->dropAllReferences();
 
           M.getFunctionList().push_back(New);
           NewFunctions.push_back(New);
+          New->takeName(I);
         }
 
         if (&*I == Last) break;  // Stop after processing the last function