summaryrefslogtreecommitdiff
path: root/gcc/multiple_target.c
AgeCommit message (Collapse)Author
2020-03-25Make target_clones resolver fn static if possible.Martin Liska
PR target/93274 PR ipa/94271 * config/i386/i386-features.c (make_resolver_func): Drop public flag for resolver. * config/rs6000/rs6000.c (make_resolver_func): Add comdat group for resolver and drop public flag if possible. * multiple_target.c (create_dispatcher_calls): Drop unique_name and resolution as we want to enable LTO privatization of the default symbol. PR target/93274 PR ipa/94271 * gcc.target/i386/pr81213-2.c: New test. * gcc.target/i386/pr81213.c: Add additional source. * gcc.dg/lto/pr94271_0.c: New test. * gcc.dg/lto/pr94271_1.c: New test.
2020-01-09Make cgraph_edge::resolve-speculation staticMartin Jambor
2020-01-09 Martin Jambor <mjambor@suse.cz> * cgraph.h (cgraph_edge): Make remove, set_call_stmt, make_direct, resolve_speculation and redirect_call_stmt_to_callee static. Change return type of set_call_stmt to cgraph_edge *. * auto-profile.c (afdo_indirect_call): Adjust call to redirect_call_stmt_to_callee. * cgraph.c (cgraph_edge::set_call_stmt): Make return cgraph-edge *, make the this pointer explicit, adjust self-recursive calls and the call top make_direct. Return the resulting edge. (cgraph_edge::remove): Make this pointer explicit. (cgraph_edge::resolve_speculation): Likewise, adjust call to remove. (cgraph_edge::make_direct): Likewise, adjust call to resolve_speculation. (cgraph_edge::redirect_call_stmt_to_callee): Likewise, also adjust call to set_call_stmt. (cgraph_update_edges_for_call_stmt_node): Update call to set_call_stmt and remove. * cgraphclones.c (cgraph_node::set_call_stmt_including_clones): Renamed edge to master_edge. Adjusted calls to set_call_stmt. (cgraph_node::create_edge_including_clones): Moved "first" definition of edge to the block where it was used. Adjusted calls to set_call_stmt. (cgraph_node::remove_symbol_and_inline_clones): Adjust call to cgraph_edge::remove. * cgraphunit.c (walk_polymorphic_call_targets): Adjusted calls to make_direct and redirect_call_stmt_to_callee. * ipa-fnsummary.c (redirect_to_unreachable): Adjust calls to resolve_speculation and make_direct. * ipa-inline-transform.c (inline_transform): Adjust call to redirect_call_stmt_to_callee. (check_speculations_1):: Adjust call to resolve_speculation. * ipa-inline.c (resolve_noninline_speculation): Adjust call to resolve-speculation. (inline_small_functions): Adjust call to resolve_speculation. (ipa_inline): Likewise. * ipa-prop.c (ipa_make_edge_direct_to_target): Adjust call to make_direct. * ipa-visibility.c (function_and_variable_visibility): Make iteration safe with regards to edge removal, adjust calls to redirect_call_stmt_to_callee. * ipa.c (walk_polymorphic_call_targets): Adjust calls to make_direct and redirect_call_stmt_to_callee. * multiple_target.c (create_dispatcher_calls): Adjust call to redirect_call_stmt_to_callee (redirect_to_specific_clone): Likewise. * tree-cfgcleanup.c (delete_unreachable_blocks_update_callgraph): Adjust calls to cgraph_edge::remove. * tree-inline.c (copy_bb): Adjust call to set_call_stmt. (redirect_all_calls): Adjust call to redirect_call_stmt_to_callee. (expand_call_inline): Adjust call to cgraph_edge::remove. From-SVN: r280043
2020-01-01Update copyright years.Jakub Jelinek
From-SVN: r279813
2019-10-30Remove cgraph_local_info structure.Martin Liska
2019-10-30 Martin Liska <mliska@suse.cz> * cgraph.c (cgraph_node::local_info): Transform to ... (cgraph_node::local_info_node): ... this. (cgraph_node::dump): Remove cgraph_local_info and put its fields directly into cgraph_node. (cgraph_node::get_availability): Likewise. (cgraph_node::make_local): Likewise. (cgraph_node::verify_node): Likewise. * cgraph.h (struct GTY): Likewise. * cgraphclones.c (set_new_clone_decl_and_node_flags): Likewise. (duplicate_thunk_for_node): Likewise. (cgraph_node::create_clone): Likewise. (cgraph_node::create_virtual_clone): Likewise. (cgraph_node::create_version_clone): Likewise. * cgraphunit.c (cgraph_node::reset): Likewise. (cgraph_node::finalize_function): Likewise. (cgraph_node::add_new_function): Likewise. (analyze_functions): Likewise. * combine.c (setup_incoming_promotions): Likewise. * config/i386/i386.c (ix86_function_regparm): Likewise. (ix86_function_sseregparm): Likewise. (init_cumulative_args): Likewise. * ipa-cp.c (determine_versionability): Likewise. (count_callers): Likewise. (set_single_call_flag): Likewise. (initialize_node_lattices): Likewise. (estimate_local_effects): Likewise. (create_specialized_node): Likewise. (identify_dead_nodes): Likewise. * ipa-fnsummary.c (compute_fn_summary): Likewise. (ipa_fn_summary_generate): Likewise. * ipa-hsa.c (check_warn_node_versionable): Likewise. (process_hsa_functions): Likewise. * ipa-icf.c (set_local): Likewise. * ipa-inline-analysis.c (initialize_inline_failed): Likewise. * ipa-inline.c (speculation_useful_p): Likewise. * ipa-profile.c (ipa_propagate_frequency): Likewise. (ipa_profile): Likewise. * ipa-split.c (split_function): Likewise. (execute_split_functions): Likewise. * ipa-sra.c (ipa_sra_preliminary_function_checks): Likewise. (ipa_sra_ipa_function_checks): Likewise. * ipa-visibility.c (function_and_variable_visibility): Likewise. * ipa.c (symbol_table::remove_unreachable_nodes): Likewise. * lto-cgraph.c (lto_output_node): Likewise. (input_overwrite_node): Likewise. * multiple_target.c (expand_target_clones): Likewise. * omp-simd-clone.c (simd_clone_create): Likewise. * trans-mem.c (expand_call_tm): Likewise. (ipa_tm_mayenterirr_function): Likewise. (ipa_tm_diagnose_tm_safe): Likewise. (ipa_tm_diagnose_transaction): Likewise. (ipa_tm_create_version): Likewise. (ipa_tm_transform_calls_redirect): Likewise. (ipa_tm_execute): Likewise. * tree-inline.c (expand_call_inline): Likewise. From-SVN: r277601
2019-09-20New IPA-SRAMartin Jambor
2019-09-20 Martin Jambor <mjambor@suse.cz> * coretypes.h (cgraph_edge): Declare. * ipa-param-manipulation.c: Rewrite. * ipa-param-manipulation.h: Likewise. * Makefile.in (GTFILES): Added ipa-param-manipulation.h and ipa-sra.c. (OBJS): Added ipa-sra.o. * cgraph.h (ipa_replace_map): Removed fields old_tree, replace_p and ref_p, added fields param_adjustments and performed_splits. (struct cgraph_clone_info): Remove ags_to_skip and combined_args_to_skip, new field param_adjustments. (cgraph_node::create_clone): Changed parameters to use ipa_param_adjustments. (cgraph_node::create_virtual_clone): Likewise. (cgraph_node::create_virtual_clone_with_body): Likewise. (tree_function_versioning): Likewise. (cgraph_build_function_type_skip_args): Removed. * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Convert to using ipa_param_adjustments. (clone_of_p): Likewise. * cgraphclones.c (cgraph_build_function_type_skip_args): Removed. (build_function_decl_skip_args): Likewise. (duplicate_thunk_for_node): Adjust parameters using ipa_param_body_adjustments, copy param_adjustments instead of args_to_skip. (cgraph_node::create_clone): Convert to using ipa_param_adjustments. (cgraph_node::create_virtual_clone): Likewise. (cgraph_node::create_version_clone_with_body): Likewise. (cgraph_materialize_clone): Likewise. (symbol_table::materialize_all_clones): Likewise. * ipa-fnsummary.c (ipa_fn_summary_t::duplicate): Simplify ipa_replace_map check. * ipa-cp.c (get_replacement_map): Do not initialize removed fields. (initialize_node_lattices): Make aware that some parameters might have already been removed. (want_remove_some_param_p): New function. (create_specialized_node): Convert to using ipa_param_adjustments and deal with possibly pre-existing adjustments. * lto-cgraph.c (output_cgraph_opt_summary_p): Likewise. (output_node_opt_summary): Do not stream removed fields. Stream parameter adjustments instead of argumetns to skip. (input_node_opt_summary): Likewise. (input_node_opt_summary): Likewise. * lto-section-in.c (lto_section_name): Added ipa-sra section. * lto-streamer.h (lto_section_type): Likewise. * tree-inline.h (copy_body_data): New fields killed_new_ssa_names and param_body_adjs. (copy_decl_to_var): Declare. * tree-inline.c (update_clone_info): Do not remap old_tree. (remap_gimple_stmt): Use ipa_param_body_adjustments to modify gimple statements, walk all extra generated statements and remap their operands. (redirect_all_calls): Add killed SSA names to a hash set. (remap_ssa_name): Do not remap killed SSA names. (copy_arguments_for_versioning): Renames to copy_arguments_nochange, half of functionality moved to ipa_param_body_adjustments. (copy_decl_to_var): Make exported. (copy_body): Destroy killed_new_ssa_names hash set. (expand_call_inline): Remap performed splits. (update_clone_info): Likewise. (tree_function_versioning): Simplify tree_map processing. Updated to accept ipa_param_adjustments and use ipa_param_body_adjustments. * omp-simd-clone.c (simd_clone_vector_of_formal_parm_types): Adjust for the new interface. (simd_clone_clauses_extract): Likewise, make args an auto_vec. (simd_clone_compute_base_data_type): Likewise. (simd_clone_init_simd_arrays): Adjust for the new interface. (simd_clone_adjust_argument_types): Likewise. (struct modify_stmt_info): Likewise. (ipa_simd_modify_stmt_ops): Likewise. (ipa_simd_modify_function_body): Likewise. (simd_clone_adjust): Likewise. * tree-sra.c: Removed IPA-SRA. Include tree-sra.h. (type_internals_preclude_sra_p): Make public. * tree-sra.h: New file. * ipa-inline-transform.c (save_inline_function_body): Update to refelct new tree_function_versioning signature. * ipa-prop.c (adjust_agg_replacement_values): Use a helper from ipa_param_adjustments to get current parameter indices. (ipcp_modif_dom_walker::before_dom_children): Likewise. (ipcp_update_bits): Likewise. (ipcp_update_vr): Likewise. * ipa-split.c (split_function): Convert to using ipa_param_adjustments. * ipa-sra.c: New file. * multiple_target.c (create_target_clone): Update to reflet new type of create_version_clone_with_body. * trans-mem.c (ipa_tm_create_version): Update to reflect new type of tree_function_versioning. (modify_function): Update to reflect new type of tree_function_versioning. * params.def (PARAM_IPA_SRA_MAX_REPLACEMENTS): New. * passes.def: Remove old IPA-SRA and add new one. * tree-pass.h (make_pass_early_ipa_sra): Remove declaration. (make_pass_ipa_sra): Declare. * dbgcnt.def: Remove eipa_sra. Added ipa_sra_params and ipa_sra_retvalues. * doc/invoke.texi (ipa-sra-max-replacements): New. testsuite/ * g++.dg/ipa/pr81248.C: Adjust dg-options and dump-scan. * gcc.dg/ipa/ipa-sra-1.c: Likewise. * gcc.dg/ipa/ipa-sra-10.c: Likewise. * gcc.dg/ipa/ipa-sra-11.c: Likewise. * gcc.dg/ipa/ipa-sra-3.c: Likewise. * gcc.dg/ipa/ipa-sra-4.c: Likewise. * gcc.dg/ipa/ipa-sra-5.c: Likewise. * gcc.dg/ipa/ipacost-2.c: Disable ipa-sra. * gcc.dg/ipa/ipcp-agg-9.c: Likewise. * gcc.dg/ipa/pr78121.c: Adjust scan pattern. * gcc.dg/ipa/vrp1.c: Likewise. * gcc.dg/ipa/vrp2.c: Likewise. * gcc.dg/ipa/vrp3.c: Likewise. * gcc.dg/ipa/vrp7.c: Likewise. * gcc.dg/ipa/vrp8.c: Likewise. * gcc.dg/noreorder.c: use noipa attribute instead of noinline. * gcc.dg/ipa/20040703-wpa.c: New test. * gcc.dg/ipa/ipa-sra-12.c: New test. * gcc.dg/ipa/ipa-sra-13.c: Likewise. * gcc.dg/ipa/ipa-sra-14.c: Likewise. * gcc.dg/ipa/ipa-sra-15.c: Likewise. * gcc.dg/ipa/ipa-sra-16.c: Likewise. * gcc.dg/ipa/ipa-sra-17.c: Likewise. * gcc.dg/ipa/ipa-sra-18.c: Likewise. * gcc.dg/ipa/ipa-sra-19.c: Likewise. * gcc.dg/ipa/ipa-sra-20.c: Likewise. * gcc.dg/ipa/ipa-sra-21.c: Likewise. * gcc.dg/ipa/ipa-sra-22.c: Likewise. * gcc.dg/sso/ipa-sra-1.c: Likewise. * g++.dg/ipa/ipa-sra-2.C: Likewise. * g++.dg/ipa/ipa-sra-3.C: Likewise. * gcc.dg/tree-ssa/ipa-cp-1.c: Make return value used. * g++.dg/ipa/devirt-19.C: Add missing return, add -fipa-cp-clone option. * g++.dg/lto/devirt-19_0.C: Add -fipa-cp-clone option. * gcc.dg/ipa/ipa-sra-2.c: Removed. * gcc.dg/ipa/ipa-sra-6.c: Likewise. From-SVN: r275982
2019-07-03Add to same comdate group only if set (PR middle-end/90899)Martin Liska
2019-07-03 Martin Liska <mliska@suse.cz> PR middle-end/90899 * multiple_target.c (create_dispatcher_calls): Add to comdat group only if set for ifunc. 2019-07-03 Martin Liska <mliska@suse.cz> PR middle-end/90899 * gcc.target/i386/pr90899.c: New test. From-SVN: r272992
2019-05-16Do not allow target_clones with alias attr (PR lto/90500).Martin Liska
2019-05-16 Martin Liska <mliska@suse.cz> PR lto/90500 * multiple_target.c (expand_target_clones): Do not allow target_clones being used with a symbol that is an alias. 2019-05-16 Martin Liska <mliska@suse.cz> PR lto/90500 * gcc.target/i386/pr90500-1.c: New test. * gcc.target/i386/pr90500-2.c: New test. From-SVN: r271289
2019-04-12Handle multiple 'default' in target attribute (PR middle-end/89970).Martin Liska
2019-04-12 Martin Liska <mliska@suse.cz> PR middle-end/89970 * multiple_target.c (create_dispatcher_calls): Wrap ifunc in error message. (separate_attrs): Handle multiple 'default's. (expand_target_clones): Rework error handling code. 2019-04-12 Martin Liska <mliska@suse.cz> PR middle-end/89970 * gcc.target/i386/mvc15.c: New test. * gcc.target/i386/mvc3.c: Quote target in error pattern. * gcc.target/i386/mvc4.c: Remove duplicit 'default'. From-SVN: r270314
2019-03-14re PR ipa/89684 (ICE in gsi_for_stmt, at gimple-iterator.c:613)Jakub Jelinek
PR ipa/89684 * multiple_target.c (create_dispatcher_calls): Change references_to_redirect from vector of ipa_ref * to vector of ipa_ref. In the node->iterate_referring loop, push *ref rather than ref, call ref->remove_reference () and always pass 0 to iterate_referring. * gcc.target/i386/pr89684.c: New test. From-SVN: r269681
2019-01-18Reset proper type on vector types (PR middle-end/88587).Martin Liska
2019-01-18 Martin Liska <mliska@suse.cz> Richard Biener <rguenther@suse.de> PR middle-end/88587 * cgraph.h (create_version_clone_with_body): Add new argument with attributes. * cgraphclones.c (cgraph_node::create_version_clone): Add DECL_ATTRIBUTES to a newly created decl. And call valid_attribute_p so that proper cl_target_optimization_node is set for the newly created declaration. * multiple_target.c (create_target_clone): Set DECL_ATTRIBUTES for declaration. (expand_target_clones): Do not call valid_attribute_p, it must be already done. * tree-inline.c (copy_decl_for_dup_finish): Reset mode for vector types. 2019-01-18 Martin Liska <mliska@suse.cz> PR middle-end/88587 * g++.target/i386/pr88587.C: New test. * gcc.target/i386/mvc13.c: New test. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r268060
2019-01-01Update copyright years.Jakub Jelinek
From-SVN: r267494
2018-10-30Avoid unnecessarily numbering cloned symbols.Michael Ploujnikov
2018-10-30 Michael Ploujnikov <michael.ploujnikov@oracle.com> * cgraph.h (clone_function_name_1): Replaced by new clone_function_name_numbered that takes name as string; for privatize_symbol_name_1 use only. (clone_function_name): Renamed to clone_function_name_numbered to be explicit about numbering. (clone_function_name): New two-argument function that does not number its output. (clone_function_name): New three-argument function that takes a number to append to its output. * cgraphclones.c (duplicate_thunk_for_node): (clone_function_name_1): Renamed. (clone_function_name_numbered): Two new functions. (clone_function_name): Improved documentation. (cgraph_node::create_virtual_clone): Use clone_function_name_numbered. * config/rs6000/rs6000.c (make_resolver_func): Ditto. * final.c (final_scan_insn_1): Use the new clone_function_name without numbering. * multiple_target.c (create_dispatcher_calls): Ditto. (create_target_clone): Ditto. * omp-expand.c (grid_expand_target_grid_body): Ditto. * omp-low.c (create_omp_child_function_name): Ditto. * omp-simd-clone.c (simd_clone_create): Ditto. * symtab.c (simd_symtab_node::noninterposable_alias): Use the new clone_function_name without numbering. 2018-10-30 Michael Ploujnikov <michael.ploujnikov@oracle.com> * lto-partition.c (privatize_symbol_name_1): Use clone_function_name_numbered. 2018-10-30 Michael Ploujnikov <michael.ploujnikov@oracle.com> * gcc.dg/tree-prof/cold_partition_label.c: Update for cold section names without numbers. * gcc.dg/tree-prof/section-attr-1.c: Ditto. * gcc.dg/tree-prof/section-attr-2.c: Ditto. * gcc.dg/tree-prof/section-attr-3.c: Ditto. From-SVN: r265621
2018-10-04Redirect call within specific target attribute among MV clones (PR ipa/82625).Martin Liska
2018-10-04 Martin Liska <mliska@suse.cz> PR ipa/82625 * multiple_target.c (redirect_to_specific_clone): New function. (ipa_target_clone): Use it. * tree-inline.c: Fix comment. 2018-10-04 Martin Liska <mliska@suse.cz> PR ipa/82625 * g++.dg/ext/pr82625.C: New test. From-SVN: r264845
2018-08-20Add support for grouping of related diagnostics (PR other/84889)David Malcolm
We often emit logically-related groups of diagnostics. A relatively simple case is this: if (warning_at (body_loc, OPT_Wmultistatement_macros, "macro expands to multiple statements")) inform (guard_loc, "some parts of macro expansion are not guarded by " "this %qs clause", guard_tinfo_to_string (keyword)); where the "note" diagnostic issued by the "inform" call is guarded by the -Wmultistatement_macros warning. More complicated examples can be seen in the C++ frontend, where e.g. print_z_candidates can lead to numerous "note" diagnostics being emitted. I'm looking at various ways to improve how we handle such related diagnostics, but, prior to this patch, there was no explicit relationship between these diagnostics: the diagnostics subsystem had no way of "knowing" that these were related. This patch introduces a simple way to group the diagnostics: an auto_diagnostic_group class: all diagnostics emitted within the lifetime of an auto_diagnostic_group instance are logically grouped. Hence in the above example, the two diagnostics can be grouped by simply adding an auto_diagnostic_group instance: auto_diagnostic_group d; if (warning_at (body_loc, OPT_Wmultistatement_macros, "macro expands to multiple statements")) inform (guard_loc, "some parts of macro expansion are not guarded by " "this %qs clause", guard_tinfo_to_string (keyword)); Some more awkard cases are of the form: if (some_condition && warning_at (...) && more_conditions) inform (...); which thus need restructuring to: if (some_condition) { auto_diagnostic_group d; warning_at (...); if (more_conditions) inform (...); } so that the lifetime of the auto_diagnostic_group groups the warning_at and the inform call. Nesting is handled by simply tracking a nesting depth within the diagnostic_context.: all diagnostics are treated as grouped until the final auto_diagnostic_group is popped. diagnostic.c uses this internally, so that all diagnostics are part of a group - those that are "by themselves" are treated as being part of a group with one element. The diagnostic_context gains optional callbacks for displaying the start of a group (when the first diagnostic is emitted within it), and the end of a group (for when the group was non-empty); these callbacks are unused by default, but a test plugin demonstrates them (and verifies that the machinery is working). As noted above, I'm looking at various ways to use the grouping to improve how we output the diagnostics. FWIW, I experimented with a more involved implementation, of the form: diagnostic_group d; if (d.warning_at (body_loc, OPT_Wmultistatement_macros, "macro expands to multiple statements")) d.inform (guard_loc, "some parts of macro expansion are not guarded by " "this %qs clause", guard_tinfo_to_string (keyword)); which had the advantage of allowing auto-detection of the places where groups were needed (by converting ::warning_at's return type to bool), but it was a much more invasive patch, especially when dealing with the places in the C++ frontend that can emit numerous notes after an error or warning (and thus having to pass the group around) Hence I went with this simpler approach. gcc/c-family/ChangeLog: PR other/84889 * c-attribs.c (common_handle_aligned_attribute): Add auto_diagnostic_group instance. * c-indentation.c (warn_for_misleading_indentation): Likewise. * c-opts.c (c_common_post_options): Likewise. * c-warn.c (warn_logical_not_parentheses): Likewise. (warn_duplicated_cond_add_or_warn): Likewise. (warn_for_multistatement_macros): Likewise. gcc/c/ChangeLog: PR other/84889 * c-decl.c (pushtag): Add auto_diagnostic_group instance. (diagnose_mismatched_decls): Likewise, in various places. (warn_if_shadowing): Likewise. (implicit_decl_warning): Likewise. (implicitly_declare): Likewise. (undeclared_variable): Likewise. (declare_label): Likewise. (grokdeclarator): Likewise. (start_function): Likewise. * c-parser.c (c_parser_declaration_or_fndef): Likewise. (c_parser_parameter_declaration): Likewise. (c_parser_binary_expression): Likewise. * c-typeck.c (c_expr_sizeof_expr): Likewise. (parser_build_binary_op): Likewise. (build_unary_op): Likewise. (error_init): Likewise. (pedwarn_init): Likewise. (warning_init): Likewise. (convert_for_assignment): Likewise. gcc/cp/ChangeLog: PR other/84889 * call.c (build_user_type_conversion_1): Add auto_diagnostic_group instance(s). (print_error_for_call_failure): Likewise. (build_op_call_1): Likewise. (build_conditional_expr_1): Likewise. (build_new_op_1): Likewise. (build_op_delete_call): Likewise. (convert_like_real): Likewise. (build_over_call): Likewise. (build_new_method_call_1): Likewise. (joust): Likewise. * class.c (check_tag): Likewise. (finish_struct_anon_r): Likewise. (one_inherited_ctor): Likewise. (finalize_literal_type_property): Likewise. (explain_non_literal_class): Likewise. (find_flexarrays): Likewise. (resolve_address_of_overloaded_function): Likewise. * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise. (is_valid_constexpr_fn): Likewise. (cx_check_missing_mem_inits): Likewise. * cp-gimplify.c (cp_genericize_r): Likewise. * cvt.c (maybe_warn_nodiscard): Likewise. * decl.c (warn_extern_redeclared_static): Likewise. (check_redeclaration_exception_specification): Likewise. (check_no_redeclaration_friend_default_args): Likewise. (duplicate_decls): Likewise. (redeclaration_error_message): Likewise. (warn_misplaced_attr_for_class_type): Likewise. * decl2.c (finish_static_data_member_decl): Likewise. (no_linkage_error): Likewise. (cp_warn_deprecated_use): Likewise. * error.c (qualified_name_lookup_error): Likewise. * friend.c (make_friend_class): Likewise. (do_friend): Likewise. * init.c (perform_member_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_delete): Likewise. * lex.c (unqualified_name_lookup_error): Likewise. * name-lookup.c (check_extern_c_conflict): Likewise. (inform_shadowed): New function. (check_local_shadow): Add auto_diagnostic_group instances, replacing goto "inform_shadowed" label with call to subroutine. (set_local_extern_decl_linkage): Add auto_diagnostic_group instance(s). * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_namespace_name): Likewise. * pt.c (check_specialization_namespace): Likewise. (check_template_variable): Likewise. (warn_spec_missing_attributes): Likewise. (check_explicit_specialization): Likewise. (process_partial_specialization): Likewise. (lookup_template_class_1): Likewise. (finish_template_variable): Likewise. (do_auto_deduction): Likewise. * search.c (check_final_overrider): Likewise. (look_for_overrides_r): Likewise. * tree.c (maybe_warn_parm_abi): Likewise. * typeck.c (cxx_sizeof_expr): Likewise. (cp_build_function_call_vec): Likewise. (cp_build_binary_op): Likewise. (convert_for_assignment): Likewise. (maybe_warn_about_returning_address_of_local): Likewise. * typeck2.c (abstract_virtuals_error_sfinae): Likewise. (check_narrowing): Likewise. gcc/ChangeLog: PR other/84889 * attribs.c (diag_attr_exclusions): Add auto_diagnostic_group instance. (decl_attributes): Likewise. * calls.c (maybe_warn_nonstring_arg): Add auto_diagnostic_group instance. * cgraphunit.c (maybe_diag_incompatible_alias): Likewise. * diagnostic-core.h (class auto_diagnostic_group): New class. * diagnostic.c (diagnostic_initialize): Initialize the new fields. (diagnostic_report_diagnostic): Handle the first diagnostics within a group. (emit_diagnostic): Add auto_diagnostic_group instance. (inform): Likewise. (inform_n): Likewise. (warning): Likewise. (warning_at): Likewise. (warning_n): Likewise. (pedwarn): Likewise. (permerror): Likewise. (error): Likewise. (error_n): Likewise. (error_at): Likewise. (sorry): Likewise. (fatal_error): Likewise. (internal_error): Likewise. (internal_error_no_backtrace): Likewise. (auto_diagnostic_group::auto_diagnostic_group): New ctor. (auto_diagnostic_group::~auto_diagnostic_group): New dtor. * diagnostic.h (struct diagnostic_context): Add fields "diagnostic_group_nesting_depth", "diagnostic_group_emission_count", "begin_group_cb", "end_group_cb". * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior): Add auto_diagnostic_group instance(s). (find_explicit_erroneous_behavior): Likewise. * gimple-ssa-warn-alloca.c (pass_walloca::execute): Likewise. * gimple-ssa-warn-restrict.c (maybe_diag_offset_bounds): Likewise. * gimplify.c (warn_implicit_fallthrough_r): Likewise. (gimplify_va_arg_expr): Likewise. * hsa-gen.c (HSA_SORRY_ATV): Likewise. (HSA_SORRY_AT): Likewise. * ipa-devirt.c (compare_virtual_tables): Likewise. (warn_odr): Likewise. * multiple_target.c (expand_target_clones): Likewise. * opts-common.c (cmdline_handle_error): Likewise. * reginfo.c (globalize_reg): Likewise. * substring-locations.c (format_warning_n_va): Likewise. * tree-inline.c (expand_call_inline): Likewise. * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise. * tree-ssa-loop-niter.c (do_warn_aggressive_loop_optimizations): Likewise. * tree-ssa-uninit.c (warn_uninit): Likewise. * tree.c (warn_deprecated_use): Likewise. gcc/testsuite/ChangeLog: PR other/84889 * gcc.dg/plugin/diagnostic-group-test-1.c: New test. * gcc.dg/plugin/diagnostic_group_plugin.c: New test. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new tests. From-SVN: r263675
2018-04-17Make redirection only for target_clones: V3 (PR ipa/85329).Martin Liska
2018-04-17 Martin Liska <mliska@suse.cz> PR ipa/85329 * multiple_target.c (create_dispatcher_calls): Set apostrophes for target_clone error message. Make default implementation clone to be a local declaration. (separate_attrs): Add new argument and check for an empty string. (expand_target_clones): Handle it. (ipa_target_clone): Make redirection just for target_clones functions. 2018-04-17 Martin Liska <mliska@suse.cz> PR ipa/85329 * g++.dg/ext/pr85329-2.C: New test. * g++.dg/ext/pr85329.C: New test. * gcc.target/i386/mvc12.c: New test. From-SVN: r259428
2018-03-16Redirect reference in the symbol table (PR ipa/84833).Martin Liska
2018-03-16 Martin Liska <mliska@suse.cz> PR ipa/84833 * multiple_target.c (create_dispatcher_calls): Redirect reference in the symbol table. 2018-03-16 Martin Liska <mliska@suse.cz> PR ipa/84833 * gcc.target/i386/mvc11.c: New test. From-SVN: r258596
2018-03-16Properly redirect alias for MVC (PR ipa/84722).Martin Liska
2018-03-16 Martin Liska <mliska@suse.cz> PR ipa/84722 * multiple_target.c (create_dispatcher_calls): Redirect also an alias. 2018-03-16 Martin Liska <mliska@suse.cz> PR ipa/84722 * gcc.target/i386/mvc10.c: New test. From-SVN: r258595
2018-03-07re PR middle-end/84723 (ICE in create_target_clone, at multiple_target.c:275)Jakub Jelinek
PR middle-end/84723 * multiple_target.c: Include tree-inline.h and intl.h. (expand_target_clones): Diagnose and fail if node->definition and !tree_versionable_function_p (node->decl). * gcc.target/i386/pr84723-1.c: New test. * gcc.target/i386/pr84723-2.c: New test. * gcc.target/i386/pr84723-3.c: New test. * gcc.target/i386/pr84723-4.c: New test. * gcc.target/i386/pr84723-5.c: New test. From-SVN: r258316
2018-01-03Update copyright years.Jakub Jelinek
From-SVN: r256169
2017-06-30Fix removal of ifunc (PR ipa/81214).Martin Liska
2017-06-30 Martin Liska <mliska@suse.cz> PR ipa/81214 * gcc.target/i386/pr81214.c: New test. 2017-06-30 Martin Liska <mliska@suse.cz> PR ipa/81214 * multiple_target.c (create_dispatcher_calls): Make ifunc also for function that don't have calls or are not referenced. From-SVN: r249840
2017-06-28re PR ipa/81238 (Target clone support does not make default clone static.)Michael Meissner
[gcc] 2017-06-28 Michael Meissner <meissner@linux.vnet.ibm.com> PR ipa/81238 * multiple_target.c (create_dispatcher_calls): Set the default clone to be static, not public. [gcc/testsuite] 2017-06-28 Michael Meissner <meissner@linux.vnet.ibm.com> PR target/81193 * lib/target-supports.exp (check_ppc_cpu_supports_hw_available): New test to make sure __builtin_cpu_supports works on power7 and newer. From-SVN: r249737
2017-06-23re PR ipa/81185 (Target clones support generates awkward names)Michael Meissner
2017-06-23 Michael Meissner <meissner@linux.vnet.ibm.com> PR ipa/81185 * multiple_target.c (create_dispatcher_calls): Only create the dispatcher call if the function is the default clone of a versioned function. From-SVN: r249605
2017-06-19Fix multi-versioning issues (PR ipa/80732).Martin Liska
2017-06-19 Martin Liska <mliska@suse.cz> PR ipa/80732 * attribs.c (make_dispatcher_decl): Do not append '.ifunc' to dispatcher function name. * multiple_target.c (replace_function_decl): New function. (create_dispatcher_calls): Redirect both edges and references. 2017-06-19 Martin Liska <mliska@suse.cz> PR ipa/80732 * gcc.target/i386/mvc5.c: Scan indirect_function. * gcc.target/i386/mvc7.c: Likewise. * gcc.target/i386/pr80732.c: New test. From-SVN: r249365
2017-03-14Do not ICE on an invalid input for MV.Martin Liska
2017-03-14 Martin Liska <mliska@suse.cz> * multiple_target.c (expand_target_clones): Bail out for an invalid attribute. From-SVN: r246124
2017-03-14Verify that target can create a dispatcher call (PR target/79892).Martin Liska
2017-03-14 Martin Liska <mliska@suse.cz> PR target/79892 * multiple_target.c (create_dispatcher_calls): Check that a target can create a function dispatcher. From-SVN: r246120
2017-03-14Fix multiple target clones nodes (PR lto/66295).Martin Liska
2017-03-14 Martin Liska <mliska@suse.cz> PR lto/66295 * multiple_target.c (expand_target_clones): Drop local.local flag for default implementation. 2017-03-14 Martin Liska <mliska@suse.cz> PR lto/66295 * gcc.dg/tree-prof/pr66295.c: New test. From-SVN: r246119
2017-02-03Simplify creation of target_clones (PR lto/66295)Martin Liska
2017-02-03 Martin Liska <mliska@suse.cz> PR lto/66295 * multiple_target.c (create_dispatcher_calls): Redirect edge from a caller of a dispatcher. (expand_target_clones): Make the clones local. (ipa_target_clone): Do both target clones and resolvers. (ipa_dispatcher_calls): Remove the pass. (pass_dispatcher_calls::gate): Likewise. (make_pass_dispatcher_calls): Likewise. * passes.def (pass_target_clone): Put as very first IPA early pass. 2017-02-03 Martin Liska <mliska@suse.cz> PR lto/66295 * gcc.target/i386/mvc9.c: New test. From-SVN: r245155
2017-01-05[bootstrap-O1] add initializers to avoid warnings at -O1Alexandre Oliva
Building with the bootstrap-O1 configuration option fails to compile a number of files due to AFAICT false-positive warnings about uses of uninitialized variables. This patch adds dummy initializers to silence them all. for gcc/ChangeLog * multiple_target.c (create_dispatcher_calls): Init e_next. * tree-ssa-loop-split.c (split_loop): Init border. * tree-vect-loop.c (vect_determine_vectorization_factor): Init scalar_type. From-SVN: r244086
2017-01-01Update copyright years.Jakub Jelinek
From-SVN: r243994
2016-11-18re PR middle-end/78419 (ICE with target_clone on invalid target)Jakub Jelinek
PR middle-end/78419 * multiple_target.c (get_attr_len): Start with argnum and increment argnum on every arg. Use strchr in a loop instead of counting commas manually. (get_attr_str): Increment argnum for every comma in the string. (separate_attrs): Use for instead of while loop, simplify. (expand_target_clones): Rename defenition argument to definition. Free attrs and attr_str even when diagnosing errors. Temporarily change input_location around targetm.target_option.valid_attribute_p calls. Don't emit warning or errors if that function fails. * gcc.target/i386/pr78419.c: New test. From-SVN: r242608
2016-08-25* multiple_target.c (pass_data_dispatcher_calls): Fix typo.David Edelsohn
From-SVN: r239755
2016-01-04Update copyright years.Jakub Jelinek
From-SVN: r232055
2015-11-03multiple_target.c (create_dispatcher_calls): Add target check on ifunc.Evgeny Stupachenko
2015-11-03 Evgeny Stupachenko <evstupac@gmail.com> gcc/ * multiple_target.c (create_dispatcher_calls): Add target check on ifunc. (create_target_clone): Change assembler name for versioned declarations. gcc/testsuite/ * g++.dg/ext/mvc4.C: Add dg-require-ifunc condition. * gcc.target/i386/mvc5.c: Ditto. * gcc.target/i386/mvc7.c: Add dg-require-ifunc condition and checks on resolver. From-SVN: r229706
2015-10-30Makefile.in (OBJS): Add multiple_target.o.Evgeny Stupachenko
2015-10-30 Evgeny Stupachenko <evstupac@gmail.com> gcc/ * Makefile.in (OBJS): Add multiple_target.o. * attrib.c (make_attribute): Moved from config/i386/i386.c * config/i386/i386.c (make_attribute): Deleted. * multiple_target.c (create_dispatcher_calls): New. (get_attr_len): Ditto. (get_attr_str): Ditto. (separate_attrs): Ditto. (is_valid_asm_symbol): Ditto. (create_new_asm_name): Ditto. (create_target_clone): Ditto. (expand_target_clones): Ditto. (ipa_target_clone): Ditto. (ipa_dispatcher_calls): Ditto. * passes.def (pass_target_clone): Two new ipa passes. * tree-pass.h (make_pass_target_clone): Ditto. * doc/extend.texi (target_clones): New attribute description. gcc/c-family/ * c-common.c (handle_target_clones_attribute): New. (c_common_attribute_table): Add handle_target_clones_attribute. (handle_always_inline_attribute): Add check on target_clones attribute. (handle_target_attribute): Ditto. gcc/testsuite/ * gcc.dg/mvc1.c: New test for multiple targets cloning. * gcc.dg/mvc2.c: Ditto. * gcc.dg/mvc3.c: Ditto. * gcc.dg/mvc4.c: Ditto. * gcc.dg/mvc5.c: Ditto. * gcc.dg/mvc6.c: Ditto. * gcc.dg/mvc7.c: Ditto. * g++.dg/ext/mvc1.C: Ditto. * g++.dg/ext/mvc2.C: Ditto. * g++.dg/ext/mvc3.C: Ditto. * g++.dg/ext/mvc4.C: Ditto. From-SVN: r229595