[LLVMdev] missed optimizations

Eli Friedman eli.friedman at gmail.com
Fri Sep 5 01:57:19 PDT 2008


On Fri, Sep 5, 2008 at 1:03 AM, Matthijs Kooijman <matthijs at stdin.nl> wrote:
> Hi Eli,
>
>> That said, clang really should be turning int x2() { return x(0); }
>> into "define i32 @x2()" rather than "define i32 @x2(...)"; the
>> function isn't varargs, and marking it as such could lead to wrong
>> code for exotic calling conventions.
> I always understood that this is correct per C language specification.

What's the question here?  The C standard says that int(*)() is not a
varargs function, but rather a function without an explicitly declared
argument list, and is actually incompatible with any varargs function.

As far as I can tell, though, the LLVM varargs specifier is more
forgiving; llvm-gcc seems to be willing to call int(*)() using an llvm
varargs type.

>
> Any particular reason the inliner doesn't touch varargs? I think that when you
> call a varargs function without any varargs, it should be able to inline it
> just fine? Or at least when the function in question also doesn't call the
> va_* functions.

I think it's just unimplemented.

-Eli



More information about the llvm-dev mailing list