From: Stefan Schulze Frielinghaus Date: Wed, 22 Jul 2020 07:27:49 +0000 (+0200) Subject: vect: Fix infinite loop while determining peeling amount X-Git-Tag: upstream/12.2.0~14558 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1660ceb0d3b0076555058087307f88b80619a6f;p=platform%2Fupstream%2Fgcc.git vect: Fix infinite loop while determining peeling amount This is a follow up to commit 5c9669a0e6c respectively discussion https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549132.html In case a type has a lower alignment than its size, ensure that we advance. For example, on s390x we have for a long double an alignment constraint of 8 bytes whereas the size is 16 bytes. Increasing the loop variable only by TARGET_ALIGN / DR_SIZE which equals zero in case of a long double results in an infinite loop. This is fixed by ensuring that we advance at least by one. gcc/ChangeLog: * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Ensure that loop variable npeel_tmp advances in each iteration. --- diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index e35a215..a78ae61 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1779,7 +1779,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) { vect_peeling_hash_insert (&peeling_htab, loop_vinfo, dr_info, npeel_tmp); - npeel_tmp += target_align / dr_size; + npeel_tmp += MAX (1, target_align / dr_size); } one_misalignment_known = true;