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
+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.
+
2018-07-13 Jackson Woodruff <jackson.woodruff@arm.com>
* config/aarch64/aarch64.c (aarch64_operands_adjust_ok_for_ldpstp): Use
+2018-07-13 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/vla-1.c: Update.
+
2018-07-13 Tom de Vries <tdevries@suse.de>
* gcc.src/maintainers.exp: New file.
return 0;
}
-/* One debug source bind is generated for the parameter, and two to describe the
+/* One debug source bind is generated for the parameter, and one to describe the
sizes of a and b. */
-/* { dg-final { scan-tree-dump-times " s=> i" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " s=> i" 2 "optimized" } } */
+
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;
}