Hi,
auto-fdo is currently confused by a fact that all inlined functions get
locators with 0 discriminator, so it is not bale to distinguish multiple
inlined calls from single line.

Discriminator is lost by calling LOCATION_LOCUS before copying it from
former call statement.  I believe this is only intended to drop block
annotations.

Bootstrapped/regtested x86_64-linux, OK?

gcc/ChangeLog:

        * tree-inline.cc (expand_call_inline): Preserve discriminator.

diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index dee2dfc2620..fa2641780a5 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -5014,6 +5014,9 @@ expand_call_inline (basic_block bb, gimple *stmt, 
copy_body_data *id,
       /* We do want to assign a not UNKNOWN_LOCATION BLOCK_SOURCE_LOCATION
          to make inlined_function_outer_scope_p return true on this BLOCK.  */
       location_t loc = LOCATION_LOCUS (gimple_location (stmt));
+      if (loc != UNKNOWN_LOCATION)
+       loc = location_with_discriminator
+               (loc, get_discriminator_from_loc (gimple_location (stmt)));
       if (loc == UNKNOWN_LOCATION)
        loc = LOCATION_LOCUS (DECL_SOURCE_LOCATION (fn));
       if (loc == UNKNOWN_LOCATION)

Reply via email to