In my back-end I'd like to be able to pass dummy values to functions that ignore them. The following code: declare i32 @foo(i32, i32, i32) define void @bar() nounwind { entry: %call = call i32 @foo(i32 8, i32 6, i32 undef) ret void } ends up generating (using llc -O3): bar: # @bar # BB#0: # %entry subl $12, %esp movl %eax, 8(%esp) movl $6, 4(%esp) movl $8, (%esp) calll foo addl $12, %esp ret Shouldn't the "movl %eax, 8(%esp)" be unnecessary? P.S. On ARM the mov to r2 is successfully elided: bar: @ @bar @ BB#0: @ %entry push {r11, lr} mov r0, #8 mov r1, #6 bl foo pop {r11, pc}
On Apr 7, 2011, at 10:33 AM, Peter Housel wrote:> In my back-end I'd like to be able to pass dummy values to functions > that ignore them. The following code: > > declare i32 @foo(i32, i32, i32) > > define void @bar() nounwind { > entry: > %call = call i32 @foo(i32 8, i32 6, i32 undef) > ret void > } > > ends up generating (using llc -O3): > > bar: # @bar > # BB#0: # %entry > subl $12, %esp > movl %eax, 8(%esp) > movl $6, 4(%esp) > movl $8, (%esp) > calll foo > addl $12, %esp > ret > > Shouldn't the "movl %eax, 8(%esp)" be unnecessary?Yep, fixed in r129185. Thanks, -Chris
Reasonably Related Threads
- [LLVMdev] Question about fastcc assumptions and seemingly superfluous %esp updates
- [LLVMdev] Question about fastcc assumptions and seemingly superfluous %esp updates
- [LLVMdev] Question about fastcc assumptions and seemingly superfluous %esp updates
- [LLVMdev] Efficient Pattern matching in Instruction Combine
- Function calls keep increasing the stack usage