]> gcc.gnu.org Git - gcc.git/commit
ipa-cp: Avoid long linear searches through DECL_ARGUMENTS
authorMartin Jambor <mjambor@suse.cz>
Tue, 20 Jun 2023 16:15:22 +0000 (18:15 +0200)
committerMartin Jambor <mjambor@suse.cz>
Tue, 20 Jun 2023 16:16:14 +0000 (18:16 +0200)
commit7f986e2ed9323099bf142756d282002baa869289
tree3a4b9cb07aabf4390653637cfc70c16180669c62
parent86df278de15b4a51d6cdb0e8922c2d05adfb64a4
ipa-cp: Avoid long linear searches through DECL_ARGUMENTS

There have been concerns that linear searches through DECL_ARGUMENTS
that are often necessary to compute the index of a particular
PARM_DECL which is the key to results of IPA-CP can happen often
enough to be a compile time issue, especially if we plug the results
into value numbering, as I intend to do with a follow-up patch.

This patch creates a vector sorted according to PARM_DECLs to do the look-up
for all functions which have some information discovered by IPA-CP and which
have 32 parameters or more.  32 is a hard-wired magical constant here to
capture the trade-off between the memory allocation overhead and length of the
linear search.  I do not think it is worth making it a --param but if people
think it appropriate, I can turn it into one.

gcc/ChangeLog:

2023-05-31  Martin Jambor  <mjambor@suse.cz>

* ipa-prop.h (ipa_uid_to_idx_map_elt): New type.
(struct ipcp_transformation): Rearrange members according to
C++ class coding convention, add m_uid_to_idx,
get_param_index and maybe_create_parm_idx_map.
* ipa-cp.cc (ipcp_transformation::get_param_index): New function.
(compare_uids): Likewise.
(ipcp_transformation::maype_create_parm_idx_map): Likewise.
* ipa-prop.cc (ipcp_get_parm_bits): Use get_param_index.
(ipcp_update_bits): Accept TS as a parameter, assume it is not NULL.
(ipcp_update_vr): Likewise.
(ipcp_transform_function): Call, maybe_create_parm_idx_map of TS, bail
out quickly if empty, pass it to ipcp_update_bits and ipcp_update_vr.
gcc/ipa-cp.cc
gcc/ipa-prop.cc
gcc/ipa-prop.h
This page took 0.062661 seconds and 6 git commands to generate.