From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id D7E603857C6A for ; Wed, 22 Jul 2020 15:16:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D7E603857C6A Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06MF65dX051368 for ; Wed, 22 Jul 2020 11:16:55 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 32e1xxm8p0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 22 Jul 2020 11:16:53 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06MFCr73006036 for ; Wed, 22 Jul 2020 15:16:50 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06ams.nl.ibm.com with ESMTP id 32brbh534j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 22 Jul 2020 15:16:50 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06MFFOsg53150192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 22 Jul 2020 15:15:24 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E0BF5204F for ; Wed, 22 Jul 2020 15:16:48 +0000 (GMT) Received: from m35lp38.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 4E3355204E for ; Wed, 22 Jul 2020 15:16:48 +0000 (GMT) From: Stefan Schulze Frielinghaus To: gcc-patches@gcc.gnu.org Subject: [PATCH] [RFC] vect: Fix infinite loop while determining peeling amount Date: Wed, 22 Jul 2020 17:14:51 +0200 Message-Id: <20200722151450.1540130-1-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-22_09:2020-07-22, 2020-07-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=908 clxscore=1015 phishscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220105 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jul 2020 15:16:58 -0000 This is a follow up to commit 5c9669a0e6c respectively discussion https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549132.html In case that an alignment constraint is less than the size of a corresponding scalar type, ensure that we advance at least by one iteration. For example, on s390x we have for a long double an alignment constraint of 8 bytes whereas the size is 16 bytes. Therefore, TARGET_ALIGN / DR_SIZE equals zero resulting in an infinite loop which can be reproduced by the following MWE: extern long double *a; extern double *b; void fun(void) { for (int i = 0; i < 42; i++) a[i] = b[i]; } Increasing the number of peelings in each iteration at least by one fixes the issue for me. Any comments? Bootstrapped and regtested on s390x. gcc/ChangeLog: * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Ensure that loop variable npeel_tmp advances in each iteration. --- gcc/tree-vect-data-refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index e35a215e042..a78ae61d1b0 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; -- 2.25.3