aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2021-04-27 13:46:10 +0200
committerMartin Jambor <mjambor@suse.cz>2021-04-27 13:46:10 +0200
commiteea82246290010addf7f6be71a71b51079b3cb5d (patch)
treef196e2ad06056fe1aac893fcdeadf50fc73a3013 /gcc
parent01d0bda8bdf3cd804e1e00915d432ad0cdc49399 (diff)
downloadgcc-eea82246290010addf7f6be71a71b51079b3cb5d.zip
gcc-eea82246290010addf7f6be71a71b51079b3cb5d.tar.gz
gcc-eea82246290010addf7f6be71a71b51079b3cb5d.tar.bz2
ipa-sra: Release dead LHS SSA_NAME when removing it (PR 99951)
When IPA-SRA removes an SSA_NAME from a LHS of a call statement because it is not necessary, it does not release it. This patch fixes that. gcc/ChangeLog: 2021-04-08 Martin Jambor <mjambor@suse.cz> PR ipa/99951 * ipa-param-manipulation.c (ipa_param_adjustments::modify_call): If removing a call statement LHS SSA name, release it.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ipa-param-manipulation.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 132bb24..1d1e64f 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -856,6 +856,7 @@ ipa_param_adjustments::modify_call (gcall *stmt,
gcall *new_stmt = gimple_build_call_vec (callee_decl, vargs);
+ tree ssa_to_remove = NULL;
if (tree lhs = gimple_call_lhs (stmt))
{
if (!m_skip_return)
@@ -880,6 +881,7 @@ ipa_param_adjustments::modify_call (gcall *stmt,
}
update_stmt (using_stmt);
}
+ ssa_to_remove = lhs;
}
}
@@ -898,6 +900,8 @@ ipa_param_adjustments::modify_call (gcall *stmt,
fprintf (dump_file, "\n");
}
gsi_replace (&gsi, new_stmt, true);
+ if (ssa_to_remove)
+ release_ssa_name (ssa_to_remove);
if (update_references)
do
{