Simplify funcresolve a bit more

llvm-svn: 6480
diff --git a/llvm/lib/Transforms/IPO/FunctionResolution.cpp b/llvm/lib/Transforms/IPO/FunctionResolution.cpp
index 75159ea..5b2e39f 100644
--- a/llvm/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionResolution.cpp
@@ -183,19 +183,19 @@
             Changed = true;
             ++NumResolved;
           } else {
-            std::cerr << "Couldn't cleanup this function call, must be an"
-                      << " argument or something!" << CI;
             ++i;
           }
-        } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(U)) {
-          Constant *NewCPR = ConstantPointerRef::get(Concrete);
-          CPR->replaceAllUsesWith(ConstantExpr::getCast(NewCPR,CPR->getType()));
-          CPR->destroyConstant();
         } else {
-          std::cerr << "Cannot convert use of function: " << U << "\n";
           ++i;
         }
       }
+
+      // If there are any more uses that we could not resolve, force them to use
+      // a casted pointer now.
+      if (!Old->use_empty()) {
+        Constant *NewCPR = ConstantPointerRef::get(Concrete);
+        Old->replaceAllUsesWith(ConstantExpr::getCast(NewCPR, Old->getType()));
+      }
     }
   return Changed;
 }