re PR gcov-profile/30650 (ICE with -fprofile-use)
authorJan Hubicka <jh@suse.cz>
Sat, 3 Feb 2007 23:35:42 +0000 (00:35 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 3 Feb 2007 23:35:42 +0000 (23:35 +0000)
PR gcov-profile/30650
* value-prof.c (stringop_block_profile): Fix handling of size counter;
do not divide by zero for never executed counters.
(tree_find_values_to_profile): Fix counters.
* gcov-ui.h (GCOV_COUNTER_AVERAGE, GCOV_COUNTER_IOR): Fix comments.

From-SVN: r121554

gcc/ChangeLog
gcc/gcov-io.h
gcc/value-prof.c

index 77e9964be1997f2701e6bff8c798f9f77e1caca2..d8ee26993cd913f7b5d7ceabf37ebf059572da73 100644 (file)
@@ -1,3 +1,11 @@
+2007-02-03  Jan Hubicka  <jh@suse.cz>
+
+       PR gcov-profile/30650
+       * value-prof.c (stringop_block_profile): Fix handling of size counter;
+       do not divide by zero for never executed counters.
+       (tree_find_values_to_profile): Fix counters.
+       * gcov-ui.h (GCOV_COUNTER_AVERAGE, GCOV_COUNTER_IOR): Fix comments.
+
 2007-02-03  Ian Lance Taylor  <iant@google.com>
 
        * lower-subreg.c (simple_move_operand): New static function,
index 61f3c667d2e1396418290b874706487817ebb0f7..a874b32dc629d20a2ab3480a4534d49bf6b2ef89 100644 (file)
@@ -329,10 +329,10 @@ typedef HOST_WIDEST_INT gcov_type;
                                      consecutive values of expression.  */
 
 #define GCOV_COUNTER_V_INDIR   5  /* The most common indirect address */
-#define GCOV_COUNTER_AVERAGE   6  /* The most common difference between
-                                     consecutive values of expression.  */
-#define GCOV_COUNTER_IOR       7  /* The most common difference between
-                                     consecutive values of expression.  */
+#define GCOV_COUNTER_AVERAGE   6  /* Compute average value passed to the
+                                     counter.  */
+#define GCOV_COUNTER_IOR       7  /* IOR of the all values passed to
+                                     counter.  */
 #define GCOV_LAST_VALUE_COUNTER 7  /* The last of counters used for value
                                      profiling.  */
 #define GCOV_COUNTERS          8
index 0d5f0411e1d1aa0a7e8058cc57b720ba013c8395..b03e6777ae8f91b5a271e0937bf9f77deb2a79d5 100644 (file)
@@ -1434,12 +1434,17 @@ stringop_block_profile (tree stmt, unsigned int *expected_align,
   histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_AVERAGE);
   if (!histogram)
     *expected_size = -1;
+  else if (!histogram->hvalue.counters[1])
+    {
+      *expected_size = -1;
+      gimple_remove_histogram_value (cfun, stmt, histogram);
+    }
   else
     {
       gcov_type size;
       size = ((histogram->hvalue.counters[0]
-             + histogram->hvalue.counters[0] / 2)
-              / histogram->hvalue.counters[0]);
+             + histogram->hvalue.counters[1] / 2)
+              / histogram->hvalue.counters[1]);
       /* Even if we can hold bigger value in SIZE, INT_MAX
         is safe "infinity" for code generation strategies.  */
       if (size > INT_MAX)
@@ -1450,6 +1455,11 @@ stringop_block_profile (tree stmt, unsigned int *expected_align,
   histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_IOR);
   if (!histogram)
     *expected_align = 0;
+  else if (!histogram->hvalue.counters[0])
+    {
+      gimple_remove_histogram_value (cfun, stmt, histogram);
+      *expected_align = 0;
+    }
   else
     {
       gcov_type count;
@@ -1661,11 +1671,11 @@ tree_find_values_to_profile (histogram_values *values)
          break;
 
        case HIST_TYPE_AVERAGE:
-         hist->n_counters = 3;
+         hist->n_counters = 2;
          break;
 
        case HIST_TYPE_IOR:
-         hist->n_counters = 3;
+         hist->n_counters = 1;
          break;
 
        default: