summaryrefslogtreecommitdiff
path: root/gcc/value-prof.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-03 23:35:42 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-03 23:35:42 +0000
commit553eb299aadfe54096cf60a3331eb520e169e0f6 (patch)
treed998d2832e7420def69a99beb6da3a0cadc8cdf5 /gcc/value-prof.c
parent67c3f5800258cc7f24b26b3a62e43eb30eee6df4 (diff)
downloadgcc-553eb299aadfe54096cf60a3331eb520e169e0f6.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121554 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/value-prof.c')
-rw-r--r--gcc/value-prof.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 0d5f0411e1d..b03e6777ae8 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -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: