Successfully identified regression in *gcc* in CI configuration tcwg_bmk_gnu_apm/gnu-release-aarch64-spec2k6-Os_LTO. So far, this commit has regressed CI configurations: - tcwg_bmk_gnu_apm/gnu-release-aarch64-spec2k6-Os_LTO
Culprit: <cut> commit ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4 Author: Martin Jambor mjambor@suse.cz Date: Fri Sep 20 00:25:04 2019 +0200
New IPA-SRA
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 </cut>
Results regressed to (for first_bad == ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer: -5 # true: 0 # benchmark -Os_LTO -- artifacts/build-ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4/results_id: 1 # 450.soplex,soplex_base.default regressed by 103
from (for last_good == 6889a3acfeed47265886676c6d43b04ef799fb82) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer: -5 # true: 0 # benchmark -Os_LTO -- artifacts/build-6889a3acfeed47265886676c6d43b04ef799fb82/results_id: 1
Artifacts of last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa... Results ID of last_good: apm_64/tcwg_bmk_gnu_apm/bisect-gnu-release-aarch64-spec2k6-Os_LTO/2526 Artifacts of first_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa... Results ID of first_bad: apm_64/tcwg_bmk_gnu_apm/bisect-gnu-release-aarch64-spec2k6-Os_LTO/2531 Build top page/logs: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa...
Configuration details:
Reproduce builds: <cut> mkdir investigate-gcc-ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4 cd investigate-gcc-ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4
git clone https://git.linaro.org/toolchain/jenkins-scripts
mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa... --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa... --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa... --fail chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
# Save baseline build state (which is then restored in artifacts/test.sh) mkdir -p ./bisect rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gcc/ ./ ./bisect/baseline/
cd gcc
# Reproduce first_bad build git checkout --detach ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4 ../artifacts/test.sh
# Reproduce last_good build git checkout --detach 6889a3acfeed47265886676c6d43b04ef799fb82 ../artifacts/test.sh
cd .. </cut>
History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/c...
Artifacts: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa... Build log: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-release-aa...
Full commit (up to 1000 lines): <cut> commit ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4 Author: Martin Jambor mjambor@suse.cz Date: Fri Sep 20 00:25:04 2019 +0200
New IPA-SRA
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 --- gcc/ChangeLog | 98 + gcc/Makefile.in | 3 +- gcc/cgraph.c | 127 +- gcc/cgraph.h | 45 +- gcc/cgraphclones.c | 213 +- gcc/coretypes.h | 1 + gcc/dbgcnt.def | 3 +- gcc/doc/invoke.texi | 5 + gcc/ipa-cp.c | 172 +- gcc/ipa-fnsummary.c | 4 +- gcc/ipa-inline-transform.c | 3 +- gcc/ipa-param-manipulation.c | 2093 +++++++++++---- gcc/ipa-param-manipulation.h | 449 +++- gcc/ipa-prop.c | 103 +- gcc/ipa-split.c | 32 +- gcc/ipa-sra.c | 4049 ++++++++++++++++++++++++++++++ gcc/lto-cgraph.c | 121 +- gcc/lto-section-in.c | 3 +- gcc/lto-streamer.h | 1 + gcc/multiple_target.c | 5 +- gcc/omp-simd-clone.c | 229 +- gcc/params.def | 7 + gcc/passes.def | 2 +- gcc/testsuite/ChangeLog | 40 + gcc/testsuite/g++.dg/ipa/devirt-19.C | 5 +- gcc/testsuite/g++.dg/ipa/ipa-sra-1.C | 46 + gcc/testsuite/g++.dg/ipa/ipa-sra-2.C | 19 + gcc/testsuite/g++.dg/ipa/ipa-sra-3.C | 9 + gcc/testsuite/g++.dg/ipa/pr81248.C | 4 +- gcc/testsuite/g++.dg/lto/devirt-19_0.C | 2 +- gcc/testsuite/gcc.dg/ipa/20040703-wpa.c | 151 ++ gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c | 4 +- gcc/testsuite/gcc.dg/ipa/ipa-sra-10.c | 4 +- gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c | 6 +- gcc/testsuite/gcc.dg/ipa/ipa-sra-12.c | 50 + gcc/testsuite/gcc.dg/ipa/ipa-sra-13.c | 49 + gcc/testsuite/gcc.dg/ipa/ipa-sra-14.c | 60 + gcc/testsuite/gcc.dg/ipa/ipa-sra-15.c | 61 + gcc/testsuite/gcc.dg/ipa/ipa-sra-16.c | 74 + gcc/testsuite/gcc.dg/ipa/ipa-sra-17.c | 102 + gcc/testsuite/gcc.dg/ipa/ipa-sra-18.c | 49 + gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c | 31 + gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c | 51 - gcc/testsuite/gcc.dg/ipa/ipa-sra-20.c | 38 + gcc/testsuite/gcc.dg/ipa/ipa-sra-21.c | 33 + gcc/testsuite/gcc.dg/ipa/ipa-sra-22.c | 56 + gcc/testsuite/gcc.dg/ipa/ipa-sra-3.c | 7 +- gcc/testsuite/gcc.dg/ipa/ipa-sra-4.c | 8 +- gcc/testsuite/gcc.dg/ipa/ipa-sra-5.c | 4 +- gcc/testsuite/gcc.dg/ipa/ipa-sra-6.c | 33 - gcc/testsuite/gcc.dg/ipa/ipacost-2.c | 4 +- gcc/testsuite/gcc.dg/ipa/ipcp-agg-9.c | 2 +- gcc/testsuite/gcc.dg/ipa/pr78121.c | 2 +- gcc/testsuite/gcc.dg/ipa/vrp1.c | 4 +- gcc/testsuite/gcc.dg/ipa/vrp2.c | 4 +- gcc/testsuite/gcc.dg/ipa/vrp3.c | 2 +- gcc/testsuite/gcc.dg/ipa/vrp7.c | 2 +- gcc/testsuite/gcc.dg/ipa/vrp8.c | 2 +- gcc/testsuite/gcc.dg/noreorder.c | 6 +- gcc/testsuite/gcc.dg/sso/ipa-sra-1.c | 57 + gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c | 2 +- gcc/trans-mem.c | 3 +- gcc/tree-inline.c | 385 ++- gcc/tree-inline.h | 10 + gcc/tree-pass.h | 2 +- gcc/tree-sra.c | 1859 +------------- gcc/tree-sra.h | 31 + 67 files changed, 7998 insertions(+), 3143 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9dfb64643c1..6f34d1a90c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,101 @@ +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. + 2019-09-19 Martin Sebor msebor@redhat.com
PR middle-end/91631 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 152df9fa9b3..2cf0c79c977 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1368,6 +1368,7 @@ OBJS = \ init-regs.o \ internal-fn.o \ ipa-cp.o \ + ipa-sra.o \ ipa-devirt.o \ ipa-fnsummary.o \ ipa-polymorphic-call.o \ @@ -2527,7 +2528,7 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/reload.h $(srcdir)/caller-save.c $(srcdir)/symtab.c \ $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \ $(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-utils.h \ - $(srcdir)/dbxout.c \ + $(srcdir)/ipa-param-manipulation.h $(srcdir)/ipa-sra.c $(srcdir)/dbxout.c \ $(srcdir)/signop.h \ $(srcdir)/dwarf2out.h \ $(srcdir)/dwarf2asm.c \ diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 843891e9e56..331b363c175 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1342,7 +1342,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void) if (flag_checking && decl) { cgraph_node *node = cgraph_node::get (decl); - gcc_assert (!node || !node->clone.combined_args_to_skip); + gcc_assert (!node || !node->clone.param_adjustments); }
if (symtab->dump_file) @@ -1350,25 +1350,36 @@ cgraph_edge::redirect_call_stmt_to_callee (void) fprintf (symtab->dump_file, "updating call of %s -> %s: ", e->caller->dump_name (), e->callee->dump_name ()); print_gimple_stmt (symtab->dump_file, e->call_stmt, 0, dump_flags); - if (e->callee->clone.combined_args_to_skip) + if (e->callee->clone.param_adjustments) + e->callee->clone.param_adjustments->dump (symtab->dump_file); + unsigned performed_len + = vec_safe_length (e->caller->clone.performed_splits); + if (performed_len > 0) + fprintf (symtab->dump_file, "Performed splits records:\n"); + for (unsigned i = 0; i < performed_len; i++) { - fprintf (symtab->dump_file, " combined args to skip: "); - dump_bitmap (symtab->dump_file, - e->callee->clone.combined_args_to_skip); + ipa_param_performed_split *sm + = &(*e->caller->clone.performed_splits)[i]; + print_node_brief (symtab->dump_file, " dummy_decl: ", sm->dummy_decl, + TDF_UID); + fprintf (symtab->dump_file, ", unit_offset: %u\n", sm->unit_offset); } }
- if (e->callee->clone.combined_args_to_skip) + if (ipa_param_adjustments *padjs = e->callee->clone.param_adjustments) { - int lp_nr; + /* We need to defer cleaning EH info on the new statement to + fixup-cfg. We may not have dominator information at this point + and thus would end up with unreachable blocks and have no way + to communicate that we need to run CFG cleanup then. */ + int lp_nr = lookup_stmt_eh_lp (e->call_stmt); + if (lp_nr != 0) + remove_stmt_from_eh_lp (e->call_stmt);
- new_stmt = e->call_stmt; - if (e->callee->clone.combined_args_to_skip) - new_stmt - = gimple_call_copy_skip_args (new_stmt, - e->callee->clone.combined_args_to_skip); tree old_fntype = gimple_call_fntype (e->call_stmt); - gimple_call_set_fndecl (new_stmt, e->callee->decl); + new_stmt = padjs->modify_call (e->call_stmt, + e->caller->clone.performed_splits, + e->callee->decl, false); cgraph_node *origin = e->callee; while (origin->clone_of) origin = origin->clone_of; @@ -1379,92 +1390,12 @@ cgraph_edge::redirect_call_stmt_to_callee (void) gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl)); else { - bitmap skip = e->callee->clone.combined_args_to_skip; - tree t = cgraph_build_function_type_skip_args (old_fntype, skip, - false); - gimple_call_set_fntype (new_stmt, t); - } - - if (gimple_vdef (new_stmt) - && TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME) - SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt; - - gsi = gsi_for_stmt (e->call_stmt); - - /* For optimized away parameters, add on the caller side - before the call - DEBUG D#X => parm_Y(D) - stmts and associate D#X with parm in decl_debug_args_lookup - vector to say for debug info that if parameter parm had been passed, - it would have value parm_Y(D). */ - if (e->callee->clone.combined_args_to_skip && MAY_HAVE_DEBUG_BIND_STMTS) - { - vec<tree, va_gc> **debug_args - = decl_debug_args_lookup (e->callee->decl); - tree old_decl = gimple_call_fndecl (e->call_stmt); - if (debug_args && old_decl) - { - tree parm; - unsigned i = 0, num; - unsigned len = vec_safe_length (*debug_args); - unsigned nargs = gimple_call_num_args (e->call_stmt); - for (parm = DECL_ARGUMENTS (old_decl), num = 0; - parm && num < nargs; - parm = DECL_CHAIN (parm), num++) - if (bitmap_bit_p (e->callee->clone.combined_args_to_skip, num) - && is_gimple_reg (parm)) - { - unsigned last = i; - - while (i < len && (**debug_args)[i] != DECL_ORIGIN (parm)) - i += 2; - if (i >= len) - { - i = 0; - while (i < last - && (**debug_args)[i] != DECL_ORIGIN (parm)) - i += 2; - if (i >= last) - continue; - } - tree ddecl = (**debug_args)[i + 1]; - tree arg = gimple_call_arg (e->call_stmt, num); - if (!useless_type_conversion_p (TREE_TYPE (ddecl), - TREE_TYPE (arg))) - { - tree rhs1; - if (!fold_convertible_p (TREE_TYPE (ddecl), arg)) - continue; - if (TREE_CODE (arg) == SSA_NAME - && gimple_assign_cast_p (SSA_NAME_DEF_STMT (arg)) - && (rhs1 - = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (arg))) - && useless_type_conversion_p (TREE_TYPE (ddecl), - TREE_TYPE (rhs1))) - arg = rhs1; - else - arg = fold_convert (TREE_TYPE (ddecl), arg); - } - - gimple *def_temp - = gimple_build_debug_bind (ddecl, unshare_expr (arg), - e->call_stmt); - gsi_insert_before (&gsi, def_temp, GSI_SAME_STMT); - } - } + tree new_fntype = padjs->build_new_function_type (old_fntype, true); + gimple_call_set_fntype (new_stmt, new_fntype); }
- gsi_replace (&gsi, new_stmt, false); - /* We need to defer cleaning EH info on the new statement to - fixup-cfg. We may not have dominator information at this point - and thus would end up with unreachable blocks and have no way - to communicate that we need to run CFG cleanup then. */ - lp_nr = lookup_stmt_eh_lp (e->call_stmt); if (lp_nr != 0) - { - remove_stmt_from_eh_lp (e->call_stmt); - add_stmt_to_eh_lp (new_stmt, lp_nr); - } + add_stmt_to_eh_lp (new_stmt, lp_nr); } else { @@ -3014,8 +2945,8 @@ clone_of_p (cgraph_node *node, cgraph_node *node2) return true; node = node->callees->callee->ultimate_alias_target ();
- if (!node2->clone.args_to_skip - || !bitmap_bit_p (node2->clone.args_to_skip, 0)) + if (!node2->clone.param_adjustments + || node2->clone.param_adjustments->first_param_intact_p ()) return false; if (node2->former_clone_of == node->decl) return true; diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 4c54210123a..1da6cab54b0 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "profile-count.h" #include "ipa-ref.h" #include "plugin-api.h" +#include "ipa-param-manipulation.h"
extern void debuginfo_early_init (void); extern void debuginfo_init (void); @@ -740,23 +741,31 @@ struct GTY(()) cgraph_global_info { will be replaced by another tree while versioning. */ struct GTY(()) ipa_replace_map { - /* The tree that will be replaced. */ - tree old_tree; /* The new (replacing) tree. */ tree new_tree; /* Parameter number to replace, when old_tree is NULL. */ int parm_num; - /* True when a substitution should be done, false otherwise. */ - bool replace_p; - /* True when we replace a reference to old_tree. */ - bool ref_p; };
struct GTY(()) cgraph_clone_info { + /* Constants discovered by IPA-CP, i.e. which parameter should be replaced + with what. */ vec<ipa_replace_map *, va_gc> *tree_map; - bitmap args_to_skip; - bitmap combined_args_to_skip; + /* Parameter modification that IPA-SRA decided to perform. */ + ipa_param_adjustments *param_adjustments; + /* Lists of dummy-decl and offset pairs representing split formal parameters + in the caller. Offsets of all new replacements are enumerated, those + coming from the same original parameter have the same dummy decl stored + along with them. + + Dummy decls sit in call statement arguments followed by new parameter + decls (or their SSA names) in between (caller) clone materialization and + call redirection. Redirection then recognizes the dummy variable and + together with the stored offsets can reconstruct what exactly the new + parameter decls represent and can leave in place only those that the + callee expects. */ + vec<ipa_param_performed_split, va_gc> *performed_splits; };
enum cgraph_simd_clone_arg_type @@ -976,15 +985,16 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, cgraph_node *new_inlined_to, - bitmap args_to_skip, const char *suffix = NULL); + ipa_param_adjustments *param_adjustments, + const char *suffix = NULL);
/* Create callgraph node clone with new declaration. The actual body will be copied later at compilation stage. The name of the new clone will be constructed from the name of the original node, SUFFIX and NUM_SUFFIX. */ cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, - bitmap args_to_skip, const char * suffix, - unsigned num_suffix); + ipa_param_adjustments *param_adjustments, + const char * suffix, unsigned num_suffix);
/* cgraph node being removed from symbol table; see if its entry can be replaced by other inline clone. */ @@ -1033,9 +1043,10 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node Return the new version's cgraph node. */ cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, - vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, - bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, - const char *clone_name, tree target_attributes = NULL_TREE); + vec<ipa_replace_map *, va_gc> *tree_map, + ipa_param_adjustments *param_adjustments, + bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name, + tree target_attributes = NULL_TREE);
/* Insert a new cgraph_function_version_info node into cgraph_fnver_htab corresponding to cgraph_node. */ @@ -2459,14 +2470,12 @@ tree clone_function_name (tree decl, const char *suffix, tree clone_function_name (tree decl, const char *suffix);
void tree_function_versioning (tree, tree, vec<ipa_replace_map *, va_gc> *, - bool, bitmap, bool, bitmap, basic_block); + ipa_param_adjustments *, + bool, bitmap, basic_block);
void dump_callgraph_transformation (const cgraph_node *original, const cgraph_node *clone, const char *suffix); -tree cgraph_build_function_type_skip_args (tree orig_type, bitmap args_to_skip, - bool skip_return); - /* In cgraphbuild.c */ int compute_call_stmt_bb_frequency (tree, basic_block bb); void record_references_in_initializer (tree, bool); diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index fa753697c78..909407b9a71 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -142,96 +142,6 @@ cgraph_edge::clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid, return new_edge; }
-/* Build variant of function type ORIG_TYPE skipping ARGS_TO_SKIP and the - return value if SKIP_RETURN is true. */ - -tree -cgraph_build_function_type_skip_args (tree orig_type, bitmap args_to_skip, - bool skip_return) -{ - tree new_type = NULL; - tree args, new_args = NULL; - tree new_reversed; - int i = 0; - - for (args = TYPE_ARG_TYPES (orig_type); args && args != void_list_node; - args = TREE_CHAIN (args), i++) - if (!args_to_skip || !bitmap_bit_p (args_to_skip, i)) - new_args = tree_cons (NULL_TREE, TREE_VALUE (args), new_args); - - new_reversed = nreverse (new_args); - if (args) - { - if (new_reversed) - TREE_CHAIN (new_args) = void_list_node; - else - new_reversed = void_list_node; - } - - /* Use copy_node to preserve as much as possible from original type - (debug info, attribute lists etc.) - Exception is METHOD_TYPEs must have THIS argument. - When we are asked to remove it, we need to build new FUNCTION_TYPE - instead. */ - if (TREE_CODE (orig_type) != METHOD_TYPE - || !args_to_skip - || !bitmap_bit_p (args_to_skip, 0)) - { - new_type = build_distinct_type_copy (orig_type); - TYPE_ARG_TYPES (new_type) = new_reversed; - } - else - { - new_type - = build_distinct_type_copy (build_function_type (TREE_TYPE (orig_type), - new_reversed)); - TYPE_CONTEXT (new_type) = TYPE_CONTEXT (orig_type); - } - - if (skip_return) - TREE_TYPE (new_type) = void_type_node; - - return new_type; -} - -/* Build variant of function decl ORIG_DECL skipping ARGS_TO_SKIP and the - return value if SKIP_RETURN is true. - - Arguments from DECL_ARGUMENTS list can't be removed now, since they are - linked by TREE_CHAIN directly. The caller is responsible for eliminating - them when they are being duplicated (i.e. copy_arguments_for_versioning). */ - -static tree -build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip, - bool skip_return) -{ - tree new_decl = copy_node (orig_decl); - tree new_type; - - new_type = TREE_TYPE (orig_decl); - if (prototype_p (new_type) - || (skip_return && !VOID_TYPE_P (TREE_TYPE (new_type)))) - new_type - = cgraph_build_function_type_skip_args (new_type, args_to_skip, - skip_return); - TREE_TYPE (new_decl) = new_type; - - /* For declarations setting DECL_VINDEX (i.e. methods) - we expect first argument to be THIS pointer. */ - if (args_to_skip && bitmap_bit_p (args_to_skip, 0)) - DECL_VINDEX (new_decl) = NULL_TREE; - - /* When signature changes, we need to clear builtin info. */ - if (fndecl_built_in_p (new_decl) - && args_to_skip - && !bitmap_empty_p (args_to_skip)) - set_decl_built_in_function (new_decl, NOT_BUILT_IN, 0); - /* The FE might have information and assumptions about the other - arguments. */ - DECL_LANG_SPECIFIC (new_decl) = NULL; - return new_decl; -} - /* Set flags of NEW_NODE and its decl. NEW_NODE is a newly created private clone or its thunk. */
@@ -281,35 +191,21 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node) return cs->caller;
tree new_decl; - if (!node->clone.args_to_skip) - new_decl = copy_node (thunk->decl); - else + if (node->clone.param_adjustments) { /* We do not need to duplicate this_adjusting thunks if we have removed this. */ if (thunk->thunk.this_adjusting - && bitmap_bit_p (node->clone.args_to_skip, 0)) + && !node->clone.param_adjustments->first_param_intact_p ()) return node;
- new_decl = build_function_decl_skip_args (thunk->decl, - node->clone.args_to_skip, - false); - } - - tree *link = &DECL_ARGUMENTS (new_decl); - int i = 0; - for (tree pd = DECL_ARGUMENTS (thunk->decl); pd; pd = DECL_CHAIN (pd), i++) - { - if (!node->clone.args_to_skip - || !bitmap_bit_p (node->clone.args_to_skip, i)) - { - tree nd = copy_node (pd); - DECL_CONTEXT (nd) = new_decl; - *link = nd; - link = &DECL_CHAIN (nd); - } + new_decl = copy_node (thunk->decl); + ipa_param_body_adjustments body_adj (node->clone.param_adjustments, + new_decl); + body_adj.modify_formal_parameters (); } - *link = NULL_TREE; + else + new_decl = copy_node (thunk->decl);
gcc_checking_assert (!DECL_STRUCT_FUNCTION (new_decl)); gcc_checking_assert (!DECL_INITIAL (new_decl)); @@ -331,8 +227,7 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node) new_thunk->thunk = thunk->thunk; new_thunk->unique_name = in_lto_p; new_thunk->former_clone_of = thunk->decl; - new_thunk->clone.args_to_skip = node->clone.args_to_skip; - new_thunk->clone.combined_args_to_skip = node->clone.combined_args_to_skip; + new_thunk->clone.param_adjustments = node->clone.param_adjustments;
cgraph_edge *e = new_thunk->create_edge (node, NULL, new_thunk->count); symtab->call_edge_duplication_hooks (thunk->callees, e); @@ -415,7 +310,11 @@ dump_callgraph_transformation (const cgraph_node *original, If the new node is being inlined into another one, NEW_INLINED_TO should be the outline function the new one is (even indirectly) inlined to. All hooks will see this in node's global.inlined_to, when invoked. Can be NULL if the - node is not inlined. */ + node is not inlined. + + If PARAM_ADJUSTMENTS is non-NULL, the parameter manipulation information + will be overwritten by the new structure. Otherwise the new node will + share parameter manipulation information with the original node. */
cgraph_node * cgraph_node::create_clone (tree new_decl, profile_count prof_count, @@ -423,7 +322,8 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, cgraph_node *new_inlined_to, - bitmap args_to_skip, const char *suffix) + ipa_param_adjustments *param_adjustments, + const char *suffix) { cgraph_node *new_node = symtab->create_empty (); cgraph_edge *e; @@ -467,19 +367,13 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count, new_node->merged_comdat = merged_comdat; new_node->thunk = thunk;
+ if (param_adjustments) + new_node->clone.param_adjustments = param_adjustments; + else + new_node->clone.param_adjustments = clone.param_adjustments; new_node->clone.tree_map = NULL; - new_node->clone.args_to_skip = args_to_skip; + new_node->clone.performed_splits = vec_safe_copy (clone.performed_splits); new_node->split_part = split_part; - if (!args_to_skip) - new_node->clone.combined_args_to_skip = clone.combined_args_to_skip; - else if (clone.combined_args_to_skip) - { - new_node->clone.combined_args_to_skip = BITMAP_GGC_ALLOC (); - bitmap_ior (new_node->clone.combined_args_to_skip, - clone.combined_args_to_skip, args_to_skip); - } - else - new_node->clone.combined_args_to_skip = args_to_skip;
FOR_EACH_VEC_ELT (redirect_callers, i, e) { @@ -621,8 +515,8 @@ clone_function_name (tree decl, const char *suffix) cgraph_node * cgraph_node::create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, - bitmap args_to_skip, const char * suffix, - unsigned num_suffix) + ipa_param_adjustments *param_adjustments, + const char * suffix, unsigned num_suffix) { tree old_decl = decl; cgraph_node *new_node = NULL; @@ -632,13 +526,16 @@ cgraph_node::create_virtual_clone (vec<cgraph_edge *> redirect_callers, char *name;
gcc_checking_assert (local.versionable); - gcc_assert (local.can_change_signature || !args_to_skip); + /* TODO: It would be nice if we could recognize that param_adjustments do not + actually perform any changes, but at the moment let's require it simply + does not exist. */ + gcc_assert (local.can_change_signature || !param_adjustments);
/* Make a new FUNCTION_DECL tree node */ - if (!args_to_skip) + if (!param_adjustments) new_decl = copy_node (old_decl); else - new_decl = build_function_decl_skip_args (old_decl, args_to_skip, false); + new_decl = param_adjustments->adjust_decl (old_decl);
/* These pointers represent function body and will be populated only when clone is materialized. */ @@ -662,7 +559,8 @@ cgraph_node::create_virtual_clone (vec<cgraph_edge *> redirect_callers, SET_DECL_RTL (new_decl, NULL);
new_node = create_clone (new_decl, count, false, - redirect_callers, false, NULL, args_to_skip, suffix); + redirect_callers, false, NULL, param_adjustments, + suffix);
/* Update the properties. Make clone visible only within this translation unit. Make sure @@ -1021,9 +919,10 @@ cgraph_node::create_version_clone (tree new_decl, cgraph_node * cgraph_node::create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, - vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, - bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, - const char *suffix, tree target_attributes) + vec<ipa_replace_map *, va_gc> *tree_map, + ipa_param_adjustments *param_adjustments, + bitmap bbs_to_copy, basic_block new_entry_block, const char *suffix, + tree target_attributes) { tree old_decl = decl; cgraph_node *new_version_node = NULL; @@ -1032,14 +931,16 @@ cgraph_node::create_version_clone_with_body if (!tree_versionable_function_p (old_decl)) return NULL;
- gcc_assert (local.can_change_signature || !args_to_skip); + /* TODO: Restore an assert that we do not change signature if + local.can_change_signature is false. We cannot just check that + param_adjustments is NULL because unfortunately ipa-split removes return + values from such functions. */
/* Make a new FUNCTION_DECL tree node for the new version. */ - if (!args_to_skip && !skip_return) - new_decl = copy_node (old_decl); + if (param_adjustments) + new_decl = param_adjustments->adjust_decl (old_decl); else - new_decl - = build_function_decl_skip_args (old_decl, args_to_skip, skip_return); + new_decl = copy_node (old_decl);
/* Generate a new name for the new version. */ DECL_NAME (new_decl) = clone_function_name_numbered (old_decl, suffix); @@ -1076,8 +977,8 @@ cgraph_node::create_version_clone_with_body new_version_node->ipa_transforms_to_apply = ipa_transforms_to_apply.copy (); /* Copy the OLD_VERSION_NODE function tree to the new version. */ - tree_function_versioning (old_decl, new_decl, tree_map, false, args_to_skip, - skip_return, bbs_to_copy, new_entry_block); + tree_function_versioning (old_decl, new_decl, tree_map, param_adjustments, + false, bbs_to_copy, new_entry_block);
/* Update the new version's properties. Make The new version visible only within this translation unit. Make sure @@ -1117,9 +1018,8 @@ cgraph_materialize_clone (cgraph_node *node) node->former_clone_of = node->clone_of->former_clone_of; /* Copy the OLD_VERSION_NODE function tree to the new version. */ tree_function_versioning (node->clone_of->decl, node->decl, - node->clone.tree_map, true, - node->clone.args_to_skip, false, - NULL, NULL); + node->clone.tree_map, node->clone.param_adjustments, + true, NULL, NULL); if (symtab->dump_file) { dump_function_to_file (node->clone_of->decl, symtab->dump_file, @@ -1194,28 +1094,15 @@ symbol_table::materialize_all_clones (void) { ipa_replace_map *replace_info; replace_info = (*node->clone.tree_map)[i]; - print_generic_expr (symtab->dump_file, - replace_info->old_tree); - fprintf (symtab->dump_file, " -> "); + fprintf (symtab->dump_file, "%i -> ", + (*node->clone.tree_map)[i]->parm_num); print_generic_expr (symtab->dump_file, replace_info->new_tree); - fprintf (symtab->dump_file, "%s%s;", - replace_info->replace_p ? "(replace)":"", - replace_info->ref_p ? "(ref)":""); } fprintf (symtab->dump_file, "\n"); } - if (node->clone.args_to_skip) - { - fprintf (symtab->dump_file, " args_to_skip: "); - dump_bitmap (symtab->dump_file, - node->clone.args_to_skip); - } - if (node->clone.args_to_skip) - { - fprintf (symtab->dump_file, " combined_args_to_skip:"); - dump_bitmap (symtab->dump_file, node->clone.combined_args_to_skip); - } + if (node->clone.param_adjustments) + node->clone.param_adjustments->dump (symtab->dump_file); } cgraph_materialize_clone (node); stabilized = false; diff --git a/gcc/coretypes.h b/gcc/coretypes.h index fc0e09b2000..257de226326 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -141,6 +141,7 @@ struct gomp_teams; struct symtab_node; struct cgraph_node; struct varpool_node; +struct cgraph_edge;
union section; typedef union section section; diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index ef981aa6967..7c9daafe35d 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -156,7 +156,6 @@ DEBUG_COUNTER (df_byte_scan) DEBUG_COUNTER (dse) DEBUG_COUNTER (dse1) DEBUG_COUNTER (dse2) -DEBUG_COUNTER (eipa_sra) DEBUG_COUNTER (gcse2_delete) DEBUG_COUNTER (global_alloc_at_func) DEBUG_COUNTER (global_alloc_at_reg) @@ -168,6 +167,8 @@ DEBUG_COUNTER (if_after_combine) DEBUG_COUNTER (if_after_reload) DEBUG_COUNTER (if_conversion) DEBUG_COUNTER (if_conversion_tree) +DEBUG_COUNTER (ipa_sra_params) +DEBUG_COUNTER (ipa_sra_retvalues) DEBUG_COUNTER (ira_move) DEBUG_COUNTER (local_alloc_for_sched) DEBUG_COUNTER (merged_ipa_icf) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6d67c121be0..83016a5a8ee 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -11870,6 +11870,11 @@ parameters only when their cumulative size is less or equal to @option{ipa-sra-ptr-growth-factor} times the size of the original pointer parameter.
+@item ipa-sra-max-replacements +Maximum pieces of an aggregate that IPA-SRA tracks. As a +consequence, it is also the maximum number of replacements of a formal +parameter. + @item sra-max-scalarization-size-Ospeed @itemx sra-max-scalarization-size-Osize The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 33d52fe5537..b4fb74e097e 100644 </cut>