llvm.org GIT mirror llvm / a0bc7fc
Fix PR1735 and Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll by fixing some obviously broken code :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43141 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 12 years ago
2 changed file(s) with 15 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
167167 CallSite CS = CallSite::get(Fn.use_back());
168168 Instruction *Call = CS.getInstruction();
169169
170 // Loop over the operands, dropping extraneous ones at the end of the list.
170 // Pass all the same arguments.
171171 Args.assign(CS.arg_begin(), CS.arg_begin()+NumArgs);
172172
173173 Instruction *New;
184184 Args.clear();
185185
186186 if (!Call->use_empty())
187 Call->replaceAllUsesWith(Constant::getNullValue(Call->getType()));
187 Call->replaceAllUsesWith(New);
188188
189189 New->takeName(Call);
190190
191191 // Finally, remove the old call from the program, reducing the use-count of
192192 // F.
193 Call->getParent()->getInstList().erase(Call);
193 Call->eraseFromParent();
194194 }
195195
196196 // Since we have now created the new function, splice the body of the old
0 ; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep {ret i32 0}
1 ; PR1735
2
3 define internal i32 @test(i32 %A, ...) {
4 ret i32 %A
5 }
6
7 define i32 @foo() {
8 %A = call i32(i32, ...)* @test(i32 1)
9 ret i32 %A
10 }
11