aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-prop.c
AgeCommit message (Collapse)AuthorFilesLines
2011-11-062011-11-6 Richard Guenther <rguenther@suse.de>Richard Guenther1-1/+4
* ipa-prop.c (ipa_modify_call_arguments): Re-compute inlinable flag. From-SVN: r181027
2011-11-03ipa-prop.c (type_change_info): New fields offset, object, known_current_type ↵Martin Jambor1-13/+105
and multiple_types_encountered. 2011-11-03 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (type_change_info): New fields offset, object, known_current_type and multiple_types_encountered. (extr_type_from_vtbl_ptr_store): New function. (check_stmt_for_type_change): Use it, set multiple_types_encountered if the result is different from the previous one. (detect_type_change): Renamed to detect_type_change_1. New parameter comp_type. Set up new fields in tci, build known type jump functions if the new type can be identified. (detect_type_change): New function. * tree.h (DECL_CONTEXT): Comment new use. * testsuite/g++.dg/ipa/devirt-c-1.C: Add dump scans. * testsuite/g++.dg/ipa/devirt-c-2.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-7.C: New test. * testsuite/g++.dg/ipa/devirt-c-8.C: Likewise. From-SVN: r180825
2011-10-31ipa-prop.c (mark_modified): Moved up in the file.Martin Jambor1-57/+146
2011-10-31 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (mark_modified): Moved up in the file. (is_parm_modified_before_call): Renamed to is_parm_modified_before_stmt, moved up in the file. (load_from_unmodified_param): New function. (compute_complex_assign_jump_func): Also attempt to create pass through jump functions for values loaded from (addressable) parameters. * testsuite/gcc.dg/ipa/ipcp-4.c: New test. From-SVN: r180705
2011-10-27ipa-prop.c (compute_pass_through_member_ptrs): Rename parm_info to parm_ainfo.Martin Jambor1-26/+27
2011-10-27 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (compute_pass_through_member_ptrs): Rename parm_info to parm_ainfo. (ipa_compute_jump_functions_for_edge): Likewise. (ipa_compute_jump_functions): Likewise. (ipa_analyze_indirect_call_uses): Likewise. (ipa_analyze_call_uses): Likewise. (ipa_analyze_params_uses): Likewise. (ipa_analyze_node): Likewise. From-SVN: r180578
2011-09-23ipa-prop.h (jump_func_type): Updated comments.Martin Jambor1-40/+38
2011-09-23 Martin Jambor <mjambor@suse.cz> * ipa-prop.h (jump_func_type): Updated comments. (ipa_known_type_data): New type. (ipa_jump_func): Use it to describe known type jump functions. * ipa-prop.c (ipa_print_node_jump_functions_for_edge): Updated to reflect the new known type jump function contents. (compute_known_type_jump_func): Likewise. (combine_known_type_and_ancestor_jfs): Likewise. (try_make_edge_direct_virtual_call): Likewise. (ipa_write_jump_function): Likewise. (ipa_read_jump_function): Likewise. * ipa-cp.c (ipa_value_from_known_type_jfunc): New function. (ipa_value_from_jfunc): Use ipa_value_from_known_type_jfunc. (propagate_accross_jump_function): Likewise. From-SVN: r179117
2011-09-22* ipa-prop.c (ipa_print_node_jump_functions): Fix typos.Maxim Kuvyrkov1-3/+3
From-SVN: r179102
2011-09-22ipa-inline-transform.c (inline_call): Always update jump functions after ↵Jan Hubicka1-26/+15
inlining. * ipa-inline-transform.c (inline_call): Always update jump functions after inlining. * ipa-inline.c (ipa_inline): Likewise; do not call ipa_create_all_structures_for_iinln. (ipa_inline): Always free jump functions. * ipa-inline-analysis.c (evaluate_conditions_for_edge): Remove hack. (remap_edge_predicates): Fix pasto. (inline_merge_summary): Remove nlined edge predicate; remove hack. (inline_analyze_function): Always initialize jump functions. (inline_generate_summary): Likewise. (inline_write_summary): Always write jump functions when ipa-cp is not doing that. (inline_read_summary): Always read jump functions when ipa-cp is not doing that. * ipa-prop.c (iinlining_processed_edges): Remove. (update_indirect_edges_after_inlining): Do not use iinlining_processed_edges; instead set param_index to -1. (propagate_info_to_inlined_callees): Only try to indirect inlining when asked to do so; update jump functions of indirect calls, too; remove jump functions of the inlined edge. (ipa_edge_duplication_hook): Do not copy iinlining_processed_edges. (ipa_create_all_structures_for_iinln): Remove. (ipa_free_all_structures_after_iinln): Do not free iinlining_processed_edges. * ipa-prop.h (ipa_create_all_structures_for_iinln): Remove. From-SVN: r179083
2011-09-03ipa-prop.h (ipa_jump_func_t): New typedef.Martin Jambor1-81/+37
2011-09-03 Martin Jambor <mjambor@suse.cz> * ipa-prop.h (ipa_jump_func_t): New typedef. (struct ipa_edge_args): Removed field argument_count, field jump_functions turned into a vector. (ipa_set_cs_argument_count): Removed. (ipa_get_cs_argument_count): Updated to work on vectors. (ipa_get_ith_jump_func): Likewise. * ipa-prop.c (ipa_count_arguments): Removed. (compute_scalar_jump_functions): Use ipa_get_ith_jump_func to access jump functions. Update caller. (compute_pass_through_member_ptrs): Likewise. (compute_cst_member_ptr_arguments): Likewise. (ipa_compute_jump_functions_for_edge): Get number of arguments from the statement, allocate vector. (ipa_compute_jump_functions): Do not call ipa_count_arguments. (duplicate_ipa_jump_func_array): Removed. (ipa_edge_duplication_hook): Use VEC_copy, do not copy argument count. (ipa_read_node_info): Allocate vector. From-SVN: r178502
2011-09-02ipa-prop.h (ipa_node_params): Removed fields called_with_var_arguments and ↵Martin Jambor1-28/+3
node_versionable. 2011-09-02 Martin Jambor <mjambor@suse.cz> * ipa-prop.h (ipa_node_params): Removed fields called_with_var_arguments and node_versionable. (ipa_set_called_with_variable_arg): Removed. (ipa_is_called_with_var_arguments): Likewise. * ipa-cp.c (ipa_get_lattice): Fixed index check in an assert. (determine_versionability): Do not check for type attributes and va builtins. Record versionability into inline summary. (initialize_node_lattices): Do not check ipa_is_called_with_var_arguments. (propagate_constants_accross_call): Likewise, ignore arguments we do not have PARM_DECLs for, set variable flag for parameters that were not passed a value. (create_specialized_node): Dump info that we cannot change signature. * ipa-prop.c (ipa_compute_jump_functions): Do not care about variable number of arguments. (ipa_make_edge_direct_to_target): Likewise. (ipa_update_after_lto_read): Likewise. (ipa_node_duplication_hook): Do not copy called_with_var_arguments flag. * tree-inline.c (copy_arguments_for_versioning): Copy PARM_DECLs if they were remapped. * testsuite/gcc.dg/ipa/ipcp-3.c: New test. From-SVN: r178485
2011-09-02cgraph.h (cgraph_indirect_call_info): Removed field thunk_delta.Martin Jambor1-18/+9
2011-09-02 Martin Jambor <mjambor@suse.cz> * cgraph.h (cgraph_indirect_call_info): Removed field thunk_delta. * gimple-fold.c (gimple_get_virt_method_for_binfo): Rewritten to use BINFO_VTABLE. Parameter delta removed, all callers updated. * tree.c (free_lang_data_in_binfo): Clear BINFO_VIRTUALs instead BINFO_VTABLE. * cgraph.c (cgraph_make_edge_direct): Removed parameter delta, updated all calls. * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Removed handling of thunk_delta. * ipa-cp.c (get_indirect_edge_target): Removed parameter delta. (devirtualization_time_bonus): Do not handle thunk deltas. (ipcp_discover_new_direct_edges): Likewise. * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. (try_make_edge_direct_simple_call): Likewise. (try_make_edge_direct_virtual_call): Likewise. * lto-cgraph.c (output_cgraph_opt_summary_p): Likewise. Mark parameter set as unused. (output_edge_opt_summary): Likewise. Mark both parameters as unused. * lto-cgraph.c (output_cgraph_opt_summary_p): Likewise. Mark parameter set as unused. (output_edge_opt_summary): Likewise. Mark both parameters as unused. (input_edge_opt_summary): Likewise. * lto-streamer-out.c (lto_output_ts_binfo_tree_pointers): Do not stream BINFO_VIRTUALS at all. * lto-streamer-in.c (lto_input_ts_binfo_tree_pointers): Likewise. * testsuite/g++.dg/ipa/devirt-3.C: Added a distraction method. * testsuite/g++.dg/ipa/ivinline-7.C: Added a test for direct call discovery, xfailed test for inlining. * testsuite/g++.dg/ipa/ivinline-9.C: Likewise. From-SVN: r178472
2011-08-12data-streamer.h (streamer_write_zero): Rename from output_zero.Diego Novillo1-36/+30
* data-streamer.h (streamer_write_zero): Rename from output_zero. (streamer_write_uhwi): Rename from lto_output_uleb128. (streamer_write_hwi): Rename from output_sleb128. (streamer_write_string): Rename from lto_output_string. (streamer_string_index): Rename from lto_string_index. (streamer_write_string_with_length): Rename from lto_output_string_with_length. (streamer_write_uhwi_stream): Rename from lto_output_uleb128_stream. (streamer_write_hwi_stream): Rename from lto_output_sleb128_stream. (streamer_read_string): Rename from lto_input_string. (streamer_read_indexed_string): Rename from input_string_internal. (streamer_read_uhwi): Rename from lto_input_uleb128. (streamer_read_hwi): Rename from lto_input_sleb128. (streamer_write_hwi_in_range): Rename from lto_output_int_in_range. (streamer_read_hwi_in_range): Rename from lto_input_int_in_range. (streamer_write_enum): Rename from lto_output_enum. (streamer_read_enum): Rename from lto_input_enum. (streamer_write_record_start): Rename from output_record_start. (streamer_read_record_start): Rename from input_record_start. (streamer_write_bitpack): Rename from lto_output_bitpack. (streamer_read_bitpack): Rename from lto_input_bitpack. (streamer_write_char_stream): Rename from lto_output_1_stream. (streamer_read_uchar): Rename from lto_input_1_unsigned. * tree-streamer.h (streamer_cache_d): Rename from lto_streamer_cache_d. (streamer_handle_as_builtin_p): Rename from lto_stream_as_builtin_p. (streamer_read_string_cst): Rename from input_string_cst. (streamer_read_chain): Rename from lto_input_chain. (streamer_alloc_tree): Rename from lto_materialize_tree. (streamer_read_tree_body): Rename from lto_input_tree_pointers. (streamer_get_pickled_tree): Rename from lto_get_pickled_tree. (streamer_get_builtin_tree): Rename from lto_get_builtin_tree. (streamer_read_integer_cst): Rename from lto_input_integer_cst. (streamer_read_tree_bitfields): Rename from tree_read_bitfields. (streamer_write_chain): Rename from lto_output_chain. (streamer_write_tree_header): Rename from lto_output_tree_header. (streamer_pack_tree_bitfields): Rename from pack_value_fields. (streamer_write_tree_body): Rename from lto_output_tree_pointers. (streamer_write_integer_cst): Rename from lto_output_integer_cst. (streamer_write_builtin): Rename from lto_output_builtin_tree. (streamer_check_handled_ts_structures): Rename from check_handled_ts_structures. (streamer_tree_cache_insert): Rename from lto_streamer_cache_insert. (streamer_tree_cache_insert_at): Rename from lto_streamer_cache_insert_at. (streamer_tree_cache_append): Rename from lto_streamer_cache_append. (streamer_tree_cache_lookup): Rename from lto_streamer_cache_lookup. (streamer_tree_cache_get): Rename from lto_streamer_cache_get. (streamer_tree_cache_create): Rename from lto_streamer_cache_create. (streamer_tree_cache_delete): Rename from lto_streamer_cache_delete. * tree-streamer-out.c (write_string_cst): Rename from output_string_cst. (write_identifier): Rename from output_identifier. (write_ts_common_tree_pointers): Rename from lto_output_ts_common_tree_pointers. (write_ts_vector_tree_pointers): Rename from lto_output_ts_vector_tree_pointers. (write_ts_complex_tree_pointers): Rename from lto_output_ts_complex_tree_pointers. (write_ts_decl_minimal_tree_pointers): Rename from lto_output_ts_decl_minimal_tree_pointers. (write_ts_decl_common_tree_pointers): Rename from lto_output_ts_decl_common_tree_pointers. (write_ts_decl_non_common_tree_pointers): Rename from lto_output_ts_decl_non_common_tree_pointers. (write_ts_decl_with_vis_tree_pointers): Rename from lto_output_ts_decl_with_vis_tree_pointers. (write_ts_field_decl_tree_pointers): Rename from lto_output_ts_field_decl_tree_pointers. (write_ts_function_decl_tree_pointers): Rename from lto_output_ts_function_decl_tree_pointers. (write_ts_type_common_tree_pointers): Rename from lto_output_ts_type_common_tree_pointers. (write_ts_type_non_common_tree_pointers): Rename from lto_output_ts_type_non_common_tree_pointers. (write_ts_list_tree_pointers): Rename from lto_output_ts_list_tree_pointers. (write_ts_vec_tree_pointers): Rename from lto_output_ts_vec_tree_pointers. (write_ts_exp_tree_pointers): Rename from lto_output_ts_exp_tree_pointers. (write_ts_block_tree_pointers): Rename from lto_output_ts_block_tree_pointers. (write_ts_binfo_tree_pointers): Rename from lto_output_ts_binfo_tree_pointers. (write_ts_constructor_tree_pointers): Rename from lto_output_ts_constructor_tree_pointers. (write_ts_target_option): Rename from lto_output_ts_target_option. (write_ts_translation_unit_decl_tree_pointers): Rename from lto_output_ts_translation_unit_decl_tree_pointers. * tree-streamer.c (streamer_tree_cache_add_to_node_array): Rename from lto_streamer_cache_add_to_node_array. (streamer_tree_cache_insert_1): Rename from lto_streamer_cache_insert_1. (record_common_node): Rename from lto_record_common_node. * streamer-hooks.h (bitpack_d, lto_streamer_cache_d): Remove forward declarations. * data-streamer-in.c (lto_input_widest_uint_uleb128): Remove unused function. * data-streamer-out.c (lto_output_widest_uint_uleb128_stream): Remove unused function. * Makefile.in (lto-section-out.o): Add dependency on DATA_STREAMER_H. (ipa-reference.o): Likewise. * lto-section-out.c: Include data-streamer.h. * ipa-reference.c: Include data-streamer.h. From-SVN: r177704
2011-08-11tree-streamer-out.c (lto_output_ts_decl_with_vis_tree_pointers): Call ↵Diego Novillo1-14/+14
stream_write_tree instead of output_record_start. * tree-streamer-out.c (lto_output_ts_decl_with_vis_tree_pointers): Call stream_write_tree instead of output_record_start. (lto_output_ts_binfo_tree_pointers): Likewise. * streamer-hooks.h (stream_write_tree): Move from tree-streamer.h. Convert it to a macro. (stream_read_tree): Likewise. * lto-streamer.h (lto_stream_as_builtin_p): Move ... * tree-streamer.h (lto_stream_as_builtin_p): ... here. * lto-streamer-in.c (lto_read_tree): Call lto_streamer_cache_append and tree_read_bitfields. * lto-streamer-out.c (lto_is_streamable): Move from lto-streamer.c (lto_write_tree): Call it. * lto-streamer.c (lto_is_streamable): Move to lto-streamer-out.c * streamer-hooks.h (struct streamer_hooks): Remove fields name, is_streamable and alloc_tree. Update all users. * tree-streamer-in.c (tree_read_bitfields): Factor out of ... (lto_materialize_tree): ... here. Handle CALL_EXPR codes. Remove call to lto_streamer_cache_append. * tree-streamer-out.c (lto_output_tree_header): Handle CALL_EXPR nodes. * tree-streamer.h (tree_read_bitfields): Declare. * Makefile.in (TREE_STREAMER_H): Add STREAMER_HOOKS_H. (gimple-streamer-in.o): Add dependency on TREE_STREAMER_H. * tree-streamer.h (stream_read_tree): New. Replace all calls to lto_input_tree with it. (stream_write_tree): New. Replace all calls to lto_output_tree, lto_output_tree_ref and lto_output_tree_or_ref with it. * lto-streamer-in.c (lto_read_tree): Inline code from lto_streamer_read_tree. (lto_input_tree): Move from tree-streamer-in.c. * lto-streamer-out.c (lto_output_tree_ref): Make static. Remove handling of NULL values for EXPR. Do not handle EXPRs that are not indexable. (lto_write_tree): Move from tree-streamer-out.c. Inline lto_streamer_write_tree. (lto_output_tree): Move from tree-streamer-out.c. If REF_P is true and EXPR is indexable, call lto_output_tree_ref. * lto-streamer.c (lto_record_common_node): Move to tree-streamer.c. (lto_preload_common_nodes): Likewise. Remove assertions and adjustments for nodes main_identifier_node, ptrdiff_type_node and fileptr_type_node. (lto_streamer_hooks_init): Set streamer_hooks.write_tree to lto_output_tree and streamer_hooks.read_tree to lto_input_tree. * lto-streamer.h (lto_input_tree): Declare. (lto_output_tree_ref): Remove. * streamer-hooks.h (struct streamer_hooks): Remove fields preload_common_nodes, indexable_with_decls_p, pack_value_fields, unpack_value_fields, output_tree_header and has_unique_integer_csts_p. Update all users. * tree-streamer-in.c (lto_materialize_tree): Make extern. (lto_input_tree_pointers): Likewise. (lto_read_tree): Move to lto-streamer-in.c. (lto_input_integer_cst): Make extern. (lto_get_pickled_tree): Likewise. (lto_get_builtin_tree): Likewise. (lto_input_tree): Move to lto-streamer-in.c. * tree-streamer-out.c (pack_value_fields): Make extern. (lto_output_tree_or_ref): Remove. Replace all callers with calls to stream_write_tree. (lto_output_builtin_tree): Make extern. (lto_streamer_write_tree): Inline into lto_write_tree. (lto_output_tree_pointers): Make extern. (lto_output_tree_header): Likewise. (lto_output_integer_cst): Likewise. (lto_write_tree): Move to lto-streamer-out.c. (lto_output_tree): Likewise. * tree-streamer.c (lto_record_common_node): Move from lto-streamer.c (preload_common_nodes): Likewise. (lto_streamer_cache_create): Call it. * tree-streamer.h: Include streamer-hooks.h. (stream_write_tree): New. (stream_read_tree): New. (lto_input_tree): Remove. (lto_materialize_tree): Declare. (lto_input_tree_pointers): Declare. (lto_get_pickled_tree): Declare. (lto_get_builtin_tree): Declare. (lto_input_integer_cst): Declare. (lto_output_tree_header): Declare. (pack_value_fields): Declare. (lto_output_tree_pointers): Declare. (lto_output_integer_cst): Declare. (lto_output_builtin_tree): Declare. From-SVN: r177661
2011-08-08rebaseDiego Novillo1-0/+2
From-SVN: r177571
2011-07-19ipa-prop.h: Include alloc-pool.h, all sorts of updates to general comments.Martin Jambor1-192/+33
2011-07-18 Martin Jambor <mjambor@suse.cz> * ipa-prop.h: Include alloc-pool.h, all sorts of updates to general comments. (ipcp_values_pool): Declare. (ipcp_sources_pool): Likewise. (ipcp_lattice): Changed to forward declaration. (ipa_param_descriptor): Removed fields ipcp_lattice, types and cannot_devirtualize. (ipa_node_params): New fields descriptors, lattices, known_vals, clone_for_all_contexts and node dead, removed fields params and count_scale. (ipa_set_param_count): Removed. (ipa_get_param_count): Made to work with descriptors vector. (ipa_get_param): Updated. (ipa_param_cannot_devirtualize_p): Removed. (ipa_param_types_vec_empty): Likewise. (ipa_set_param_used): New function. (ipa_get_param_used): Updated to use descriptors vector. (ipa_func_list): Removed. (ipa_init_func_list): Removed declaration. (ipa_push_func_to_list_1): Likewise. (ipa_pop_func_from_list): Likewise. (ipa_push_func_to_list): Removed. (ipa_lattice_from_jfunc): Remove declaration. (ipa_get_jf_pass_through_result): Declare. (ipa_get_jf_ancestor_result): Likewise. (ipa_value_from_jfunc): Likewise. (ipa_get_lattice): Update. (ipa_lat_is_single_const): New function. * ipa-prop.c (ipa_push_func_to_list_1): Removed. (ipa_init_func_list): Likewise. (ipa_pop_func_from_list): Likewise. (ipa_get_param_decl_index): Fix coding style. (count_formal_params): Removed. (count_formal_params_1): Renamed to count_formal_params. (ipa_populate_param_decls): Update to use descriptors vector. (ipa_initialize_node_params): Likewise. (visit_ref_for_mod_analysis): Use ipa_set_param_used. (ipa_analyze_params_uses): Likewise. (ipa_free_node_params_substructures): Likewise and free also lattices and known values. (duplicate_array): Removed. (ipa_edge_duplication_hook): Add the new edge to the list of edge clones. (ipa_node_duplication_hook): Update to use new lattices. (ipa_free_all_structures_after_ipa_cp): Free alloc pools. (ipa_free_all_structures_after_iinln): Likewise. (ipa_write_node_info): Update to use new lattices. (ipa_read_node_info): Likewise. (ipa_get_jf_pass_through_result): New function. (ipa_get_jf_ancestor_result): Likewise. (ipa_value_from_jfunc): Likewise. (ipa_cst_from_jfunc): Reimplemented using ipa_value_from_jfunc. * ipa-cp.c: Reimplemented. * params.def (PARAM_DEVIRT_TYPE_LIST_SIZE): Removed. (PARAM_IPA_CP_VALUE_LIST_SIZE): New parameter. (PARAM_IPA_CP_EVAL_THRESHOLD): Likewise. * Makefile.in (IPA_PROP_H): Added alloc-pool.h to dependencies. * doc/invoke.texi (devirt-type-list-size): Removed description. (ipa-cp-value-list-size): Added description. * testsuite/gcc.dg/ipa/ipa-1.c: Updated testcase dump scan. * testsuite/gcc.dg/ipa/ipa-2.c: Likewise. * testsuite/gcc.dg/ipa/ipa-3.c: Likewise and made functions static. * testsuite/gcc.dg/ipa/ipa-4.c: Updated testcase dump scan. * testsuite/gcc.dg/ipa/ipa-5.c: Likewise. * testsuite/gcc.dg/ipa/ipa-7.c: Likewise. * testsuite/gcc.dg/ipa/ipa-8.c: Updated testcase dump scan. * testsuite/gcc.dg/ipa/ipacost-1.c: Likewise. * testsuite/gcc.dg/ipa/ipacost-2.c: Likewise and increased sizes of some functions. * testsuite/gcc.dg/ipa/ipcp-1.c: New test. * testsuite/gcc.dg/ipa/ipcp-2.c: Likewise. * testsuite/gcc.dg/tree-ssa/ipa-cp-1.c: Updated testcase. From-SVN: r176424
2011-06-22re PR debug/47858 (IPA-SRA decreases quality of debug info)Jakub Jelinek1-2/+39
PR debug/47858 * gimple.h (enum gimple_debug_subcode): Add GIMPLE_DEBUG_SOURCE_BIND. (gimple_build_debug_source_bind_stat): New prototype. (gimple_build_debug_source_bind): Define. (gimple_debug_source_bind_p, gimple_debug_source_bind_get_var, gimple_debug_source_bind_get_value, gimple_debug_source_bind_get_value_ptr, gimple_debug_source_bind_set_var, gimple_debug_source_bind_set_value): New inlines. * gimple.c (gimple_build_debug_source_bind_stat): New function. * gimple-pretty-print.c (dump_gimple_debug): Handle GIMPLE_DEBUG_SOURCE_BIND. * sese.c (rename_uses): Handle gimple_debug_source_bind_p. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. * tree-parloops.c (eliminate_local_variables, separate_decls_in_region): Likewise. (separate_decls_in_region_debug): Renamed from separate_decls_in_region_debug_bind. Handle gimple_debug_source_bind_p. * tree.h (decl_debug_args_lookup, decl_debug_args_insert): New prototypes. (DECL_HAS_DEBUG_ARGS_P): Define. (struct tree_function_decl): Add has_debug_args_flag field. * tree.c (debug_args_for_decl): New variable. (decl_debug_args_lookup, decl_debug_args_insert): New functions. * tree-into-ssa.c (mark_def_sites): Handle uses in debug stmts. (rewrite_debug_stmt_uses): New function. (rewrite_stmt): Use it to rewrite debug stmt uses. * rtl.def (DEBUG_PARAMETER_REF): New. * rtl.h (DEBUG_PARAMETER_REF_DECL): Define. * cselib.c (rtx_equal_for_cselib_1, cselib_hash_rtx): Handle DEBUG_PARAMETER_REF. * rtl.c (rtx_equal_p_cb, rtx_equal_p, iterative_hash_rtx): Likewise. * print-rtl.c (print_rtx): Likewise. * tree-sra.c (sra_ipa_reset_debug_stmts): Prefer replacing of SSA_NAMEs with DEBUG_EXPR_DECLs initialized in source bind debug stmts in the first bb. * tree-inline.c (remap_ssa_name): If remapping default def of a PARM_DECL fails, map to a DEBUG_EXPR_DECL set in a source bind debug stmt. (remap_gimple_stmt): Handle gimple_debug_source_bind_p. (maybe_move_debug_stmts_to_successors): Likewise. (copy_debug_stmt): Likewise. Avoid shadowing a variable. (tree_function_versioning): If DECL_HAS_DEBUG_ARGS_P, copy debug args vector from old_decl to new_decl. * ipa-prop.c (ipa_modify_call_arguments): For optimized away or modified parameters, add debug bind stmts before call setting DEBUG_EXPR_DECL which is remembered in debug args vector. * cfgexpand.c (expand_call_stmt): Call expand_debug_expr on DECL_DEBUG_EXPRs from debug args vector. (expand_debug_source_expr): New function. (expand_debug_locations): Use it for source bind insns. (expand_gimple_basic_block): Handle gimple_debug_source_bind_p. * var-tracking.c (prepare_call_arguments): Add debug args to call_arguments if any. * dwarf2out.c (dwarf_stack_op_name, size_of_loc_descr, output_loc_operands, output_loc_operands_raw, resolve_addr_in_expr, compare_loc_operands): Handle DW_OP_GNU_parameter_ref. (get_ref_die_offset, parameter_ref_descriptor): New functions. (mem_loc_descriptor): Handle DEBUG_PARAMETER_REF. (gen_subprogram_die): Handle parameters identified by DEBUG_PARAMETER_REF. * dwarf2.h (enum dwarf_location_atom): Add DW_OP_GNU_parameter_ref. From-SVN: r175288
2011-06-16gimple.c (canonicalize_cond_expr_cond): (bool)x is not the same as x != 0.Richard Guenther1-1/+2
2011-06-16 Richard Guenther <rguenther@suse.de> * gimple.c (canonicalize_cond_expr_cond): (bool)x is not the same as x != 0. * fold-const.c (fold_binary_loc): Do not fold X & 1 != 0 to (bool) X & 1. * ipa-prop.c (ipa_analyze_indirect_call_uses): Also allow equality compares against zero for the lower bit. From-SVN: r175096
2011-06-15re PR tree-optimization/48613 (ICE: vector VEC(ipa_node_params_t,base) index ↵Martin Jambor1-2/+5
domain error with -O0 -flto -findirect-inlining) 2011-06-15 Martin Jambor <mjambor@suse.cz> PR tree-optimization/48613 * ipa-prop.c (ipa_prop_write_jump_functions): Return immediately if ipa_node_params_vector is NULL. From-SVN: r175077
2011-06-11ipa-prop.c (ipa_make_edge_direct_to_target): Fix code setting varying args.Jan Hubicka1-4/+6
* ipa-prop.c (ipa_make_edge_direct_to_target): Fix code setting varying args. (ipa_update_after_lto_read): Likewise. (ipa_write_node_info): Do not sream call_with_var_arguments. (ipa_read_node_info): Likewise. From-SVN: r174955
2011-06-10ipa-prop.c (ipa_write_node_info): Stream jump functions for indirect calls.Jan Hubicka1-2/+23
* ipa-prop.c (ipa_write_node_info): Stream jump functions for indirect calls. (ipa_read_node_info): Likewise. From-SVN: r174915
2011-06-10ipa-cp.c (ipcp_versionable_function_p): Aliases are not versionable.Jan Hubicka1-5/+6
* ipa-cp.c (ipcp_versionable_function_p): Aliases are not versionable. (ipcp_cloning_candidate_p): Aliases are not clonning candidates. (ipcp_initialize_node_lattices): We don't propagate through an aliases. (ipcp_propagate_stage): Skip aliases when propagating. (ipcp_need_redirect_p): Skip aliases. (ipcp_insert_stage): Use FOR_EACH_FUNCTION_WITH_GIMPLE_BODY and collect_callers_of_node. * ipa-prop.c (ipa_init_func_list): Do not analyze datastructures for aliases. (ipa_compute_jump_functions): Look through aliases. From-SVN: r174911
2011-06-10ipa-cp.c (ipcp_process_devirtualization_opportunities): Update call of ↵Jan Hubicka1-1/+1
gimple_get_virt_method_for_binfo. * ipa-cp.c (ipcp_process_devirtualization_opportunities): Update call of gimple_get_virt_method_for_binfo. * gimple-fold.c (gimple_get_virt_method_for_binfo): Remove refuse_thunks parameter. (gimple_fold_call): Update. * ipa-prop.c (try_make_edge_direct_virtual_call): Update. From-SVN: r174905
2011-05-14ipa-prop.c (ipa_cst_from_jfunc): New function.Martin Jambor1-0/+17
2011-05-13 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (ipa_cst_from_jfunc): New function. * ipa-prop.h (ipa_cst_from_jfunc): Declare. * ipa-inline-analysis.c (evaluate_conditions_for_edge): Use it. (evaluate_conditions_for_ipcp_clone): Removed. (estimate_ipcp_clone_size_and_time): Accept vector of known constants. * ipa-cp.c (ipcp_estimate_growth): Build vector of known constants. * ipa-inline.h (estimate_ipcp_clone_size_and_time): Update. From-SVN: r173739
2011-05-06cgraph.c (cgraph_add_thunk): Create real function node instead of alias node...Jan Hubicka1-2/+4
* cgraph.c (cgraph_add_thunk): Create real function node instead of alias node; finalize it and mark needed/reachale; arrange visibility to be right and add it into the corresponding same comdat group list. (dump_cgraph_node): Dump thunks. * cgraph.h (cgraph_first_defined_function, cgraph_next_defined_function, cgraph_function_with_gimple_body_p, cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): New functions. (FOR_EACH_FUNCTION_WITH_GIMPLE_BODY, FOR_EACH_DEFINED_FUNCTION): New macros. * ipa-cp.c (ipcp_need_redirect_p): Thunks can't be redirected. (ipcp_generate_summary): Use FOR_EACH_FUNCTION_WITH_GIMPLE_BODY. * cgraphunit.c (cgraph_finalize_function): Only look into possible devirtualization when optimizing. (verify_cgraph_node): Verify thunks. (cgraph_analyze_function): Analyze thunks. (cgraph_mark_functions_to_output): Output thunks only in combination with function they are assigned to. (assemble_thunk): Turn thunk into non-thunk; don't try to turn alias into normal node. (assemble_thunks): New functoin. (cgraph_expand_function): Use it. * lto-cgraph.c (lto_output_node): Stream thunks. (input_overwrite_node): Stream in thunks. * ipa-pure-const.c (analyze_function): Thunks do nothing interesting. * lto-streamer-out.c (lto_output): Do not try to output thunk's body. * ipa-inline.c (inline_small_functions): Use FOR_EACH_DEFINED_FUNCTION. * ipa-inline-analysis.c (compute_inline_parameters): "Analyze" thunks. (inline_analyze_function): Do not care about thunk jump functions. (inline_generate_summary):Use FOR_EACH_DEFINED_FUNCTION. * ipa-prop.c (ipa_prop_write_jump_functions): Use cgraph_function_with_gimple_body_p. * passes.c (do_per_function_toporder): Use cgraph_function_with_gimple_body_p. (execute_one_pass);Use FOR_EACH_FUNCTION_WITH_GIMPLE_BODY. (ipa_write_summaries): Use cgraph_function_with_gimple_body_p. (function_called_by_processed_nodes_p): Likewise. * lto.c (lto_materialize_function): Use cgraph_function_with_gimple_body_p. (add_cgraph_node_to_partition): Do not re-add items to partition; handle thunks. (add_varpool_node_to_partition): Do not re-add items to partition. From-SVN: r173517
2011-05-04tree.h (int_const_binop): Remove notrunc argument.Richard Guenther1-1/+1
2011-05-04 Richard Guenther <rguenther@suse.de> * tree.h (int_const_binop): Remove notrunc argument. * fold-const.c (int_const_binop): Remove notrunc argument. Always create integer constants that are properly truncated. (extract_muldiv_1): Expand one notrunc int_const_binop caller. (const_binop): Remove zero notrunc argument to int_const_binop. (size_binop_loc): Likewise. (fold_div_compare): Likewise. (maybe_canonicalize_comparison_1): Likewise. (fold_comparison): Likewise. (fold_binary_loc): Likewise. (multiple_of_p): Likewise. * expr.c (store_constructor): Likewise. * gimple-fold.c (maybe_fold_offset_to_array_ref): Likewise. (maybe_fold_stmt_addition): Likewise. * ipa-prop.c (ipa_modify_call_arguments): Likewise. * stor-layout.c (layout_type): Likewise. * tree-data-ref.c (tree_fold_divides_p): Likewise. * tree-sra.c (build_ref_for_offset): Likewise. (build_user_friendly_ref_for_offset): Likewise. * tree-ssa-address.c (maybe_fold_tmr): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise. * tree-ssa-loop-niter.c (inverse): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise. * tree-ssa.c (maybe_rewrite_mem_ref_base): Likewise. * tree-switch-conversion.c (check_range): Likewise. (build_constructors): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vrp.c (set_and_canonicalize_value_range): Likewise. (extract_range_from_assert): Likewise. (vrp_int_const_binop): Likewise. (extract_range_from_binary_expr): Likewise. (extract_range_from_unary_expr): Likewise. (check_array_ref): Likewise. (find_case_label_range): Likewise. (simplify_div_or_mod_using_ranges): Likewise. * tree-cfg.c (group_case_labels_stmt): Use double-ints for comparing case labels for merging. ada/ * gcc-interface/trans.c (gnat_to_gnu): Remove zero notrunc argument to int_const_binop. (pos_to_constructor): Likewise. fortran/ * trans-types.c (gfc_get_array_type_bounds): Remove zero notrunc argument to int_const_binop. From-SVN: r173356
2011-04-27ipa-prop.c (function_insertion_hook_holder): New holder.Jan Hubicka1-0/+14
* ipa-prop.c (function_insertion_hook_holder): New holder. (ipa_add_new_function): New function. (ipa_register_cgraph_hooks, ipa_unregister_cgraph_hooks): Register/deregister holder. From-SVN: r173026
2011-04-24ipa-prop.c (ipa_propagate_indirect_call_infos): Remove obsolette WPA hack.Jan Hubicka1-4/+0
* ipa-prop.c (ipa_propagate_indirect_call_infos): Remove obsolette WPA hack. * ipa-prop.h (ipa_get_param, ipa_is_param_used, ipa_param_cannot_devirtualize_p, ipa_param_types_vec_empty, ipa_get_ith_jump_func, ipa_get_lattice): Fortify array bounds. * ipa-inline-analysis.c (add_clause): Fix clause ordering. (and_predicates, or_predicates, predicates_equal_p, evaulate_predicate): Sanity check predicate length. (remap_predicate): Likewise; sanity check jump functions. (inline_read_section, inline_write_summary): Sanity check predicate length. From-SVN: r172914
2011-04-22gengtype.c (open_base_files): Add ipa-inline.h include.Jan Hubicka1-1/+64
* gengtype.c (open_base_files): Add ipa-inline.h include. * ipa-cp.c (ipcp_get_lattice, ipcp_lattice_from_jfunc): Move to ipa-prop.c update all uses. * ipa-prop.c: (ipa_get_lattice, ipa_lattice_from_jfunc): ... here. * ipa-inline-transform.c (inline_call): Use inline_merge_summary to merge summary of inlined function into former caller. * ipa-inline.c (max_benefit): Remove. (edge_badness): Compensate for removal of benefits. (update_caller_keys): Use reset_node_growth_cache/reset_edge_growth_cache. (update_callee_keys): Likewise. (update_all_callee_keys): Likewise. (inline_small_functions): Do not collect max_benefit; do not reset stimated_growth; call free_growth_caches and initialize_growth_caches. * ipa-inline.h (struct condition, type clause_t, struct predicate, struct size_time_entry): New structures. (INLINE_SIZE_SCALE, INLINE_TIME_SCALE, MAX_CLAUSES): New constants. (inline_summary): Remove size_inlining_benefit, time_inlining_benefit and estimated_growth. (edge_growth_cache_entry): New structure. (node_growth_cache, edge_growth_cache): New global vars. (estimate_growth): Turn into inline. (inline_merge_summary, do_estimate_edge_growth, do_estimate_edge_time, initialize_growth_caches, free_growth_caches): Declare. (estimate_edge_growth): Rewrite. (estimate_edge_time): Implement as inline cache lookup. (reset_node_growth_cache, reset_edge_growth_cache): New inline functions. (MAX_TIME): Reduce to allow multiplicatoin by INLINE_SIZE_SCALE. (NUM_CONDITIONS): New constant. (predicate_conditions): New enum. (IS_NOT_CONSTANT): New constant. (edge_removal_hook_holder): New var. (node_growth_cache, edge_growth_cache): New global vars. (true_predicate, single_cond_predicate, false_predicate, not_inlined_predicate, add_condition, add_clause, and_predicates, or_predicates, predicates_equal_p, evaulate_predicate, dump_condition, dump_clause, dump_predicate, account_size_time, evaulate_conditions_for_edge): New functions. (inline_summary_alloc): Move to heap. (inline_node_removal_hook): Clear condition and entry vectors. (inline_edge_removal_hook): New function. (initialize_growth_caches, free_growth_caches): New function. (dump_inline_summary): Update. (edge_execution_predicate): New function. (will_be_nonconstant_predicate): New function. (estimate_function_body_sizes): Compute BB and constantness predicates. (compute_inline_parameters): Do not clear estimated_growth. (estimate_edge_size_and_time): New function. (estimate_calls_size_and_time): New function. (estimate_callee_size_and_time): New function. (remap_predicate): New function. (inline_merge_summary): New function. (do_estimate_edge_time): New function based on... (estimate_edge_time): ... this one. (do_estimate_edge_growth): New function. (do_estimate_growth): New function based on.... (estimate_growth): ... this one. (inline_analyze_function): Analyze after deciding on jump functions. (inline_read_section): New function. (inline_read_summary): Use it. (inline_write_summary): Write all the new data. * ipa-prop.c (ipa_get_param_decl_index): Export. (ipa_lattice_from_jfunc): Move here from ipa-cp.c * ipa-prop.h (ipa_get_param_decl_index, ipa_lattice_from_jfunc): Declare. (ipa_get_lattice): Move hre from ipa-cp.c * Makefile.in (GTFILES): Add ipa-inline.h and ipa-inline-analysis.c * params.def (PARAM_EARLY_INLINING_INSNS): Set to 11. * cgraph.h (cgraph_clone_inlined_nodes, compute_inline_parameters, cgraph_edge_inlinable_p): Remove. * cgraphunit.c: Include ipainline.h (cgraph_process_new_functions): Update call of compute_inline_parameters. * gcc.dg/tree-ssa/pr38699.c: Fix testcase. From-SVN: r172873
2011-04-20remove useless if-before-free testsJim Meyering1-2/+1
Change "if (E) free (E);" to "free (E);" everywhere except in the libgo/, intl/, zlib/ and classpath/ directories. Also transform equivalent variants like "if (E != NULL) free (E);" and allow an extra cast on the argument to free. Otherwise, the tested and freed "E" expressions must be identical, modulo white space. From-SVN: r172785
2011-04-20Makefile.in (INTERNAL_FN_DEF, [...]): Define.Richard Sandiford1-0/+2
gcc/ * Makefile.in (INTERNAL_FN_DEF, INTERNAL_FN_H): Define. (GIMPLE_H): Include $(INTERNAL_FN_H). (OBJS-common): Add internal-fn.o. (internal-fn.o): New rule. * internal-fn.def: New file. * internal-fn.h: Likewise. * internal-fn.c: Likewise. * gimple.h: Include internal-fn.h. (GF_CALL_INTERNAL): New gf_mask. (gimple_statement_call): Put fntype into a union with a new internal_fn field. (gimple_build_call_internal): Declare. (gimple_build_call_internal_vec): Likewise. (gimple_call_same_target_p): Likewise. (gimple_call_internal_p): New function. (gimple_call_internal_fn): Likewise. (gimple_call_fntype): Return null for internal calls. (gimple_call_set_fntype): Assert that the function is not internal. (gimple_call_set_fn): Likewise. (gimple_call_set_fndecl): Likewise. (gimple_call_set_internal_fn): New function. (gimple_call_addr_fndecl): Handle null functions. (gimple_call_return_type): Likewise null types. * gimple.c (gimple_build_call_internal_1): New function. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_call_same_target_p): Likewise. (gimple_call_flags): Handle calls to internal functions. (gimple_call_fnspec): New function. (gimple_call_arg_flags, gimple_call_return_flags): Use it. (gimple_has_side_effects): Handle null functions. (gimple_rhs_has_side_effects): Likewise. (gimple_call_copy_skip_args): Handle calls to internal functions. * cfgexpand.c (expand_call_stmt): Likewise. * expr.c (expand_expr_real_1): Assert that the call isn't internal. * gimple-fold.c (gimple_fold_call): Handle null functions. (gimple_fold_stmt_to_constant_1): Don't fold calls to internal functions. * gimple-low.c (gimple_check_call_args): Handle calls to internal functions. * gimple-pretty-print.c (dump_gimple_call): Likewise. * ipa-prop.c (ipa_analyze_call_uses): Handle null functions. * tree-cfg.c (verify_gimple_call): Handle calls to internal functions. (do_warn_unused_result): Likewise. * tree-eh.c (same_handler_p): Use gimple_call_same_target_p. * tree-ssa-ccp.c (ccp_fold_stmt): Handle calls to internal functions. * tree-ssa-dom.c (hashable_expr): Use the gimple statement to record the target of a call. (initialize_hash_element): Update accordingly. (hashable_expr_equal_p): Use gimple_call_same_target_p. (iterative_hash_hashable_expr): Handle calls to internal functions. (print_expr_hash_elt): Likewise. * tree-ssa-pre.c (can_value_number_call): Likewise. (eliminate): Handle null functions. * tree-ssa-sccvn.c (visit_use): Handle calls to internal functions. * tree-ssa-structalias.c (get_fi_for_callee): Likewise. (find_func_aliases): Likewise. * value-prof.c (gimple_ic_transform): Likewise. (gimple_indirect_call_to_profile): Likewise. * lto-streamer-in.c (input_gimple_stmt): Likewise. * lto-streamer-out.c (output_gimple_stmt): Likewise. From-SVN: r172758
2011-04-19ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar non-pointer ↵Martin Jambor1-6/+12
assignments. 2011-04-19 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar non-pointer assignments. From-SVN: r172717
2011-04-19ipa-cp.c (ipcp_process_devirtualization_opportunities): Take into account ↵Martin Jambor1-50/+94
anc_offset and otr_type from the indirect edge info. 2011-04-19 Martin Jambor <mjambor@suse.cz> * ipa-cp.c (ipcp_process_devirtualization_opportunities): Take into account anc_offset and otr_type from the indirect edge info. * ipa-prop.c (get_ancestor_addr_info): New function. (compute_complex_ancestor_jump_func): Assignment analysis moved to get_ancestor_addr_info, call it. (ipa_note_param_call): Do not initialize information about polymorphic calls, return the indirect call graph edge. Remove the last parameter, adjust all callers. (ipa_analyze_virtual_call_uses): Process also calls to ancestors of parameters. Initialize polymorphic information in the indirect edge. * testsuite/g++.dg/ipa/devirt-7.C: New test. From-SVN: r172716
2011-04-18re PR middle-end/48661 (wrong-code regression with devirtualization)Jakub Jelinek1-1/+1
PR middle-end/48661 * gimple-fold.c (gimple_get_virt_method_for_binfo): Return NULL if TREE_TYPE (v) is non-NULL. * gimple-fold.c (gimple_get_virt_method_for_binfo): Renamed from gimple_get_virt_mehtod_for_binfo. * gimple.h (gimple_get_virt_method_for_binfo): Likewise. * ipa-cp.c (ipcp_process_devirtualization_opportunities): Adjust callers. * ipa-prop.c (try_make_edge_direct_virtual_call): Likewise. * g++.dg/torture/pr48661.C: New test. From-SVN: r172677
2011-04-15ipa-prop.c (ipa_analyze_virtual_call_uses): Remove handling of ADR_EXPRs.Martin Jambor1-12/+0
2011-04-15 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (ipa_analyze_virtual_call_uses): Remove handling of ADR_EXPRs. From-SVN: r172515
2011-04-14cgraph.c (dump_cgraph_node): Do not dump inline summaries.Jan Hubicka1-1/+1
* cgraph.c (dump_cgraph_node): Do not dump inline summaries. * cgraph.h (struct inline_summary): Move to ipa-inline.h (cgraph_local_info): Remove inline_summary. * ipa-cp.c: Include ipa-inline.h. (ipcp_cloning_candidate_p, ipcp_estimate_growth, ipcp_estimate_cloning_cost, ipcp_insert_stage): Use inline_summary accesor. * lto-cgraph.c (lto_output_node): Do not stream inline summary. (input_overwrite_node): Do not set inline summary. (input_node): Do not stream inline summary. * ipa-inline.c (cgraph_decide_inlining): Dump inline summaries. (cgraph_decide_inlining_incrementally): Do not try to estimate overall growth; we do not have inline parameters computed for that anyway. (cgraph_early_inlining): After inlining compute call_stmt_sizes. * ipa-inline.h (struct inline_summary): Move here from ipa-inline.h (inline_summary_t): New type and VECtor. (debug_inline_summary, dump_inline_summaries): Declare. (inline_summary): Use VOCtor. (estimate_edge_growth): Kill hack computing call stmt size directly. * lto-section-in.c (lto_section_name): Add inline section. * ipa-inline-analysis.c: Include lto-streamer.h (node_removal_hook_holder, node_duplication_hook_holder): New holders (inline_node_removal_hook, inline_node_duplication_hook): New functions. (inline_summary_vec): Define. (inline_summary_alloc, dump_inline_summary, debug_inline_summary, dump_inline_summaries): New functions. (estimate_function_body_sizes): Properly compute size/time of outgoing calls. (compute_inline_parameters): Alloc inline_summary; do not compute size/time of incomming calls. (estimate_edge_time): Avoid missing time summary hack. (inline_read_summary): Read inline summary info. (inline_write_summary): Write inline summary info. (inline_free_summary): Free all hooks and inline summary vector. * lto-streamer.h: Add LTO_section_inline_summary section. * Makefile.in (ipa-cp.o, ipa-inline-analysis.o): Update dependencies. * ipa.c (cgraph_remove_unreachable_nodes): Fix dump file formating. * lto.c: Include ipa-inline.h (add_cgraph_node_to_partition, undo_partition): Use inline_summary accessor. (ipa_node_duplication_hook): Fix declaration. * Make-lang.in (lto.o): Update dependencies. From-SVN: r172430
2011-04-11except.c (set_nothrow_function_flags): Call cgraph_get_node instead of ↵Martin Jambor1-1/+1
cgraph_node. 2011-04-11 Martin Jambor <mjambor@suse.cz> * except.c (set_nothrow_function_flags): Call cgraph_get_node instead of cgraph_node. * final.c (rest_of_clean_state): Likewise. * gimple-iterator.c (update_call_edge_frequencies): Likewise. * passes.c (pass_init_dump_file): Likewise. (execute_all_ipa_transforms): Likewise. (function_called_by_processed_nodes_p): Likewise. * predict.c (maybe_hot_frequency_p): Likewise. (probably_never_executed_bb_p): Likewise. (compute_function_frequency): Likewise. * tree-nested.c (check_for_nested_with_variably_modified): Likewise. (unnest_nesting_tree_1): Likewise. (lower_nested_functions): Likewise. * tree-optimize.c (execute_fixup_cfg): Likewise. (tree_rest_of_compilation): Likewise. * tree-profile.c (gimple_gen_ic_func_profiler): Likewise. * tree-sra.c (ipa_early_sra): Likewise. * tree-ssa-loop-ivopts.c (computation_cost): Likewise. * config/i386/i386.c (ix86_compute_frame_layout): Likewise. * ipa.c (record_cdtor_fn): Likewise. * ipa-inline.c (cgraph_early_inlining): Likewise. (compute_inline_parameters_for_current): Likewise. * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. * ipa-pure-const.c (local_pure_const): Likewise. * ipa-split.c (split_function): Likewise. (execute_split_functions): Likewise. * cgraphbuild.c (build_cgraph_edges): Likewise. (rebuild_cgraph_edges): Likewise. (cgraph_rebuild_references): Likewise. (remove_cgraph_callee_edges): Likewise. * cgraphunit.c (cgraph_mark_if_needed): Likewise. (verify_cgraph_node): Likewise. (cgraph_analyze_functions): Likewise. (cgraph_preserve_function_body_p): Likewise. (save_inline_function_body): Likewise. (save_inline_function_body): Likewise. * tree-inline.c (copy_bb): Likewise. (optimize_inline_calls): Likewise. From-SVN: r172257
2011-04-11re PR tree-optimization/48195 (ICE: vector VEC(ipa_node_params_t,base) index ↵Martin Jambor1-1/+4
domain error, in ipa_analyze_node at ipa-prop.c:1525 with -flto --param partial-inlining-entry-probability=101) 2011-04-11 Martin Jambor <mjambor@suse.cz> PR tree-optimization/48195 * ipa-cp.c (ipcp_driver): Call ipa_check_create_node_params and ipa_check_create_edge_args. (ipcp_generate_summary): Do not call ipa_check_create_node_params and ipa_check_create_edge_args. * ipa-inline.c (inline_generate_summary): Do not call ipa_check_create_node_params and ipa_check_create_edge_args. * ipa-prop.c (ipa_analyze_node): Call ipa_check_create_node_params and ipa_check_create_edge_args. * testsuite/gcc.dg/ipa/pr48195.c: New test. From-SVN: r172256
2011-04-10Remove doubled up words.Mike Stump1-3/+3
From-SVN: r172247
2011-02-11cgraph.c: Fix comment typos.Nathan Froyd1-9/+9
* cgraph.c: Fix comment typos. * cgraph.h: Likewise. * cgraphunit.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. From-SVN: r170052
2011-01-15common.opt (fdevirtualize): New flag.Martin Jambor1-3/+8
2011-01-15 Martin Jambor <mjambor@suse.cz> * common.opt (fdevirtualize): New flag. * doc/invoke.texi (Option Summary): Document it. * opts.c (default_options_table): Add devirtualize flag. * ipa-prop.c (detect_type_change): Return immediately if devirtualize flag is not set. (detect_type_change_ssa): Likewise. (compute_known_type_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. From-SVN: r168826
2011-01-15re PR tree-optimization/45934 (g++.old-deja/g++.other/dtor5.C FAILs with ↵Martin Jambor1-25/+187
-finline-small-functions) 2011-01-14 Martin Jambor <mjambor@suse.cz> PR tree-optimization/45934 PR tree-optimization/46302 * ipa-prop.c (type_change_info): New type. (stmt_may_be_vtbl_ptr_store): New function. (check_stmt_for_type_change): Likewise. (detect_type_change): Likewise. (detect_type_change_ssa): Likewise. (compute_complex_assign_jump_func): Check for dynamic type change. (compute_complex_ancestor_jump_func): Likewise. (compute_known_type_jump_func): Likewise. (compute_scalar_jump_functions): Likewise. (ipa_analyze_virtual_call_uses): Likewise. (ipa_analyze_node): Push and pop cfun, set current_function_decl. * testsuite/g++.dg/ipa/devirt-c-1.C: New test. * testsuite/g++.dg/ipa/devirt-c-2.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-3.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-4.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-5.C: Likewise. * testsuite/g++.dg/ipa/devirt-c-6.C: Likewise. * testsuite/g++.dg/ipa/devirt-6.C: Likewise. * testsuite/g++.dg/ipa/devirt-d-1.C: Likewise. * testsuite/g++.dg/torture/pr45934.C: Likewise. From-SVN: r168825
2011-01-07re PR tree-optimization/46367 (ICE during cgraph edge cloning)Jan Hubicka1-0/+4
PR tree-optimization/46367 * g++.dg/torture/pr46367.C: New file. * ipa-inline.c (cgraph_clone_inlined_nodes): Use original function only when we can update original. (cgraph_mark_inline_edge): Sanity check. * ipa-prop.c (ipa_make_edge_direct_to_target): Sanity check. From-SVN: r168587
2011-01-03re PR tree-optimization/46984 (g++.dg/torture/pr45699.C FAILs with ↵Martin Jambor1-3/+1
-fno-early-inlining -flto) 2011-01-03 Martin Jambor <mjambor@suse.cz> PR tree-optimization/46984 * cgraph.h (cgraph_indirect_call_info): make field thunk_delta HOST_WIDE_INT. (cgraph_create_indirect_edge): Fixed line length. (cgraph_indirect_call_info): Declare. (cgraph_make_edge_direct) Update declaration. * cgraph.c (cgraph_allocate_init_indirect_info): New function. (cgraph_create_indirect_edge): Use it. (cgraph_make_edge_direct): Made delta HOST_WIDE_INT. Updated all callees. * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Update for the new thunk_delta representation. * ipa-prop.c (ipa_make_edge_direct_to_target): Convert delta to HOST_WIDE_INT. (ipa_write_indirect_edge_info): Remove streaming of thunk_delta. (ipa_read_indirect_edge_info): Likewise. * lto-cgraph.c (output_edge_opt_summary): New function. (output_node_opt_summary): Call it on all outgoing edges. (input_edge_opt_summary): New function. (input_node_opt_summary): Call it on all outgoing edges. * testsuite/g++.dg/ipa/pr46984.C: New test. From-SVN: r168420
2010-12-22re PR tree-optimization/45934 (g++.old-deja/g++.other/dtor5.C FAILs with ↵Martin Jambor1-31/+25
-finline-small-functions) 2010-12-22 Martin Jambor <mjambor@suse.cz> PR tree-optimization/45934 PR tree-optimization/46302 PR tree-optimization/46987 * gimple-fold.c (get_base_binfo_for_type): Removed. (gimple_get_relevant_ref_binfo): Likewise. (gimple_fold_obj_type_ref_call): Dumb down to 4.5 functionality, removed parameter inplace, updated the caller. * gimple.h (gimple_get_relevant_ref_binfo): Remove declaration. * ipa-cp.c (ipcp_propagate_types): Do not derive types from constants. (ipcp_discover_new_direct_edges): Do not do devirtualization based on constants. * ipa-prop.c (compute_known_type_jump_func): Use get_ref_base_and_extent and get_binfo_at_offset instead of gimple_get_relevant_ref_binfo. (compute_known_type_jump_func): Likewise. (update_jump_functions_after_inlining): Do not derive types from constants. (try_make_edge_direct_virtual_call): Likewise. * tree.c (get_binfo_at_offset): Get type from non-artificial fields. * testsuite/g++.dg/ipa/ipcp-ivi-1.C: Removed. * testsuite/g++.dg/ipa/ivinline-6.C: Likewise. * testsuite/g++.dg/otr-fold-1.C: Likewise. * testsuite/g++.dg/otr-fold-2.C: Likewise. * testsuite/g++.dg/tree-ssa/pr43411.C: Xfail dump scan. * testsuite/g++.dg/tree-ssa/pr45605.C: Likewise. * testsuite/g++.dg/tree-ssa/pr46987.C: New test. From-SVN: r168168
2010-12-15re PR tree-optimization/46053 (g++.dg/torture/pr45699.C FAILs with ↵Martin Jambor1-12/+22
-fno-early-inlining) 2010-12-15 Martin Jambor <mjambor@suse.cz> PR tree-optimization/46053 PR middle-end/46287 PR middle-end/46242 * cgraph.h (cgraph_indirect_call_info): New field thunk_delta. * gimple.h (gimple_fold_obj_type_ref): Declaration removed. (gimple_fold_call): Declare. (gimple_adjust_this_by_delta): Likewise. * cgraph.c (cgraph_make_edge_direct): New parameter delta. Updated all users. (cgraph_clone_edge): Create a copy of indirect_info also for direct edges. * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Adjust this parameters. * gimple-fold.c (gimple_fold_obj_type_ref_known_binfo): Renamed to gimple_get_virt_mehtod_for_binfo, new parameter delta. Do not search through thunks, in fact bail out if we encounter one, check that BINFO_VIRTUALS is not NULL. (gimple_adjust_this_by_delta): New function. (gimple_fold_obj_type_ref): Removed. (gimple_fold_obj_type_ref_call): New function. (fold_gimple_call): Renamed to gimple_fold_call, made external. Updated users. Call gimple_fold_obj_type_ref_call instead of gimple_fold_obj_type_ref. * ipa-cp.c (ipcp_process_devirtualization_opportunities): Process thunk deltas. (ipcp_discover_new_direct_edges): Likewise. * ipa-prop.c (ipa_make_edge_direct_to_target): New parameter delta. Updated callers. (ipa_write_indirect_edge_info): Stream thunk_delta. (ipa_read_indirect_edge_info): Likewise. * tree-ssa-ccp.c (ccp_fold_stmt): Use gimple_fold_call instead of gimple_fold_obj_type_ref. * testsuite/g++.dg/ipa/pr46053.C: New test. * testsuite/g++.dg/ipa/pr46287-1.C: Likewise. * testsuite/g++.dg/ipa/pr46287-2.C: Likewise. * testsuite/g++.dg/ipa/pr46287-3.C: Likewise. * testsuite/g++.dg/torture/covariant-1.C: Likewise. * testsuite/g++.dg/torture/pr46287.C: Likewise. From-SVN: r167855
2010-12-09ipa-prop.c (compute_complex_ancestor_jump_func): Work also if the zero is ↵Martin Jambor1-3/+7
the first phi parameter. 2010-12-09 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (compute_complex_ancestor_jump_func): Work also if the zero is the first phi parameter. From-SVN: r167642
2010-12-09ipa-prop.h (struct ipa_parm_adjustment): New field alias_ptr_type.Martin Jambor1-9/+6
2010-12-09 Martin Jambor <mjambor@suse.cz> * ipa-prop.h (struct ipa_parm_adjustment): New field alias_ptr_type. * ipa-prop.c (ipa_modify_call_arguments): Use it. * tree-sra.c (splice_param_accesses): Test that all accesses have the same alias reference type. (turn_representatives_into_adjustments): Set alias_ptr_type of the adjustment. From-SVN: r167641
2010-11-14re PR tree-optimization/45722 (FAIL: gcc.c-torture/execute/20040709-2.c ↵Eric Botcazou1-4/+28
execution at -O1 and -Os) PR tree-optimization/45722 * tree-sra.c (build_ref_for_model): Always build a COMPONENT_REF if this is a reference to a component. * ipa-prop.c (ipa_get_member_ptr_load_param): Accept COMPONENT_REF. (ipa_note_param_call): Adjust comment. From-SVN: r166731
2010-11-11invoke.texi (-fwhopr): Merge into -flto section.Jan Hubicka1-1/+1
* doc/invoke.texi (-fwhopr): Merge into -flto section. (-flto-partition): Document none. * gcc.c (LINK_COMMAND_SPEC): Remove -fwhopr. * lto-wrapper.c: Update comment. (run_gcc): Update LTO option parsing. * opts.c (finish_options): add support -flto-partition=none (common_handle_option): Remove fwhopr. * common.opt: Turn fwhopr into flto. * collect2.c (main): Update option handling. * cgraphunit.c (cgraph_decide_is_function_needed): Remove flag_whopr. * ipa-split.c (execute_split_functions): Remove flag_whopr. * ipa.c (function_and_variable_visibility): Remove flag_whopr. * ipa-prop.c (ipa_compute_jump_functions): Remove flag_whopr. * varpool.c (decide_is_variable_needed): Remove flag_whopr. * gcc.dg/20081223-1.c: Update LTO options. * gcc.dg/lto/20090206-1_0.c: Update LTO options. * gcc.dg/lto/20081118_0.c: Update LTO options. * gcc.dg/lto/ipareference_0.c: Update LTO options. * gcc.dg/lto/20100423-2_0.c: Update LTO options. * gcc.dg/lto/20081201-1_0.c: Update LTO options. * gcc.dg/lto/ipacp_0.c: Update LTO options. * gcc.dg/lto/20090116_0.c: Update LTO options. * gcc.dg/lto/20091015-1_0.c: Update LTO options. * gcc.dg/lto/20090126-2_0.c: Update LTO options. * gcc.dg/lto/20081202-2_0.c: Update LTO options. * gcc.dg/lto/20081204-1_0.c: Update LTO options. * gcc.dg/lto/const-uniq_0.c: Update LTO options. * gcc.dg/lto/20081224_0.c: Update LTO options. * gcc.dg/lto/20090219_0.c: Update LTO options. * gcc.dg/lto/ipareference2_0.c: Update LTO options. * gcc.dg/lto/20090206-2_0.c: Update LTO options. * gcc.dg/lto/20081115_0.c: Update LTO options. * gcc.dg/lto/20081201-2_0.c: Update LTO options. * gcc.dg/lto/20081120-2_0.c: Update LTO options. * gcc.dg/lto/materialize-1_0.c: Update LTO options. * gcc.dg/lto/20090126-1_0.c: Update LTO options. * gcc.dg/lto/20081202-1_0.c: Update LTO options. * gcc.dg/lto/noreturn-1_0.c: Update LTO options. * g++.dg/20090107-1.C: Update LTO options. * g++.dg/lto/pr45679-2_0.C: Update LTO options. * g++.dg/lto/20081123_0.C: Update LTO options. * g++.dg/lto/20090313_0.C: Update LTO options. * g++.dg/lto/20081125_0.C: Update LTO options. * g++.dg/lto/20081109-1_0.C: Update LTO options. * g++.dg/lto/20081219_0.C: Update LTO options. * g++.dg/lto/20100724-1_0.C: Update LTO options. * g++.dg/lto/20081204-1_0.C: Update LTO options. * g++.dg/lto/20090303_0.C: Update LTO options. * g++.dg/lto/20100723-1_0.C: Update LTO options. * g++.dg/lto/pr45679-1_0.C: Update LTO options. * g++.dg/lto/20090128_0.C: Update LTO options. * g++.dg/lto/20081204-2_0.C: Update LTO options. * g++.dg/lto/20090302_0.C: Update LTO options. * g++.dg/lto/20081119-1_0.C: Update LTO options. * g++.dg/lto/20081118_0.C: Update LTO options. * g++.dg/20090121-1.C: Update LTO options. * objc.dg/lto/lto.exp: Update LTO options. * lib/lto.exp: Update LTO options. * lib/gcc-dg.exp: Update LTO options. * lib/c-torture.exp: Update LTO options. * obj-c++.dg/lto/lto.exp: Update LTO options. From-SVN: r166625
2010-11-11re PR tree-optimization/46383 (ICE: in get_binfo_at_offset, at tree.c:10947)Martin Jambor1-2/+4
2010-11-11 Martin Jambor <mjambor@suse.cz> PR tree-optimization/46383 * ipa-prop.c (compute_complex_assign_jump_func): Ignore negative offsets. (compute_complex_ancestor_jump_func): Likewise. * tree.c (get_binfo_at_offset): Return NULL_TREE if offset is negative. * testsuite/g++.dg/torture/pr46383.C: New test. From-SVN: r166598
2010-10-26re PR middle-end/45687 (possible wrong code bug)Ian Lance Taylor1-3/+3
gcc/: PR middle-end/45687 * ipa-prop.c (ipa_modify_call_arguments): Correct type of MEM_REF offset. gcc/testsuite: * gcc.c-torture/execute/20101025-1.c: New test. From-SVN: r165964