diff options
author | Martin Jambor <mjambor@suse.cz> | 2021-11-08 17:49:54 +0100 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2021-11-08 17:52:51 +0100 |
commit | 239d82d4c05b30632fd09ba4056de7dac5aee070 (patch) | |
tree | 00fb5ee32968c70ffbf55e5819c25d7b99e1bc8e /gcc/tree-inline.c | |
parent | a7dce7626a6d5247d7dda48fa36d3cdc258aae84 (diff) | |
download | gcc-239d82d4c05b30632fd09ba4056de7dac5aee070.zip gcc-239d82d4c05b30632fd09ba4056de7dac5aee070.tar.gz gcc-239d82d4c05b30632fd09ba4056de7dac5aee070.tar.bz2 |
ipa: Unshare expresseions before putting them into debug statements (PR 103099, PR 103107)
My recent patch to improve debug experience when there are removed
parameters (by ipa-sra or ipa-split) was not careful to unshare the
expressions that were then put into debug statements, which manifests
itself as PR 103099. This patch adds unsharing them using
unshare_expr_without_location which is a bit more careful with stripping
locations than what we were doing manually and so also fixes PR 103107.
gcc/ChangeLog:
2021-11-08 Martin Jambor <mjambor@suse.cz>
PR ipa/103099
PR ipa/103107
* tree-inline.c (remap_gimple_stmt): Unshare the expression without
location before invoking remap_with_debug_expressions on it.
* ipa-param-manipulation.c
(ipa_param_body_adjustments::prepare_debug_expressions): Likewise.
gcc/testsuite/ChangeLog:
2021-11-08 Martin Jambor <mjambor@suse.cz>
PR ipa/103099
PR ipa/103107
* g++.dg/ipa/pr103099.C: New test.
* gcc.dg/ipa/pr103107.c: Likewise.
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index d78e439..53d664e 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1825,7 +1825,10 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) tree value = gimple_debug_bind_get_value (stmt); if (id->param_body_adjs && id->param_body_adjs->m_dead_stmts.contains (stmt)) - id->param_body_adjs->remap_with_debug_expressions (&value); + { + value = unshare_expr_without_location (value); + id->param_body_adjs->remap_with_debug_expressions (&value); + } gdebug *copy = gimple_build_debug_bind (var, value, stmt); if (id->reset_location) |