diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2019-12-10 18:46:33 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2019-12-10 17:46:33 +0000 |
commit | 12651dc6dcaafb3c8a5cdfc10b7bc25e6f62cb33 (patch) | |
tree | bc81f13c4fcb1f14bd0321ba983a29e262dff723 /gcc | |
parent | 91fd16a7bddb7d0f63d7b4b4038b4a9eb8787678 (diff) | |
download | gcc-12651dc6dcaafb3c8a5cdfc10b7bc25e6f62cb33.zip gcc-12651dc6dcaafb3c8a5cdfc10b7bc25e6f62cb33.tar.gz gcc-12651dc6dcaafb3c8a5cdfc10b7bc25e6f62cb33.tar.bz2 |
varasm.c (default_function_section): Fix confused tests for tp_first_run reordering.
* varasm.c (default_function_section): Fix confused tests for
tp_first_run reordering.
From-SVN: r279176
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/varasm.c | 15 |
2 files changed, 13 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f848de6..627d1bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-12-10 Jan Hubicka <hubicka@ucw.cz> + + * varasm.c (default_function_section): Fix confused tests for + tp_first_run reordering. + 2019-12-10 Richard Sandiford <richard.sandiford@arm.com> * config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Don't diff --git a/gcc/varasm.c b/gcc/varasm.c index d9d02b3..f6ed0ea 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -589,9 +589,13 @@ default_function_section (tree decl, enum node_frequency freq, where we can split away unnecessary parts of static constructors. */ if (startup && freq != NODE_FREQUENCY_UNLIKELY_EXECUTED) { - /* 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) + /* During LTO the tp_first_run profiling will naturally place all + initialization code first. Using separate section is counter-productive + because startup only code may call functions which are no longer + startup only. */ + if (!in_lto_p + || !cgraph_node::get (decl)->tp_first_run + || !opt_for_fn (decl, flag_profile_reorder_functions)) return get_named_text_section (decl, ".text.startup", NULL); else return NULL; @@ -607,10 +611,7 @@ default_function_section (tree decl, enum node_frequency freq, case NODE_FREQUENCY_UNLIKELY_EXECUTED: return get_named_text_section (decl, ".text.unlikely", NULL); case NODE_FREQUENCY_HOT: - /* 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 get_named_text_section (decl, ".text.hot", NULL); + return get_named_text_section (decl, ".text.hot", NULL); /* FALLTHRU */ default: return NULL; |