[llvm-commits] r55638 - /llvm/trunk/include/llvm/Function.h

Duncan Sands baldrick at free.fr
Tue Sep 23 01:27:53 PDT 2008


> > I guess that I don't understand what you're saying here.  Are you
> > saying that there should be two "namespaces", one for function
> > attributes and one for arg/retval attributes?
>
> Yes. parameter attributes are associated with an arguments. Function
> note is associated with function definition.
>
> > Are you saying that attributes are distinct from notes because
> > attributes are applied to call sites also?
>
> yes, some of the attributes are (e.g. signext) are used in call
> instruction also. Function notes are never specified at call site.

I think specifying noinline or alwaysinline at a call site makes
sense.  It means: don't inline (or always inline) this callsite!
Thus you could have a function that is not itself marked noinline,
but a few special callsites that are marked noinline.  I see no
reason not to make these function attributes.

I thought opt-size was different, and meant: if F is marked opt-size,
then don't inline things into it if that will make F fat.  I peeked
inside the inliner and saw that it seems to mean: only inline F into
callers of F if it won't make them (and not F) fat.  So in fact it is
being used by the inliner exactly like a function attribute
and as such would also make sense to be able to place it on callsites
(meaning: only inline this callsite if it won't fatten it too much).
However other places that use the opt-size note are trying not to make
F itself fat, not callers of F.  So I suspect this was a thinko in the
inliner more than anything else, and that the logic should be: when
inlining into F, only do it if it won't make F fat.

Ciao,

Duncan.



More information about the llvm-commits mailing list