diff options
author | Tom de Vries <tdevries@suse.de> | 2018-07-13 10:08:37 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2018-07-13 10:08:37 +0000 |
commit | bdaa2c546bee30f44c39076d2b75a349ab84adf9 (patch) | |
tree | fed2cee0eccdfb07dfbffb94679fbd9429d837e3 /gcc/tree-inline.c | |
parent | bddcac9d1c32e592fb7c3427f99b274847135050 (diff) | |
download | gcc-bdaa2c546bee30f44c39076d2b75a349ab84adf9.zip gcc-bdaa2c546bee30f44c39076d2b75a349ab84adf9.tar.gz gcc-bdaa2c546bee30f44c39076d2b75a349ab84adf9.tar.bz2 |
[debug] Reuse debug exprs generated in remap_ssa_name
When compiling gcc.dg/vla-1.c with -O3 -g, vla a and b in f1 are optimized
away, and f1 is cloned to a version f1.constprop with no parameters, eliminating
parameter i. Debug info is generated to describe the sizes of a and b, but
that process generates debug expressions that are not reused.
Fix the duplication by saving and reusing the generated debug expressions in
remap_ssa_name. Concretely: reuse D#7 here instead of generating D#8:
...
__attribute__((noinline))
f1.constprop ()
{
intD.6 iD.1935;
<bb 3>
# DEBUG D#10 s=> iD.1897
# DEBUG iD.1935 => D#10
<bb 2>
- # DEBUG D#8 s=> iD.1935
# DEBUG D#7 s=> iD.1935
saved_stack.2_1 = __builtin_stack_save ();
# DEBUG BEGIN_STMT
# DEBUG D#6 => D#7 + 1
# DEBUG D#5 => (long intD.8) D#6
# DEBUG D#4 => D#5 + -1
# DEBUG D.1937 => (sizetype) D#4
# DEBUG a.0D.1942 => NULL
# DEBUG BEGIN_STMT
- # DEBUG D#3 => D#8 + 2
+ # DEBUG D#3 => D#7 + 2
# DEBUG D#2 => (long intD.8) D#3
# DEBUG D#1 => D#2 + -1
# DEBUG D.1944 => (sizetype) D#1
# DEBUG b.1D.1949 => NULL
...
Bootstrapped and reg-tested on x86_64.
2018-07-13 Tom de Vries <tdevries@suse.de>
* tree-inline.c (remap_ssa_name): Save and reuse debug exprs generated
in remap_ssa_name.
* gcc.dg/vla-1.c: Update.
From-SVN: r262628
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 45aba81..6a16ce5 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -214,12 +214,16 @@ remap_ssa_name (tree name, copy_body_data *id) processing_debug_stmt = -1; return name; } + n = id->decl_map->get (val); + if (n && TREE_CODE (*n) == DEBUG_EXPR_DECL) + return *n; def_temp = gimple_build_debug_source_bind (vexpr, val, NULL); DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (name); SET_DECL_MODE (vexpr, DECL_MODE (SSA_NAME_VAR (name))); gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))); gsi_insert_before (&gsi, def_temp, GSI_SAME_STMT); + insert_decl_map (id, val, vexpr); return vexpr; } |