Hello! Attached patch partially reverts r187375 [1]. Apparently, the patch added some new functionality to symtab_remove_unreachable_nodes, although the ChangeLog said:
Log: ... (symtab_remove_unreachable_nodes): Cleanup. It looks to me that since we changed something, we also have to update something, at least when profiling, before calling cgraph_propagate_frequency. 2012-07-04 Uros Bizjak <ubiz...@gmail.com> * ipa.c (symtab_remove_unreachable_nodes): Partially revert r187375 to not call cgraph_propagate_frequency if something was changed. testsuite/ChangLog: 2012-07-04 Uros Bizjak <ubiz...@gmail.com> * g++.dg/torture/pr53321.C: New test. Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}, also with profiled LTO bootstrap. OK for mainline? [1] http://gcc.gnu.org/ml/gcc-cvs/2012-05/msg00371.html Uros.
Index: ipa.c =================================================================== --- ipa.c (revision 189217) +++ ipa.c (working copy) @@ -449,11 +449,6 @@ symtab_remove_unreachable_nodes (bool before_inlin verify_symtab (); #endif - /* If we removed something, perhaps profile could be improved. */ - if (changed && optimize && inline_edge_summary_vec) - FOR_EACH_DEFINED_FUNCTION (node) - cgraph_propagate_frequency (node); - return changed; } Index: testsuite/g++.dg/torture/pr53321.C =================================================================== --- testsuite/g++.dg/torture/pr53321.C (revision 0) +++ testsuite/g++.dg/torture/pr53321.C (working copy) @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-require-profiling "-fprofile-generate" } +// { dg-options "-fprofile-generate" } + +typedef long unsigned int size_t; + +extern "C" +{ + extern void *memcpy (void *__dest, __const void *__src, size_t __n); +} + +extern char *src, *sources; +extern int n_sources; + +static void +find_source (const char *file_name) +{ + memcpy (src, sources, n_sources * sizeof (*sources)); +} + +extern const char *gcov_read_string (void); + +static void read_graph_file (void) +{ + find_source (gcov_read_string ()); +} + +static void process_file (void) +{ + read_graph_file (); +} + +int main () +{ + process_file (); +}