The following patch makes the inliner assign the decl location of the function we inline to the inline-entry marker which is what we later need when processing line info. This avoids the need to keep the actual FUNCTION_DECL live until that point. It avoids streaming it to LTO and allows us to simply stick a reference to an early created DIE in BLOCK_ABSTRACT_ORIGIN, which is why it is in this series.
Alex - any particular reason for not doing this? Bootstrap & regtest running on x86_64-unknown-linux-gnu (but I do not expect testsuite coverage for this...) Richard. 2018-09-28 Richard Biener <rguent...@suse.de> * tree-inline.c (expand_call_inline): Use the location of the callee declaration for the inline-entry marker. * final.c (notice_source_line): Remove special-casing of NOTE_INSN_INLINE_ENTRY. Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 264686) +++ gcc/tree-inline.c (working copy) @@ -4592,7 +4592,8 @@ expand_call_inline (basic_block bb, gimp { gimple_stmt_iterator si = gsi_last_bb (bb); gsi_insert_after (&si, gimple_build_debug_inline_entry - (id->block, input_location), GSI_NEW_STMT); + (id->block, DECL_SOURCE_LOCATION (id->src_fn)), + GSI_NEW_STMT); } if (DECL_INITIAL (fn)) Index: gcc/final.c =================================================================== --- gcc/final.c (revision 264686) +++ gcc/final.c (working copy) @@ -3224,17 +3224,6 @@ notice_source_line (rtx_insn *insn, bool if (NOTE_MARKER_P (insn)) { location_t loc = NOTE_MARKER_LOCATION (insn); - /* The inline entry markers (gimple, insn, note) carry the - location of the call, because that's what we want to carry - during compilation, but the location we want to output in - debug information for the inline entry point is the location - of the function itself. */ - if (NOTE_KIND (insn) == NOTE_INSN_INLINE_ENTRY) - { - tree block = LOCATION_BLOCK (loc); - tree fn = block_ultimate_origin (block); - loc = DECL_SOURCE_LOCATION (fn); - } expanded_location xloc = expand_location (loc); if (xloc.line == 0) {