[LLVMdev] [RFC] NoBuiltin Attribute

Krzysztof Parzyszek kparzysz at codeaurora.org
Wed Feb 20 09:03:01 PST 2013


On 2/20/2013 10:40 AM, David Blaikie wrote:
>
> 2) annotate functions
> Pro: you don't penalize indirect calls
> Con: you either penalize functions that are inlined into, or you avoid
> inlining.

Another problem here is that if foo is marked as no-builtin-printf, then 
any function inlined into foo would "inherit" that attribute.  So, the 
inlining penalty works on both sides---whoever inlines it gets it, and 
whoever is inlined into it gets it.


> Were there any other options being considered or benefits/drawbacks of
> these options?

My original thought was to associate the no-builtin attribute with the 
prototype of the builtin that it not to be optimized.  The problem with 
that was that it wouldn't work well with LTO in cases where different 
CUs had different options.  In other words, movement of code across such 
CUs would be very restricted (or completely prohibited), if we don't 
want to pessimize the attributes to the "common denominator".  On the 
other hand, prototypes have this advantage that they can provide 
centralized information about a specific function without having a 
definition of that function.  Indirect call instructions would not be 
affected by the no-builtin attribute since if (after resolving the 
indirect call) the target function turns out to be printf, a lookup for 
the attribute on the printf's prototype would tell us that it's a 
"no-builtin".

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list