diff mbox

Merged r183086 and r183143 from branches/google/gcc-4_6. (issue 5541046)

Message ID bcaec51b16d59caa4f04b65cee38@google.com
State New
Headers show

Commit Message

asharif@google.com Jan. 12, 2012, 11:16 p.m. UTC
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: .

Comments

Han Shen Jan. 13, 2012, 5:47 p.m. UTC | #1
LGTM

On Thu, Jan 12, 2012 at 3:16 PM, <asharif@google.com> wrote:
>
> 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  <xur@google.com>
> +       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  <xur@google.com>
> +
> +       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  <shenhan@google.com>
>        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);
>
>
diff mbox

Patch

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  <xur@google.com>
+	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  <xur@google.com>
+
+	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  <shenhan@google.com>
  	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);