From 9715d9fb59e579ed3087e39ea9d99b7c126774e7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 18 Oct 2007 18:49:29 +0000 Subject: Fix PR1735 and Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll by fixing some obviously broken code :( llvm-svn: 43141 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp') diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index dd5d668bc17..8dd09256136 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -168,7 +168,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { CallSite CS = CallSite::get(Fn.use_back()); Instruction *Call = CS.getInstruction(); - // Loop over the operands, dropping extraneous ones at the end of the list. + // Pass all the same arguments. Args.assign(CS.arg_begin(), CS.arg_begin()+NumArgs); Instruction *New; @@ -185,13 +185,13 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { Args.clear(); if (!Call->use_empty()) - Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); + Call->replaceAllUsesWith(New); New->takeName(Call); // Finally, remove the old call from the program, reducing the use-count of // F. - Call->getParent()->getInstList().erase(Call); + Call->eraseFromParent(); } // Since we have now created the new function, splice the body of the old -- cgit v1.2.3