aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-01-05 09:40:50 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-01-05 09:40:50 +0100
commit566f27e42ca00f65d101e6a7b0096554a0cc452d (patch)
tree53dddb0634d26df31297a6db047145d050b904b2 /gcc/tree-sra.c
parent11492349fe6f6a568b3aecdc1a503f80b8848070 (diff)
downloadgcc-566f27e42ca00f65d101e6a7b0096554a0cc452d.zip
gcc-566f27e42ca00f65d101e6a7b0096554a0cc452d.tar.gz
gcc-566f27e42ca00f65d101e6a7b0096554a0cc452d.tar.bz2
re PR tree-optimization/42508 (wrong code with "-O1 -fipa-sra")
PR tree-optimization/42508 * tree-sra.c (convert_callers): Check for recursive call by comparing cgraph nodes instead of decls. (modify_function): Call ipa_modify_formal_parameters also on all same_body aliases. * g++.dg/opt/pr42508.C: New test. * cgraphunit.c (cgraph_materialize_all_clones): Compare cgraph nodes when checking for same_body aliases. From-SVN: r155640
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index f451692..f0e874f 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3800,8 +3800,11 @@ convert_callers (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
for (gsi = gsi_start_bb (this_block); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
- if (gimple_code (stmt) == GIMPLE_CALL
- && gimple_call_fndecl (stmt) == node->decl)
+ tree call_fndecl;
+ if (gimple_code (stmt) != GIMPLE_CALL)
+ continue;
+ call_fndecl = gimple_call_fndecl (stmt);
+ if (call_fndecl && cgraph_get_node (call_fndecl) == node)
{
if (dump_file)
fprintf (dump_file, "Adjusting recursive call");
@@ -3819,6 +3822,11 @@ convert_callers (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
static void
modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
{
+ struct cgraph_node *alias;
+ for (alias = node->same_body; alias; alias = alias->next)
+ ipa_modify_formal_parameters (alias->decl, adjustments, "ISRA");
+ /* current_function_decl must be handled last, after same_body aliases,
+ as following functions will use what it computed. */
ipa_modify_formal_parameters (current_function_decl, adjustments, "ISRA");
scan_function (sra_ipa_modify_expr, sra_ipa_modify_assign,
replace_removed_params_ssa_names, false, adjustments);