[LLVMdev] [RFC] NoBuiltin Attribute
Krzysztof Parzyszek
kparzysz at codeaurora.org
Tue Feb 19 11:08:34 PST 2013
On 2/19/2013 12:26 PM, Chris Lattner wrote:
>
> void foo() {
> auto fp = printf;
> fp("xyz\n");
> }
>
> With -fno-builtin-printf, we can't optimize the call to printf, even though it only becomes apparent after (trivial) devirtualization.
Ha. Good example.
What would you expect to happen in this case?
--- a.cpp --- (with -fno-builtin-printf)
pointer fptr;
void foo(bool x) {
bar(x);
}
void set(bool x) {
if (x) fptr = printf;
else fptr = vprintf;
}
-------------
--- b.cpp --- (no restrictions)
extern pointer fptr;
void bar(bool x) {
set(x);
va_list ap = ...
(*fptr)("haha", ap);
}
-------------
Also, with the options reversed.
-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