]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Copy discriminators when inlining
authorJan Hubicka <hubicka@ucw.cz>
Tue, 24 Jun 2025 03:07:42 +0000 (05:07 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Tue, 24 Jun 2025 03:09:14 +0000 (05:09 +0200)
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.

gcc/tree-inline.cc

index dee2dfc2620635fd571a8bdfc718f1dd53f14d3b..7e0ac698e5e00439f56954ec5442d76826640f72 100644 (file)
@@ -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;