Merging identical functions in GCC

Daniel Berlin dberlin@dberlin.org
Sat Sep 16 01:44:00 GMT 2006


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!)



More information about the Gcc mailing list