From 7e2f40afd4011439eee2750ca2a45f7bbd523f44 Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Thu, 17 Aug 2006 02:13:24 +0200 Subject: [PATCH] PR gcov/profile/26570 PR gcov/profile/26570 * value-prof.c (static_values): Removed. (tree_find_values_to_profile): Do not set static_values. (find_values_to_profile): Do not free static_values. * profile.c (instrument_values): Do not free the values. (branch_prob): Free the values. * gcc.dg/pr26570.c: New test. From-SVN: r116197 --- gcc/ChangeLog | 9 +++++++++ gcc/profile.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr26570.c | 14 ++++++++++++++ gcc/value-prof.c | 11 +---------- 5 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr26570.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 31adfc7401d..f4c0ff4b479 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2006-08-16 Zdenek Dvorak + + PR gcov/profile/26570 + * value-prof.c (static_values): Removed. + (tree_find_values_to_profile): Do not set static_values. + (find_values_to_profile): Do not free static_values. + * profile.c (instrument_values): Do not free the values. + (branch_prob): Free the values. + 2006-08-16 Naveen.H.S * config/m32c/m32c_lib1.S (__mulsi3): Use only registers for dest. diff --git a/gcc/profile.c b/gcc/profile.c index 4e2213a6e2d..9b493095684 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -220,7 +220,6 @@ instrument_values (histogram_values values) gcc_unreachable (); } } - VEC_free (histogram_value, heap, values); } @@ -1049,6 +1048,7 @@ branch_prob (void) free_aux_for_edges (); + VEC_free (histogram_value, heap, values); free_edge_list (el); if (flag_branch_probabilities) profile_status = PROFILE_READ; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce97baf7965..9a6bf5666f7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-08-16 Zdenek Dvorak + + PR gcov/profile/26570 + * gcc.dg/pr26570.c: New test. + 2006-08-16 Joseph S. Myers PR c/27697 diff --git a/gcc/testsuite/gcc.dg/pr26570.c b/gcc/testsuite/gcc.dg/pr26570.c new file mode 100644 index 00000000000..9041ee41ee0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr26570.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-generate -fprofile-use" } */ + +unsigned test (unsigned a, unsigned b) +{ + return a / b; +} /* { dg-warning "execution counts estimated" } */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-generate -fprofile-use" } */ + +unsigned test (unsigned a, unsigned b) +{ + return a / b; +} /* { dg-warning "execution counts estimated" } */ diff --git a/gcc/value-prof.c b/gcc/value-prof.c index e273a40f9c9..6c64e3cbe27 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -46,12 +46,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA static struct value_prof_hooks *value_prof_hooks; -/* This is the vector of histograms. Created in find_values_to_profile. - During profile generation, freed by instrument_values. - During profile use, freed by value_profile_transformations. */ - -static histogram_values static_values = NULL; - /* In this file value profile based optimizations are placed. Currently the following optimizations are implemented (for more detailed descriptions see comments at value_profile_transformations): @@ -797,7 +791,6 @@ tree_find_values_to_profile (histogram_values *values) FOR_EACH_BB (bb) for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) tree_values_to_profile (bsi_stmt (bsi), values); - static_values = *values; for (i = 0; VEC_iterate (histogram_value, *values, i, hist); i++) { @@ -875,9 +868,7 @@ find_values_to_profile (histogram_values *values) bool value_profile_transformations (void) { - bool retval = (value_prof_hooks->value_profile_transformations) (); - VEC_free (histogram_value, heap, static_values); - return retval; + return (value_prof_hooks->value_profile_transformations) (); }