[LLVMdev] Passing undef to functions
Peter Housel
housel at acm.org
Thu Apr 7 10:33:37 PDT 2011
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}
More information about the llvm-dev
mailing list