Merging identical functions in GCC
Ross Ridge
rridge@csclub.uwaterloo.ca
Sat Sep 16 03:10:00 GMT 2006
Ross Ridge writes:
>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.
Daniel Berlin writes:
>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.
No, and I can't see how how you've came up with such an abusurd
misintepretation of what I said. As I said clearly and explicity,
the example I gave was where you'd want to use function merging.
>The current hash actually takes into account compiler options as a
>starting value for the hash, btw!)
Well, then that brings up the other problem I have with this, figuring
out exactly which options and which parts of the RTL should be hashed
seems to be too error prone. I think this is best done by linker which
can much more reliably compare the contents of functions to see if they
are the same.
Ross Ridge
More information about the Gcc
mailing list