[LLVMdev] Passing undef to functions

Chris Lattner clattner at apple.com
Fri Apr 8 19:36:48 PDT 2011


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



More information about the llvm-dev mailing list