make GVN try to rename inputs to the resultant replaced values, which
cleans up the generated code a bit.  This should have the added benefit of
not randomly renaming functions/globals like my previous patch did. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61023 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 8cfc627..d3e15d4 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1040,6 +1040,9 @@
     // Perform PHI construction.
     Value* v = GetValueForBlock(LI->getParent(), LI, BlockReplValues, true);
     LI->replaceAllUsesWith(v);
+    
+    if (!isa<GlobalValue>(v))
+      v->takeName(LI);
     if (isa<PointerType>(v->getType()))
       MD->invalidateCachedPointerInfo(v);
     toErase.push_back(LI);
@@ -1135,7 +1138,8 @@
   // Perform PHI construction.
   Value* v = GetValueForBlock(LI->getParent(), LI, BlockReplValues, true);
   LI->replaceAllUsesWith(v);
-  v->takeName(LI);
+  if (!isa<GlobalValue>(v))
+    v->takeName(LI);
   if (isa<PointerType>(v->getType()))
     MD->invalidateCachedPointerInfo(v);
   toErase.push_back(LI);