[cfe-commits] r70971 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/function-attributes.c test/CodeGen/functions.c

Eli Friedman eli.friedman at gmail.com
Tue May 5 00:22:36 PDT 2009

On Mon, May 4, 2009 at 11:16 PM, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Tue May  5 01:16:31 2009
> New Revision: 70971
> URL: http://llvm.org/viewvc/llvm-project?rev=70971&view=rev
> Log:
> When defining a function whose type has no prototype, make an effort
> to go back and clean up existing uses of the bitcasted function.  This
> is not just an optimization: it is required for correctness to get
> always inline functions to work, see testcases in function-attributes.c.

I'm curious, why do we model functions with no prototype as varargs in
the first place?  It seems more consistent with the C definition of
functions without a prototype to always bitcast to the used function
type (i.e. model "int a();int b(){return a(1);}" as "call i32 (i32)*
bitcast (i32()* @a to i32(i32)*)(i32 1)"): that way, issues like this
would get handled transparently, and we wouldn't be abusing varargs
(which would, for example, remove the need to set "%al" for such calls
on x86-64).


More information about the cfe-commits mailing list