This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Main ipa-ref up to date in materialization and struct reorg


On Tue, May 11, 2010 at 10:17 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this makes references updated by struct reorg and materialization. ?I use bit
> big hammer of recomputing it, but it is not expensive for materialization (we
> produce just relatively few clones) and struct reorg can be cleaned up later;
> it needs a lot of work to be useful.
>
> Honza
>
> Bootstrapped/regtested x86_64-linux, comitted.
>
> ? ? ? ?* 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.
> Index: cgraphbuild.c
> ===================================================================
> --- cgraphbuild.c ? ? ? (revision 159257)
> +++ cgraphbuild.c ? ? ? (working copy)
> @@ -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);

A much nicer interface would have been to pass in the cgraph_node
you want to re-build references for...

Richard.

> + ?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 =
> ?{
> ?{
> Index: cgraph.c
> ===================================================================
> --- cgraph.c ? ?(revision 159258)
> +++ cgraph.c ? ?(working copy)
> @@ -1643,9 +1643,16 @@ cgraph_mark_reachable_node (struct cgrap
> ?{
> ? if (!node->reachable && node->local.finalized)
> ? ? {
> - ? ? ?notice_global_symbol (node->decl);
> + ? ? ?if (cgraph_global_info_ready)
> + ? ? ? ?{
> + ? ? ? ? /* Verify that function does not appear to be needed out of blue
> + ? ? ? ? ? ?during the optimization process. ?This can happen for extern
> + ? ? ? ? ? ?inlines when bodies was removed after inlining. ?*/
> + ? ? ? ? gcc_assert ((node->analyzed || DECL_EXTERNAL (node->decl)));
> + ? ? ? }
> + ? ? ?else
> + ? ? ? ?notice_global_symbol (node->decl);
> ? ? ? node->reachable = 1;
> - ? ? ?gcc_assert (!cgraph_global_info_ready);
>
> ? ? ? node->next_needed = cgraph_nodes_queue;
> ? ? ? cgraph_nodes_queue = node;
> Index: cgraph.h
> ===================================================================
> --- cgraph.h ? ?(revision 159257)
> +++ cgraph.h ? ?(working copy)
> @@ -619,6 +619,7 @@ gimple cgraph_redirect_edge_call_stmt_to
> ?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);
>
> Index: tree-inline.c
> ===================================================================
> --- tree-inline.c ? ? ? (revision 159257)
> +++ tree-inline.c ? ? ? (working copy)
> @@ -5037,6 +5037,8 @@ tree_function_versioning (tree old_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);
> Index: ipa-struct-reorg.c
> ===================================================================
> --- ipa-struct-reorg.c ?(revision 159257)
> +++ ipa-struct-reorg.c ?(working copy)
> @@ -3241,6 +3241,7 @@ do_reorg_for_func (struct cgraph_node *n
> ? 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);
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]