summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-11 08:14:50 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-11 08:14:50 +0000
commitea7e866e878831ed073b7160e8b5707676abba2e (patch)
tree42568770dccb09df07e5beff55df5ce77b3c4957
parent2b2fe71055f970318515ba8e01819f1d32608b9b (diff)
downloadgcc-ea7e866e878831ed073b7160e8b5707676abba2e.tar.gz
* cgraphbuild.c (cgraph_rebuild_references): New.
(cgraph_mark_reachable_node): Accept references to optimized out extern inlines. * cgraph.h (cgraph_rebuild_references): Declare. * tree-inline.c (tree_function_versioning): Use it. * ipa-struct-reorg.c (do_reorg_for_func): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159259 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cgraph.h1
-rw-r--r--gcc/cgraphbuild.c31
-rw-r--r--gcc/ipa-struct-reorg.c1
-rw-r--r--gcc/tree-inline.c2
5 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3727c6b0a85..3abdc3f5b3b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2010-05-11 Jan Hubicka <jh@suse.cz>
+ * cgraphbuild.c (cgraph_rebuild_references): New.
+ (cgraph_mark_reachable_node): Accept references to optimized out
+ extern inlines.
+ * cgraph.h (cgraph_rebuild_references): Declare.
+ * tree-inline.c (tree_function_versioning): Use it.
+ * ipa-struct-reorg.c (do_reorg_for_func): Likewise.
+
+2010-05-11 Jan Hubicka <jh@suse.cz>
+
* cgraph.c: Include ipa-utils.h
(cgraph_create_virtual_clone): Update references.
* Makefile.in (cgraph.o): Add dependency at ipa-utils.h
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 93488c3a5d2..97df56bc418 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -619,6 +619,7 @@ gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *);
bool cgraph_propagate_frequency (struct cgraph_node *node);
/* In cgraphbuild.c */
unsigned int rebuild_cgraph_edges (void);
+void cgraph_rebuild_references (void);
void reset_inline_failed (struct cgraph_node *);
int compute_call_stmt_bb_frequency (tree, basic_block bb);
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 246be20df2e..b09963d1c04 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -463,6 +463,37 @@ rebuild_cgraph_edges (void)
return 0;
}
+/* Rebuild cgraph edges for current function node. This needs to be run after
+ passes that don't update the cgraph. */
+
+void
+cgraph_rebuild_references (void)
+{
+ basic_block bb;
+ struct cgraph_node *node = cgraph_node (current_function_decl);
+ gimple_stmt_iterator gsi;
+
+ ipa_remove_all_references (&node->ref_list);
+
+ node->count = ENTRY_BLOCK_PTR->count;
+
+ 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);
+
+ }
+ for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))
+ walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
+ mark_load, mark_store, mark_address);
+ }
+ record_eh_tables (node, cfun);
+}
+
struct gimple_opt_pass pass_rebuild_cgraph_edges =
{
{
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index 24b42e3ed03..460c23fc9ed 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -3241,6 +3241,7 @@ do_reorg_for_func (struct cgraph_node *node)
create_new_accesses_for_func ();
update_ssa (TODO_update_ssa);
cleanup_tree_cfg ();
+ cgraph_rebuild_references ();
/* Free auxiliary data representing local variables. */
free_new_vars_htab (new_local_vars);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 8e7d1d67614..ee7a45712df 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -5037,6 +5037,8 @@ tree_function_versioning (tree old_decl, tree new_decl,
pointer_set_destroy (id.statements_to_fold);
fold_cond_expr_cond ();
delete_unreachable_blocks_update_callgraph (&id);
+ if (id.dst_node->analyzed)
+ cgraph_rebuild_references ();
update_ssa (TODO_update_ssa);
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);