|Optimizing empty functions in C email@example.com (Andrzej Wasowski) (2002-06-13)|
|Re: Optimizing empty functions in C firstname.lastname@example.org (Joachim Durchholz) (2002-06-14)|
|Re: Optimizing empty functions in C email@example.com (Mark Lacey \[MSFT\]) (2002-06-20)|
|Re: Optimizing empty functions in C Peter-Lawrence.Montgomery@cwi.nl (Peter L. Montgomery) (2002-06-28)|
|Re: Optimizing empty functions in C firstname.lastname@example.org.OZ.AU (Fergus Henderson) (2002-07-02)|
|From:||"Fergus Henderson" <email@example.com.OZ.AU>|
|Date:||2 Jul 2002 01:15:45 -0400|
|Organization:||Computer Science, University of Melbourne|
|References:||02-06-025 02-06-042 02-06-068 02-06-081|
|Posted-Date:||02 Jul 2002 01:15:44 EDT|
"Peter L. Montgomery" <Peter-Lawrence.Montgomery@cwi.nl> writes:
>"Mark Lacey \[MSFT\]" <firstname.lastname@example.org> writes:
>>The Microsoft Visual C++ toolset will eliminate duplicated functions
>>through a process it calls "identical COMDAT folding" (ICF). By
>>specifying -O1 or -O2 for the compilation and -opt:icf as a link
>>option, you get this effect. For elimination of (statically)
>>unreferenced functions, you again need either -O1 or -O2 on the
>>compilation and -opt:ref as a link option. -opt:ref implies -opt:icf
>/* Does standard C require twice_1 to compare unequal to twice_2? */
Yes, it does. So a conforming compiler can't treat them as identical.
It can however replace the body of one function with a jump to the
other one. This achieves most of the space savings from merging
duplicate functions (e.g. those that arise from C++ templates), albeit
at the cost of a small increase in execution time for the extra jumps,
which may be outweighed by the reduction in icache misses.
Fergus Henderson <email@example.com> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
Return to the
Search the comp.compilers archives again.