summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2018-07-09 07:17:45 +0000
committerTom de Vries <vries@gcc.gnu.org>2018-07-09 07:17:45 +0000
commit74725f46ddc4bb020414320147cba37f907c3336 (patch)
tree0cd5a75eaa561de535e685a79f3facf375a78c90 /gcc/cfgexpand.c
parentd2c8944b75e67198f748a7df44cfcc6427741133 (diff)
[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/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 9b91279282e..d6e3c382085 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -5141,6 +5141,10 @@ expand_debug_source_expr (tree exp)
switch (TREE_CODE (exp))
{
+ case VAR_DECL:
+ if (DECL_ABSTRACT_ORIGIN (exp))
+ return expand_debug_source_expr (DECL_ABSTRACT_ORIGIN (exp));
+ break;
case PARM_DECL:
{
mode = DECL_MODE (exp);