summaryrefslogtreecommitdiff
path: root/gcc/cgraphbuild.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2013-05-24 17:35:21 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2013-05-24 17:35:21 +0200
commit8233805962efaca360502989a390aef6825666ab (patch)
tree43bacd6846c8b3eb43f0268cb4dce94a7f027c38 /gcc/cgraphbuild.c
parent1ccd4874c93be4a4cad60e0324b27a953a7417ed (diff)
downloadgcc-8233805962efaca360502989a390aef6825666ab.tar.gz
re PR tree-optimization/57294 (ice in remove_described_reference)
2013-05-24 Martin Jambor <mjambor@suse.cz> PR tree-optimization/57294 * cgraph.h (ipa_record_stmt_references): Declare. * cgraphbuild.c (ipa_record_stmt_references): New function. (build_cgraph_edges): Use ipa_record_stmt_references. (rebuild_cgraph_edges): Likewise. (cgraph_rebuild_references): Likewise. * ipa-prop.c (ipa_modify_call_arguments): Discard references associated with the old statement and build references from the newly built statements. * ipa-ref.c (ipa_remove_stmt_references): New function. * ipa-ref.h (ipa_remove_stmt_references): Declare. testsuite/ * gcc.dg/ipa/pr57294.c: New test. From-SVN: r199299
Diffstat (limited to 'gcc/cgraphbuild.c')
-rw-r--r--gcc/cgraphbuild.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index a74a4c043e3..fb1515d6037 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -288,6 +288,14 @@ mark_store (gimple stmt, tree t, void *data)
return false;
}
+/* Record all references from NODE that are taken in statement STMT. */
+void
+ipa_record_stmt_references (struct cgraph_node *node, gimple stmt)
+{
+ walk_stmt_load_store_addr_ops (stmt, node, mark_load, mark_store,
+ mark_address);
+}
+
/* Create cgraph edges for function calls.
Also look for functions and variables having addresses taken. */
@@ -323,8 +331,7 @@ build_cgraph_edges (void)
gimple_call_flags (stmt),
bb->count, freq);
}
- walk_stmt_load_store_addr_ops (stmt, node, mark_load,
- mark_store, mark_address);
+ ipa_record_stmt_references (node, stmt);
if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
&& gimple_omp_parallel_child_fn (stmt))
{
@@ -348,8 +355,7 @@ build_cgraph_edges (void)
}
}
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
- mark_load, mark_store, mark_address);
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
}
/* Look for initializers of constant variables and private statics. */
@@ -437,13 +443,10 @@ rebuild_cgraph_edges (void)
gimple_call_flags (stmt),
bb->count, freq);
}
- walk_stmt_load_store_addr_ops (stmt, node, mark_load,
- mark_store, mark_address);
-
+ ipa_record_stmt_references (node, stmt);
}
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
- mark_load, mark_store, mark_address);
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
}
record_eh_tables (node, cfun);
gcc_assert (!node->global.inlined_to);
@@ -468,16 +471,9 @@ cgraph_rebuild_references (void)
FOR_EACH_BB (bb)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple stmt = gsi_stmt (gsi);
-
- walk_stmt_load_store_addr_ops (stmt, node, mark_load,
- mark_store, mark_address);
-
- }
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
- mark_load, mark_store, mark_address);
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
}
record_eh_tables (node, cfun);
}