[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