Hi,
This patch silences warning about bad location in function_instance::match
warning about profile containing record for line numbers that are not matched
by the function body.  While this is a bogus profile (and we will end up losing
the profile data), create_gcov does not have enough information to output them
correctly in all contexts since in dwarf5 we output multiple locations per 
single
instructions (possibly comming from different inlines) while it can only 
represent
one inline stack.

The patch also fixes issue with profile scaling.   By making force_nonzero to
take into account cutoffs, I made the test for counter being non-zero before 
scaling
too agressive.

Bootstrapped/regtested x86_64-linux, committed.

gcc/ChangeLog:

        * auto-profile.cc (function_instance::match): Disable warning
        about bogus locations since dwarf does not represent enough
        info to output them correctly in all cases.
        (add_scale): Use nonzero_p instead of orig.force_nonzero () == orig.
        (afdo_adjust_guessed_profile): Add missing newline in dump
        file.

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index d1954b4fad6..da8e58d4cce 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -1629,7 +1701,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),
@@ -3425,7 +3542,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 +3789,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 ());

Reply via email to