]> granicus.if.org Git - llvm/commitdiff
Simplify funcresolve a bit more
authorChris Lattner <sabre@nondot.org>
Sat, 31 May 2003 20:44:46 +0000 (20:44 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 31 May 2003 20:44:46 +0000 (20:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6480 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/FunctionResolution.cpp

index 75159eaaf74198d556102417ba2225f1f297d352..5b2e39fdad4abff7f989a93c581870c38343dcc4 100644 (file)
@@ -183,19 +183,19 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
             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;
 }