aboutsummaryrefslogtreecommitdiff
path: root/gcc/auto-profile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/auto-profile.cc')
-rw-r--r--gcc/auto-profile.cc24
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index d1954b4..7ff9526 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -885,6 +885,8 @@ string_table::read ()
{
vector_.quick_push (xstrdup (gcov_read_string ()));
map_[vector_.last ()] = i;
+ if (gcov_is_error ())
+ return false;
}
return true;
}
@@ -1629,7 +1631,13 @@ function_instance::match (cgraph_node *node,
if (iter->first != end_location
&& iter->first != start_location
&& (iter->first & 65535) != zero_location
- && iter->first)
+ && iter->first
+ /* FIXME: dwarf5 does not represent inline stack of debug
+ statements and consequently create_gcov is sometimes
+ mixing up statements from other functions. Do not warn
+ user about this until this problem is solved.
+ We still write info into dump file. */
+ && 0)
{
if (!warned)
warned = warning_at (DECL_SOURCE_LOCATION (node->decl),
@@ -2741,14 +2749,22 @@ read_profile (void)
/* autofdo_source_profile. */
afdo_source_profile = autofdo_source_profile::create ();
- if (afdo_source_profile == NULL)
+ if (afdo_source_profile == NULL
+ || gcov_is_error ())
{
error ("cannot read function profile from %s", auto_profile_file);
+ delete afdo_source_profile;
+ afdo_source_profile = NULL;
return;
}
/* autofdo_module_profile. */
fake_read_autofdo_module_profile ();
+ if (gcov_is_error ())
+ {
+ error ("cannot read module profile from %s", auto_profile_file);
+ return;
+ }
}
/* From AutoFDO profiles, find values inside STMT for that we want to measure
@@ -3425,7 +3441,7 @@ add_scale (vec <scale> *scales, profile_count annotated, profile_count orig)
annotated.dump (dump_file);
fprintf (dump_file, "\n");
}
- if (orig.force_nonzero () == orig)
+ if (orig.nonzero_p ())
{
sreal scale
= annotated.guessed_local ()
@@ -3672,7 +3688,7 @@ afdo_adjust_guessed_profile (bb_set *annotated_bb)
{
if (dump_file)
fprintf (dump_file,
- " Can not determine count from the boundary; giving up");
+ " Can not determine count from the boundary; giving up\n");
continue;
}
gcc_checking_assert (scales.length ());