diff options
author | Richard Guenther <rguenther@suse.de> | 2011-03-17 14:59:00 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2011-03-17 14:59:00 +0000 |
commit | 5bbb12d28f6ee1aaddcafdc3f3bdb478a70107dd (patch) | |
tree | 19bd7dee07e0dcd9a4bc23e10fac377ef22b686a /gcc/tree-ssa.c | |
parent | 1bd74704fd3a2f22b8234ef6923d8416da819345 (diff) |
2011-03-17 Richard Guenther <rguenther@suse.de>
PR middle-end/48134
* tree-ssa.c (insert_debug_temp_for_var_def): If we propagated
a value make sure to fold the statement.
* gcc.dg/pr48134.c: New testcase.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@171098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index e7e3edcf6f1..d542e0a253a 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -455,13 +455,19 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) continue; if (value) - FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) - /* unshare_expr is not needed here. vexpr is either a - SINGLE_RHS, that can be safely shared, some other RHS - that was unshared when we found it had a single debug - use, or a DEBUG_EXPR_DECL, that can be safely - shared. */ - SET_USE (use_p, value); + { + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) + /* unshare_expr is not needed here. vexpr is either a + SINGLE_RHS, that can be safely shared, some other RHS + that was unshared when we found it had a single debug + use, or a DEBUG_EXPR_DECL, that can be safely + shared. */ + SET_USE (use_p, value); + /* If we didn't replace uses with a debug decl fold the + resulting expression. Otherwise we end up with invalid IL. */ + if (TREE_CODE (value) != DEBUG_EXPR_DECL) + fold_stmt_inplace (stmt); + } else gimple_debug_bind_reset_value (stmt); |