https://gcc.gnu.org/g:0235b6d41ace62064d5cd42553028136b49ad947

commit r16-1642-g0235b6d41ace62064d5cd42553028136b49ad947
Author: Jan Hubicka <hubi...@ucw.cz>
Date:   Tue Jun 24 05:07:42 2025 +0200

    Copy discriminators when inlining
    
    When inlining disciriminator info about the call statement is lost which
    is not good for auto-profile and debug info quality.  This patch fixes
    it.
    
    gcc/ChangeLog:
    
            * tree-inline.cc (expand_call_inline): Preserve discriminator.

Diff:
---
 gcc/tree-inline.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index dee2dfc26206..7e0ac698e5e0 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -5018,6 +5018,9 @@ expand_call_inline (basic_block bb, gimple *stmt, 
copy_body_data *id,
        loc = LOCATION_LOCUS (DECL_SOURCE_LOCATION (fn));
       if (loc == UNKNOWN_LOCATION)
        loc = BUILTINS_LOCATION;
+      if (has_discriminator (gimple_location (stmt)))
+       loc = location_with_discriminator
+               (loc, get_discriminator_from_loc (gimple_location (stmt)));
       id->block = make_node (BLOCK);
       BLOCK_ABSTRACT_ORIGIN (id->block) = DECL_ORIGIN (fn);
       BLOCK_SOURCE_LOCATION (id->block) = loc;

Reply via email to