Reviewers: xur, shenhan, jingyu, Message: This merges in the fix for ICE when using PGO when building Chrome.
Please review this at http://codereview.appspot.com/5541046/ Affected files: M . M gcc/ChangeLog.google-4_6 M gcc/profile.c Index: . =================================================================== --- . (revision 183143) +++ . (working copy) Property changes on: . ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/google/gcc-4_6:r183086,183143 Index: gcc/ChangeLog.google-4_6 =================================================================== --- gcc/ChangeLog.google-4_6 (revision 183143) +++ gcc/ChangeLog.google-4_6 (working copy) @@ -1,3 +1,16 @@ +2012-01-12 Rong Xu <[email protected]> + Backport r183142 from google/main + + * gcc/profile.c (compute_value_histograms): ignore the + histrogram when the counters not found in gcda file. + +2012-01-10 Rong Xu <[email protected]> + + Backport r183081 from google/main + + * gcc/profile.c (compute_value_histograms): handle the + case when INDIR_CALL counters not available in gcda files. + 2011-12-19 Han Shen <[email protected]> Add a new option "-fstack-protector-strong". * cfgexpand.c (expand_used_vars): Add logic handling Index: gcc/profile.c =================================================================== --- gcc/profile.c (revision 183143) +++ gcc/profile.c (working copy) @@ -790,9 +790,14 @@ gcov_type *histogram_counts[GCOV_N_VALUE_COUNTERS]; gcov_type *act_count[GCOV_N_VALUE_COUNTERS]; gcov_type *aact_count; + bool warned[GCOV_N_VALUE_COUNTERS]; + static const char *const ctr_names[] = GCOV_COUNTER_NAMES; for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++) - n_histogram_counters[t] = 0; + { + n_histogram_counters[t] = 0; + warned[t] = 0; + } for (i = 0; i < VEC_length (histogram_value, values); i++) { @@ -828,6 +833,19 @@ t = (int) hist->type; aact_count = act_count[t]; + /* If cannot find the counters in gcda file, skip and give + a warning. */ + if (aact_count == 0) + { + if (!warned[t] && flag_opt_info >= OPT_INFO_MIN) + warning (0, "cannot find %s counters in function %s.", + ctr_names[COUNTER_FOR_HIST_TYPE(t)], + IDENTIFIER_POINTER ( + DECL_ASSEMBLER_NAME (current_function_decl))); + hist->n_counters = 0; + warned[t] = true; + continue; + } act_count[t] += hist->n_counters; gimple_add_histogram_value (cfun, stmt, hist);
