From: Jan Hubicka Date: Tue, 24 Jun 2025 03:07:42 +0000 (+0200) Subject: Copy discriminators when inlining X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0235b6d41ace62064d5cd42553028136b49ad947;p=thirdparty%2Fgcc.git 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 --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc index dee2dfc2620..7e0ac698e5e 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;