> 2011-04-06 Martin Jambor <[email protected]>
>
> gcc/
> * cgraph.c (cgraph_local_info): Call cgraph_get_node instead
> of cgraph_node, handle NULL return value.
> (cgraph_global_info): Likewise.
> (cgraph_rtl_info): Likewise.
> * tree-inline.c (estimate_num_insns): Likewise.
> * gimplify.c (unshare_body): Likewise.
> (unvisit_body): Likewise.
> (gimplify_body): Likewise.
> * predict.c (optimize_function_for_size_p): Likewise.
> * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise.
> (call_may_clobber_ref_p_1): Likewise.
> * varasm.c (function_section_1): Likewise.
> (assemble_start_function): Likewise.
>
> gcc/java/
> * decl.c (java_mark_decl_local): Call cgraph_get_node instead of
> cgraph_node and handle returned NULL.
OK.
> Index: src/gcc/predict.c
> ===================================================================
> --- src.orig/gcc/predict.c
> +++ src/gcc/predict.c
> @@ -214,10 +214,11 @@ probably_never_executed_bb_p (const_basi
> bool
> optimize_function_for_size_p (struct function *fun)
> {
> + struct cgraph_node *node;
> return (optimize_size
> || (fun && fun->decl
> - && (cgraph_node (fun->decl)->frequency
> - == NODE_FREQUENCY_UNLIKELY_EXECUTED)));
> + && (node = cgraph_get_node (fun->decl))
> + && (node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)));
I guess this is because optimize_function_for_size_p is used from folder
that in turn is called before cgraph is built. Please, for consistency, add
same
test into the other predicates that calls cgraph_node (fun->decl) here
and also uwind the statement into series of ifs. It has grown in to
quite a beast. This is preaproved either as this patch of followup.
Honza