[debug] Handle debug references to skipped params
When compiling guality/vla-1.c with -O3 -g, vla a in f1 is optimized away, but
f1 still contains a debug expression describing the upper bound of the vla
(D.1914):
...
__attribute__((noinline))
f1 (intD.6 iD.1900)
{
<bb 2>
saved_stack.1_2 = __builtin_stack_save ();
# DEBUG BEGIN_STMT
# DEBUG D#3 => i_1(D) + 1
# DEBUG D#2 => (long intD.8) D#3
# DEBUG D#1 => D#2 + -1
# DEBUG D.1914 => (sizetype) D#1
...
Then f1 is cloned to a version f1.constprop with no parameters, eliminating
parameter i, and 'DEBUG D#3 => i_1(D) + 1' turns into 'D#3 => NULL'.
This patch fixes that by defining debug expressions for default defs of
eliminated parameters in remap_ssa_name:
...
__attribute__((noinline))
f1.constprop ()
{
intD.6 iD.1949;
<bb 3>
# DEBUG D#8 s=> iD.1900
# DEBUG iD.1949 => D#8
<bb 2>
+ # DEBUG D#6 s=> iD.1949
saved_stack.1_1 = __builtin_stack_save ();
# DEBUG BEGIN_STMT
- # DEBUG D#3 => NULL
+ # DEBUG D#3 => D#6 + 1
# DEBUG D#2 => (long intD.8) D#3
# DEBUG D#1 => D#2 + -1
# DEBUG D.1951 => (sizetype) D#1
...
Bootstrapped and reg-tested on x86_64.
2018-07-09 Tom de Vries <tdevries@suse.de>
* cfgexpand.c (expand_debug_source_expr): Handle VAR_DECL.
* tree-inline.c (remap_ssa_name): Handle default def ssa_name mapping
onto VAR_DECL with abstract origin.
* gcc.dg/vla-1.c: New test.
From-SVN: r262510