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  <x...@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

Reply via email to