diff options
author | Tom de Vries <tdevries@suse.de> | 2018-07-09 07:17:45 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2018-07-09 07:17:45 +0000 |
commit | 74725f46ddc4bb020414320147cba37f907c3336 (patch) | |
tree | 0cd5a75eaa561de535e685a79f3facf375a78c90 /gcc/tree-inline.c | |
parent | d2c8944b75e67198f748a7df44cfcc6427741133 (diff) | |
download | gcc-74725f46ddc4bb020414320147cba37f907c3336.zip gcc-74725f46ddc4bb020414320147cba37f907c3336.tar.gz gcc-74725f46ddc4bb020414320147cba37f907c3336.tar.bz2 |
[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
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 427ef95..45aba81 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -208,7 +208,8 @@ remap_ssa_name (tree name, copy_body_data *id) n = id->decl_map->get (val); if (n != NULL) val = *n; - if (TREE_CODE (val) != PARM_DECL) + if (TREE_CODE (val) != PARM_DECL + && !(VAR_P (val) && DECL_ABSTRACT_ORIGIN (val))) { processing_debug_stmt = -1; return name; |