Hi Martin, Thanks for working on this! --- However you have introduced some problems including a bootstrap fail on darwin.
On 16 Dec 2013, at 10:13, Jan Hubicka wrote: >> Hello, >> there's updated version of the patch. >> >> Tested on x86_64 with enable bootstrap. >> >> Martin >> >> On 16 December 2013 00:21, Jan Hubicka <hubi...@ucw.cz> wrote: >>>> diff --git a/gcc/ChangeLog b/gcc/ChangeLog >>>> index 93e857df..d5a0ac8 100644 >>>> --- a/gcc/ChangeLog >>>> +++ b/gcc/ChangeLog >>>> @@ -1,3 +1,14 @@ >>>> +2013-12-15 Martin Liska <marxin.li...@gmail.com> >>>> + Jan Hubicka <j...@suse.cz> >>>> + >>>> + * cgraphunit.c (node_cmp): New function. >>>> + (expand_all_functions): Function ordering added. >>>> + * common.opt: New profile based function reordering flag introduced. >>>> + * lto-partition.c: Support for time profile added. >>>> + * lto.c: Likewise. >>>> + * predict.c (handle_missing_profiles): Time profile handled in >>>> + missing profiles. >>>> + There is no mention of config/darwin.c here ^ ---- diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index ea056a9..4267c89 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -3621,9 +3621,16 @@ darwin_function_section (tree decl, enum node_frequency freq, unlikely executed (this happens especially with function splitting where we can split away unnecessary parts of static constructors). */ if (startup && freq != NODE_FREQUENCY_UNLIKELY_EXECUTED) - return (weak) - ? darwin_sections[text_startup_coal_section] - : darwin_sections[text_startup_section]; + { + /* If we do have a profile or(and) LTO phase is executed, we do not need + these ELF section. */ + if (!in_lto_p || !flag_profile_values) + return (weak) + ? darwin_sections[text_startup_coal_section] + : darwin_sections[text_startup_section]; + else + return text_section; + } /* Similarly for exit. */ if (exit && freq != NODE_FREQUENCY_UNLIKELY_EXECUTED) @@ -3640,10 +3647,15 @@ darwin_function_section (tree decl, enum node_frequency freq, : darwin_sections[text_cold_section]; break; case NODE_FREQUENCY_HOT: - return (weak) - ? darwin_sections[text_hot_coal_section] - : darwin_sections[text_hot_section]; - break; + { + /* If we do have a profile or(and) LTO phase is executed, we do not need + these ELF section. */ + if (!in_lto_p || !flag_profile_values) + return (weak) + ? darwin_sections[text_hot_coal_section] + : darwin_sections[text_hot_section]; + break; + } default: return (weak) ? darwin_sections[text_coal_section] -===== This is NOT OK for darwin, it breaks bootstrap with pr59541. If one fixes that trivial issue - then there is a lot of test-suite fallout of profiled code. Please explain what the logic is intended to implement - and ensure that all the code-paths have equivalent treatment - it all looks inconsitent to me at present. I am sure that one of the darwin folks will be happy to review (or at least test) changes. cheers Iain