Mike Stump wrote:
On Sep 15, 2006, at 2:32 PM, Ross Ridge wrote:
Also, I don't think it's safe if you merge only functions in COMDAT
sections.
Sure it is, one just needs to merge them as:
variant1: nop
variant2: nop
variant3: nop
[ ... ]
this way important inequalities still work.
Yes, that will work. But, in practice, people will also want the mode
where you do not insert the nops, and just accept that some functions
compare equal when they shouldn't. So, we should have a switch for that
mode too.
I think it's reasonable -- a priori -- to consider doing this
optimization in both the compiler and in the linker. In the compiler,
when generating a single object file, eliminate duplicates. In the
linker, when linking stuff, we can do it again. I don't think we can
know how much bang comes from either approach without measuring some
sample programs. Pick a random application (maybe an KDE office
application?) and measure how many functions, if any, in the final link
image are duplicates.
--
Mark Mitchell
CodeSourcery
[EMAIL PROTECTED]
(650) 331-3385 x713