This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Merging identical functions in GCC
- From: "Daniel Berlin" <dberlin at dberlin dot org>
- To: "Ross Ridge" <rridge at csclub dot uwaterloo dot ca>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 15 Sep 2006 21:44:13 -0400
- Subject: Re: Merging identical functions in GCC
- References: <E1GOLIP-0008Gh-TX@caffeine.csclub.uwaterloo.ca>
On 9/15/06, Ross Ridge <rridge@csclub.uwaterloo.ca> wrote:
Ian Lance Taylor wrote:
>I think Danny has a 75% implementation based on hashing the RTL for a
>section and using that to select the COMDAT section signature.
I don't think this is a good idea. With different compiler options the
same RTL can generate different assembly instructions. Consider the case
of compiling the same function multiple times with different names and
different CPU architectures selected. You'd actually want the linker
to merge the functions that ended up having the same assembly, but not
the ones with the same RTL but different assembly.
So basically you are saying if you don't know what you are doing, or
know you don't want to use it, you shouldn't be using it.
I'd agree with that :)
(The current hash actually takes into account compiler options as a
starting value for the hash, btw!)