Related articles |
---|
Optimizing empty functions in C wasowski@data.pl (Andrzej Wasowski) (2002-06-13) |
Re: Optimizing empty functions in C joachim_d@gmx.de (Joachim Durchholz) (2002-06-14) |
Re: Optimizing empty functions in C mlacey@microsoft.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 fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-07-02) |
From: | "Fergus Henderson" <fjh@cs.mu.OZ.AU> |
Newsgroups: | comp.compilers |
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 |
Keywords: | C, optimize |
Posted-Date: | 02 Jul 2002 01:15:44 EDT |
"Peter L. Montgomery" <Peter-Lawrence.Montgomery@cwi.nl> writes:
>"Mark Lacey \[MSFT\]" <mlacey@microsoft.com> 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
>>by default.
>
>/* 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 <fjh@cs.mu.oz.au> | "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
comp.compilers page.
Search the
comp.compilers archives again.