This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
It's too far-fetched for my tastes. I think gcc should not do it. How gcc can know what printf() and puts() mean in *my* libc?
Well, that's what -fno-builtin is for.
I think such optimizations should be done in glibc.
The point is that you can't. GCC knows if an argument is a string
literal
char *x; ... printf ("foo %s bar", x);
fp = stdout; fputs ("foo ", fp); fputs (x, fp); fputs (" bar", fp);
How do you know that in this place user wants faster, not smaller code?sprintf(dest, "%dconstant%...", args1, args...) -> sprintf(dest, "%d", args1); memcpy(dest+X, "constant", 8); sprintf(dest+XX, "%...", args...);
I suppose we would only do the transformations that have a speed-space tradeoff with -O3, and not with -Os.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |