diff mbox series

[2/n] Make _INLINE_ENTRY markers have the location we finally need

Message ID alpine.LSU.2.20.1809281059450.16707@zhemvz.fhfr.qr
State New
Headers show
Series [2/n] Make _INLINE_ENTRY markers have the location we finally need | expand

Commit Message

Richard Biener Sept. 28, 2018, 9:03 a.m. UTC
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  <rguenther@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.

Comments

Alexandre Oliva Oct. 2, 2018, 2:37 a.m. UTC | #1
On Sep 28, 2018, Richard Biener <rguenther@suse.de> wrote:

> Alex - any particular reason for not doing this?

The only concern that comes to mind is a vague thought about this
possibly messing up the nesting of lexical scopes in executable code,
but I don't think that's a given to begin with, I like this move, and
I'm sure any problem along these lines that arises, if any, can be fixed
without much trouble.  So, as far as I'm concerned, go for it, and thanks!
diff mbox series

Patch

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)
 	{