]> git.ipfire.org Git - thirdparty/gcc.git/commit
Avoid scaling flat loop profiles of vectorized loops
authorJan Hubicka <jh@suse.cz>
Fri, 21 Jul 2023 17:38:26 +0000 (19:38 +0200)
committerJan Hubicka <jh@suse.cz>
Fri, 21 Jul 2023 17:38:26 +0000 (19:38 +0200)
commita31ef26b056d0c4f0a9f08b6eb81456ea257298e
treec7c534f40ba5d427d38e01b3ced66b3458a2abc9
parent54da3d249ea60c14e71b13935e5e846c8b490b7d
Avoid scaling flat loop profiles of vectorized loops

As discussed, when vectorizing loop with static profile, it is not always good idea
to divide the header frequency by vectorization factor because the profile may
not realistically represent the expected number of iterations.  Since in such cases
we default to relatively low iteration counts (based on average for spec2k17), this
will make vectorized loop body look cold.

This patch makes vectorizer to look for flat profiles and only possibly reduce the
profile by known upper bound on iteration counts.

gcc/ChangeLog:

PR target/110727
* tree-vect-loop.cc (scale_profile_for_vect_loop): Avoid scaling flat
profiles by vectorization factor.
(vect_transform_loop): Check for flat profiles.
gcc/tree-vect-loop.cc