aboutsummaryrefslogtreecommitdiff
path: root/libcpp/macro.cc
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2023-06-20 18:15:22 +0200
committerMartin Jambor <mjambor@suse.cz>2023-06-20 18:16:14 +0200
commit7f986e2ed9323099bf142756d282002baa869289 (patch)
tree3a4b9cb07aabf4390653637cfc70c16180669c62 /libcpp/macro.cc
parent86df278de15b4a51d6cdb0e8922c2d05adfb64a4 (diff)
downloadgcc-7f986e2ed9323099bf142756d282002baa869289.zip
gcc-7f986e2ed9323099bf142756d282002baa869289.tar.gz
gcc-7f986e2ed9323099bf142756d282002baa869289.tar.bz2
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.
Diffstat (limited to 'libcpp/macro.cc')
0 files changed, 0 insertions, 0 deletions