https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110727
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jan Hubicka <hubi...@gcc.gnu.org>: https://gcc.gnu.org/g:a31ef26b056d0c4f0a9f08b6eb81456ea257298e commit r14-2716-ga31ef26b056d0c4f0a9f08b6eb81456ea257298e Author: Jan Hubicka <j...@suse.cz> Date: Fri Jul 21 19:38:26 2023 +0200 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.