diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2020-12-07 12:00:00 +0100 |
---|---|---|
committer | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2020-12-10 13:44:39 +0100 |
commit | 2e6562043c48c0ae6bc9823d438685269eb11aab (patch) | |
tree | 07d50e82b640b2152ad9a7a0b6738ec3dca58e12 /gcc/tree-ssa-live.c | |
parent | a1fb16e5472fded44181dd8938f2ba3cbe9844b6 (diff) | |
download | gcc-2e6562043c48c0ae6bc9823d438685269eb11aab.zip gcc-2e6562043c48c0ae6bc9823d438685269eb11aab.tar.gz gcc-2e6562043c48c0ae6bc9823d438685269eb11aab.tar.bz2 |
Remove misleading debug line entries
This removes gimple_debug_begin_stmts without block info which remain
after a gimple block originating from an inline function is unused.
The line numbers from these stmts are from the inline function,
but since the inline function is completely optimized away,
there will be no DW_TAG_inlined_subroutine so the debugger has
no callstack available at this point, and therefore those
line table entries are not helpful to the user.
2020-12-10 Bernd Edlinger <bernd.edlinger@hotmail.de>
* cfgexpand.c (expand_gimple_basic_block): Remove special handling
of debug_inline_entries without block info.
* tree-inline.c (remap_gimple_stmt): Drop debug_nonbind_markers when
the call statement has no block info.
(copy_debug_stmt): Remove debug_nonbind_markers when inlining
and the block info is mapped to NULL.
* tree-ssa-live.c (clear_unused_block_pointer): Remove
debug_nonbind_markers originating from removed inline functions.
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r-- | gcc/tree-ssa-live.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 21a9ee4..4cad6fa 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -623,13 +623,43 @@ clear_unused_block_pointer (void) { unsigned i; tree b; - gimple *stmt = gsi_stmt (gsi); + gimple *stmt; + next: + stmt = gsi_stmt (gsi); if (!is_gimple_debug (stmt) && !gimple_clobber_p (stmt)) continue; b = gimple_block (stmt); if (b && !TREE_USED (b)) - gimple_set_block (stmt, NULL); + { + /* Elide debug marker stmts that have an associated BLOCK from an + inline instance removed with also the outermost scope BLOCK of + said inline instance removed. If the outermost scope BLOCK of + said inline instance is preserved use that in place of the + removed BLOCK. That keeps the marker associated to the correct + inline instance (or no inline instance in case it was not from + an inline instance). */ + if (gimple_debug_nonbind_marker_p (stmt) + && BLOCK_ABSTRACT_ORIGIN (b)) + { + while (TREE_CODE (b) == BLOCK + && !inlined_function_outer_scope_p (b)) + b = BLOCK_SUPERCONTEXT (b); + if (TREE_CODE (b) == BLOCK) + { + if (TREE_USED (b)) + { + gimple_set_block (stmt, b); + continue; + } + gsi_remove (&gsi, true); + if (gsi_end_p (gsi)) + break; + goto next; + } + } + gimple_set_block (stmt, NULL); + } for (i = 0; i < gimple_num_ops (stmt); i++) walk_tree (gimple_op_ptr (stmt, i), clear_unused_block_pointer_1, NULL, NULL); |