Skip to content
Snippets Groups Projects
Commit a4a3cdd0 authored by Martin Jambor's avatar Martin Jambor
Browse files

ipa: Get rid of IPA_NODE_REF and IPA_EDGE_REF

The node and edge summaries defined in ipa-prop.h are probably the
oldest in GCC and so it happened that they are the only ones using
macros to look them up and create them.  With Honza and Martin we
agreed it is ugly and the macros should be removed and the ipa-prop
summaries should be accessed like all the other ones but somehow I
never got to it until now.

The patch is mostly mechanical.  Because the lookup machinery was much
simpler in the old times (something like the fast summaries we have
today), a lot of code queried for the summary multiple times for no
good reasons and I fixed that in places where it was easy.

Also, before we switched to hash based summaries, new summary pointers
had to be obtained whenever the underlying array could be reallocated
because of new cgraph nodes/edges.  This is no longer necessary and so
I removed the instances which I found.

Both kinds of these non-mechanical changes should be specifically called
out in the ChangeLog.

I also removed the IS_VALID_JUMP_FUNC_INDEX macro because it not used
anywhere.

gcc/ChangeLog:

2021-05-07  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.h (IPA_NODE_REF): Removed.
	(IPA_NODE_REF_GET_CREATE): Likewise.
	(IPA_EDGE_REF): Likewise.
	(IPA_EDGE_REF_GET_CREATE): Likewise.
	(IS_VALID_JUMP_FUNC_INDEX): Likewise.
	* ipa-cp.c (print_all_lattices): Replaced IPA_NODE_REF with a direct
	use of ipa_node_params_sum.
	(ipcp_versionable_function_p): Likewise.
	(push_node_to_stack): Likewise.
	(pop_node_from_stack): Likewise.
	(set_single_call_flag): Replaced two IPA_NODE_REF with one single
	direct use of ipa_node_params_sum.
	(initialize_node_lattices): Replaced IPA_NODE_REF with a direct use of
	ipa_node_params_sum.
	(ipa_context_from_jfunc): Replaced IPA_EDGE_REF with a direct use of
	ipa_edge_args_sum.
	(ipcp_verify_propagated_values): Replaced IPA_NODE_REF with a direct
	use of ipa_node_params_sum.
	(self_recursively_generated_p): Likewise.
	(propagate_scalar_across_jump_function): Likewise.
	(propagate_context_across_jump_function): Replaced IPA_EDGE_REF with a
	direct use of ipa_edge_args_sum, moved the lookup after the early
	exit.  Replaced IPA_NODE_REF with a direct use of ipa_node_params_sum.
	(propagate_bits_across_jump_function): Replaced IPA_NODE_REF with
	direct uses of ipa_node_params_sum.
	(propagate_vr_across_jump_function): Likewise.
	(propagate_aggregate_lattice): Likewise.
	(propagate_aggs_across_jump_function): Likewise.
	(propagate_constants_across_call): Likewise, also replaced
	IPA_EDGE_REF with a direct use of ipa_edge_args_sum.
	(good_cloning_opportunity_p): Replaced IPA_NODE_REF with a direct use
	of ipa_node_params_sum.
	(estimate_local_effects): Likewise.
	(add_all_node_vals_to_toposort): Likewise.
	(propagate_constants_topo): Likewise.
	(ipcp_propagate_stage): Likewise.
	(ipcp_discover_new_direct_edges): Likewise.
	(calls_same_node_or_its_all_contexts_clone_p): Likewise.
	(cgraph_edge_brings_value_p): Likewise (in both overloaded functions).
	(get_info_about_necessary_edges): Likewise.
	(want_remove_some_param_p): Likewise.
	(create_specialized_node): Likewise.
	(self_recursive_pass_through_p): Likewise.
	(self_recursive_agg_pass_through_p): Likewise.
	(find_more_scalar_values_for_callers_subset): Likewise and also
	replaced IPA_EDGE_REF with direct uses of ipa_edge_args_sum, in one
	case replacing two of those with a single query.
	(find_more_contexts_for_caller_subset): Likewise for the
	ipa_polymorphic_call_context overload.
	(intersect_aggregates_with_edge): Replaced IPA_EDGE_REF with a direct
	use of ipa_edge_args_sum.  Replaced IPA_NODE_REF with direct uses of
	ipa_node_params_sum.
	(find_aggregate_values_for_callers_subset): Likewise, also reusing
	results of ipa_edge_args_sum->get.
	(cgraph_edge_brings_all_scalars_for_node): Replaced IPA_NODE_REF with
	direct uses of ipa_node_params_sum, replaced IPA_EDGE_REF with a
	direct use of ipa_edge_args_sum.
	(cgraph_edge_brings_all_agg_vals_for_node): Likewise, moved node
	summary query after the early exit and reused the result later.
	(decide_about_value): Replaced IPA_NODE_REF with a direct use of
	ipa_node_params_sum.
	(decide_whether_version_node): Likewise.  Removed re-querying for
	summaries after cloning.
	(spread_undeadness): Replaced IPA_NODE_REF with a direct use of
	ipa_node_params_sum.
	(has_undead_caller_from_outside_scc_p): Likewise, reusing results of
	some queries.
	(identify_dead_nodes): Likewise.
	(ipcp_store_bits_results): Replaced IPA_NODE_REF with direct uses of
	ipa_node_params_sum.
	(ipcp_store_vr_results): Likewise.
	* ipa-fnsummary.c (evaluate_properties_for_edge): Likewise.
	(ipa_fn_summary_t::duplicate): Likewise.
	(analyze_function_body): Likewise.
	(estimate_calls_size_and_time): Likewise.
	(ipa_cached_call_context::duplicate_from): Likewise.
	(ipa_call_context::equal_to): Likewise.
	(remap_edge_params): Likewise.
	(ipa_merge_fn_summary_after_inlining): Likewise.
	(inline_read_section): Likewise.
	* ipa-icf.c (sem_function::param_used_p): Likewise.
	* ipa-modref.c (compute_parm_map): Likewise.
	(compute_parm_map): Replaced IPA_EDGE_REF with a direct use of
	ipa_edge_args_sum.
	(get_access_for_fnspec): Replaced IPA_NODE_REF with a direct use of
	ipa_node_params_sum and replaced IPA_EDGE_REF with a direct use of
	ipa_edge_args_sum.
	* ipa-profile.c (check_argument_count): Likewise.
	* ipa-prop.c (ipa_alloc_node_params): Replaced IPA_NODE_REF_GET_CREATE
	with a direct use of ipa_node_params_sum.
	(ipa_initialize_node_params): Likewise.
	(ipa_print_node_jump_functions_for_edge): Replaced IPA_EDGE_REF with a
	direct use of ipa_edge_args_sum and reused the query result.
	(ipa_compute_jump_functions_for_edge): Replaced IPA_NODE_REF with a
	direct use of ipa_node_params_sum and replaced IPA_EDGE_REF with a
	direct use of ipa_edge_args_sum.
	(ipa_note_param_call): Replaced IPA_NODE_REF with a direct use of
	ipa_node_params_sum and reused the result of the query.
	(ipa_analyze_node): Likewise.
	(ipa_analyze_controlled_uses): Replaced IPA_NODE_REF with a direct use
	of ipa_node_params_sum.
	(update_jump_functions_after_inlining): Replaced IPA_EDGE_REF with
	direct uses of ipa_edge_args_sum.
	(update_indirect_edges_after_inlining): Replaced IPA_NODE_REF with
	direct uses of ipa_node_params_sum and replaced IPA_EDGE_REF with a
	direct use of ipa_edge_args_sum.  Removed superficial re-querying the
	top edge summary.
	(propagate_controlled_uses): Replaced IPA_NODE_REF with direct uses of
	ipa_node_params_sum and replaced IPA_EDGE_REF with a direct use of
	ipa_edge_args_sum.
	(ipa_propagate_indirect_call_infos): Replaced IPA_EDGE_REF with a
	direct use of ipa_edge_args_sum.
	(ipa_edge_args_sum_t::duplicate): Replaced IPA_NODE_REF with a direct
	use of ipa_node_params_sum.
	(ipa_print_node_params): Likewise.
	(ipa_write_node_info): Likewise and also replaced IPA_EDGE_REF with
	direct uses of ipa_edge_args_sum.
	(ipa_read_edge_info): Replaced IPA_EDGE_REF with a direct use of
	ipa_edge_args_sum.
	(ipa_read_node_info): Replaced IPA_NODE_REF with a direct use of
	ipa_node_params_sum.
	(ipa_prop_write_jump_functions): Likewise.  Move variable node to the
	scopes where it is used.
parent 0498d2d0
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment