]> granicus.if.org Git - clang/commitdiff
Make ReplaceUsesOfNonProtoTypeWithRealFunction verify that a call is *to* the
authorChris Lattner <sabre@nondot.org>
Thu, 4 Jun 2009 16:47:43 +0000 (16:47 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 4 Jun 2009 16:47:43 +0000 (16:47 +0000)
function of interest, not an operand of it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72869 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp

index b69301ed589361bc8a6af66f9a0efb88be859756..6e8440a17738e5525bca198cd0b867245325c0d6 100644 (file)
@@ -891,8 +891,9 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
   for (llvm::Value::use_iterator UI = OldFn->use_begin(), E = OldFn->use_end();
        UI != E; ) {
     // TODO: Do invokes ever occur in C code?  If so, we should handle them too.
+    unsigned OpNo = UI.getOperandNo();
     llvm::CallInst *CI = dyn_cast<llvm::CallInst>(*UI++);
-    if (!CI) continue;
+    if (!CI || OpNo != 0) continue;
     
     // If the return types don't match exactly, and if the call isn't dead, then
     // we can't transform this call.