[cfe-dev] Emitted code for zero-arg functions

Eli Friedman eli.friedman at gmail.com
Thu Jun 11 11:58:26 PDT 2009


On Thu, Jun 11, 2009 at 5:01 AM, Arto Vuori<vuoria at tcs.hut.fi> wrote:
> Is this expected behaviour that clang emits a bitcast from
> a function with no arguments to a vararg function in the
> 'call' instruction considering the following C program:
>
>     void foo();
>     void foo() { }
>     int main(void) { foo(); return 0; }
>
> Clang emits the following 'call' instruction:
>
>     call void (...)* bitcast (void ()* @foo to void (...)*)()
>
> In contrast llvm-gcc emits simply:
>
>     call void @foo() nounwind

gcc has a bunch of folding optimizations at -O0 which clang doesn't
match.  That said, this particular case is a bug because it messes up
the always_inline attribute implementation; I just filed
http://llvm.org/bugs/show_bug.cgi?id=4372 .

-Eli




More information about the cfe-dev mailing list