diff mbox

[google] fix ICE when using LIPO profiles for FDO (issue5500068)

Message ID 20111222001203.3F37EC0921@rong.mtv.corp.google.com
State New
Headers show

Commit Message

Rong Xu Dec. 22, 2011, 12:12 a.m. UTC
This patch is for google_main branch only.

This patch fixes the ICE when using LIPO profiles for regular FDO
compilation. LIPO has INDIR_CALL_TOPN profiles while FDO has
INDIR_CALL profile.

Tested with SPEC2000 INT (with -Wno-coverage-mismatch to work around
the minor pass difference b/w LIPO and FDO)


-Rong

2011-12-21   Rong Xu  <xur@google.com>

	* gcc/profile.c (compute_value_histograms): handle the
          case when INDIR_CALL counters not available in gcda files.


--
This patch is available for review at http://codereview.appspot.com/5500068

Comments

Xinliang David Li Dec. 27, 2011, 7:21 a.m. UTC | #1
ok for google branches

David

On Wed, Dec 21, 2011 at 4:12 PM, Rong Xu <xur@google.com> wrote:
> This patch is for google_main branch only.
>
> This patch fixes the ICE when using LIPO profiles for regular FDO
> compilation. LIPO has INDIR_CALL_TOPN profiles while FDO has
> INDIR_CALL profile.
>
> Tested with SPEC2000 INT (with -Wno-coverage-mismatch to work around
> the minor pass difference b/w LIPO and FDO)
>
>
> -Rong
>
> 2011-12-21   Rong Xu  <xur@google.com>
>
>        * gcc/profile.c (compute_value_histograms): handle the
>          case when INDIR_CALL counters not available in gcda files.
>
> Index: gcc/profile.c
> ===================================================================
> --- gcc/profile.c       (revision 182415)
> +++ gcc/profile.c       (working copy)
> @@ -828,6 +828,19 @@
>       t = (int) hist->type;
>
>       aact_count = act_count[t];
> +      if (aact_count == 0)
> +        {
> +          /* this can only happen when FDO uses LIPO profiles where
> +             we have HIST_TYPE_INDIR_CALL_TOPN counters in gcda
> +             files.  */
> +          gcc_assert (hist->type == HIST_TYPE_INDIR_CALL);
> +          if (flag_opt_info >= OPT_INFO_MIN)
> +            warning (0, "cannot find INDIR_CALL counters. "
> +                        "Using LIPO profiles?\n",
> +                     DECL_ASSEMBLER_NAME (current_function_decl));
> +          hist->n_counters = 0;
> +          continue;
> +        }
>       act_count[t] += hist->n_counters;
>
>       gimple_add_histogram_value (cfun, stmt, hist);
>
> --
> This patch is available for review at http://codereview.appspot.com/5500068
diff mbox

Patch

Index: gcc/profile.c
===================================================================
--- gcc/profile.c	(revision 182415)
+++ gcc/profile.c	(working copy)
@@ -828,6 +828,19 @@ 
       t = (int) hist->type;
 
       aact_count = act_count[t];
+      if (aact_count == 0)
+        {
+          /* this can only happen when FDO uses LIPO profiles where
+             we have HIST_TYPE_INDIR_CALL_TOPN counters in gcda
+             files.  */
+          gcc_assert (hist->type == HIST_TYPE_INDIR_CALL);
+          if (flag_opt_info >= OPT_INFO_MIN)
+            warning (0, "cannot find INDIR_CALL counters. "
+                        "Using LIPO profiles?\n",
+                     DECL_ASSEMBLER_NAME (current_function_decl));
+          hist->n_counters = 0;
+          continue;
+        }
       act_count[t] += hist->n_counters;
 
       gimple_add_histogram_value (cfun, stmt, hist);