]> git.ipfire.org Git - thirdparty/gcc.git/commit
ipa-reorder-for-locality - Introduce C++ template heuristics
authorPrachi Godbole <pgodbole@nvidia.com>
Tue, 20 Jan 2026 04:49:38 +0000 (20:49 -0800)
committerKyrylo Tkachov <ktkachov@nvidia.com>
Tue, 20 Jan 2026 12:54:30 +0000 (13:54 +0100)
commit348c623d7dc43caafa9ae7878133df4e12edf54b
tree7c6caaf5696354444e342e82fed0fc18a41c4e05
parent8b8758419506f9a471d50275ba27bb965250569a
ipa-reorder-for-locality - Introduce C++ template heuristics

This patch introduces a new heuristics for reordering functions, to be used
in the absense of profile information.  This approach uses C++ template
instantiation types to group functions together.  Entry functions are sorted
in the beginning, and callees are sorted as part of partition_callchain ().

Bootstrapped and tested on aarch64-none-linux-gnu.

Signed-off-by: Prachi Godbole <pgodbole@nvidia.com>
config/ChangeLog:

* bootstrap-lto-locality-cpp-template.mk: New file.

gcc/ChangeLog:

* flag-types.h (enum lto_locality_heuristics): New enum.
* ipa-locality-cloning.cc (struct templ_info): New struct.
(struct locality_info): Add templ_info field.
(templ_hash_map): New hash_map.
(callee_templ_cmp): Ditto.
(static_profile_templ_cmp): Ditto.
(sort_templ_hashes_cmp): Ditto.
(order_templ_hashes): Ditto.
(locality_dc_template_p): Ditto.
(populate_templ_info): Ditto.
(create_locality_info): Call populate_templ_info.
(partition_callchain): Call callee_templ_cmp.
(locality_determine_static_order): Populate and sort templ_hash_map.
(locality_partition_and_clone): Handle lto_locality_heuristics.
(lc_execute): Initialize templ_hash_map.
* params.opt: New param.
config/bootstrap-lto-locality-cpp-template.mk [new file with mode: 0644]
gcc/flag-types.h
gcc/ipa-locality-cloning.cc
gcc/params.opt