Message ID | 96541e9b-46ff-e4a1-e60c-1d035f219560@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E6CA3857830 for <patchwork@sourceware.org>; Tue, 26 Oct 2021 03:40:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E6CA3857830 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635219642; bh=fi3bSgOA1VVAgTbdNVracil+cSB7kXLqi8r6q1DG6/I=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=C0uwZPk/Ud59/329MuE/AMYFFP1oa43tKSsbPP63pvy6xzf1Xz5lUhXB8SqvYXIxB gbh8G3rKNuUPDiF44qbXtAzqmBT4Xp0FqdJroNHvCnXKLDb9Jrj+M44zeUj+KKJqG7 2k9XdPFXhfD4dGdjRyTyqofLYhwnbB73O1wZJ0Vk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 6EB013857C50 for <gcc-patches@gcc.gnu.org>; Tue, 26 Oct 2021 03:40:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6EB013857C50 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19Q2SAHl024018 for <gcc-patches@gcc.gnu.org>; Tue, 26 Oct 2021 03:40:10 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bx4yg6fnd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Tue, 26 Oct 2021 03:40:10 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19Q3e9hD004123 for <gcc-patches@gcc.gnu.org>; Tue, 26 Oct 2021 03:40:09 GMT 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 3bx4yg6fms-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Oct 2021 03:40:09 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19Q3bK2S021776; Tue, 26 Oct 2021 03:40:07 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3bx4f11cfj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Oct 2021 03:40:07 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19Q3XwNu50921748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Oct 2021 03:33:58 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C393D4204C; Tue, 26 Oct 2021 03:40:04 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1F8042049; Tue, 26 Oct 2021 03:40:03 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.50.208]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 26 Oct 2021 03:40:03 +0000 (GMT) To: GCC Patches <gcc-patches@gcc.gnu.org> Subject: [PATCH] forwprop: Remove incorrect assertion [PR102897] Message-ID: <96541e9b-46ff-e4a1-e60c-1d035f219560@linux.ibm.com> Date: Tue, 26 Oct 2021 11:40:01 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=gbk Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: eia2e1YezUf-4OoX4HhUSEfwPQ40ir6D X-Proofpoint-GUID: 4GApBSZXTUMMmTttCCY5hoL65Od92Yzj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-25_08,2021-10-25_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 clxscore=1015 suspectscore=0 adultscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110260016 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: "Kewen.Lin via Gcc-patches" <gcc-patches@gcc.gnu.org> Reply-To: "Kewen.Lin" <linkw@linux.ibm.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
forwprop: Remove incorrect assertion [PR102897]
|
|
Commit Message
Kewen.Lin
Oct. 26, 2021, 3:40 a.m. UTC
Hi, As PR102897 shows, there is one incorrect assertion in function simplify_permutation, which is based on the wrong assumption that all cases with op2_type == tgt_type are handled previously, the proposed fix is to remove this wrong assertion. Bootstrapped and regtested on x86_64-redhat-linux, aarch64-linux-gnu and powerpc64{,le}-linux-gnu. BR, Kewen ----- gcc/ChangeLog: PR tree-optimization/102897 * tree-ssa-forwprop.c (simplify_permutation): Remove a wrong assertion. gcc/testsuite/ChangeLog: * gcc.dg/pr102897.c: New test. --- gcc/testsuite/gcc.dg/pr102897.c | 16 ++++++++++++++++ gcc/tree-ssa-forwprop.c | 2 -- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr102897.c -- 2.27.0
Comments
On Tue, Oct 26, 2021 at 5:40 AM Kewen.Lin <linkw@linux.ibm.com> wrote: > > Hi, > > As PR102897 shows, there is one incorrect assertion in function > simplify_permutation, which is based on the wrong assumption that > all cases with op2_type == tgt_type are handled previously, the > proposed fix is to remove this wrong assertion. > > Bootstrapped and regtested on x86_64-redhat-linux, > aarch64-linux-gnu and powerpc64{,le}-linux-gnu. I think you need to enable optimization in the new testcase, gcc.dg/ only runs -O0 by default which wouldn't trigger forwprop? Please verify the testcase ICEs before the fix. Otherwise OK. Thanks, Richard, > BR, > Kewen > ----- > gcc/ChangeLog: > > PR tree-optimization/102897 > * tree-ssa-forwprop.c (simplify_permutation): Remove a wrong assertion. > > gcc/testsuite/ChangeLog: > > * gcc.dg/pr102897.c: New test. > --- > gcc/testsuite/gcc.dg/pr102897.c | 16 ++++++++++++++++ > gcc/tree-ssa-forwprop.c | 2 -- > 2 files changed, 16 insertions(+), 2 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/pr102897.c > > diff --git a/gcc/testsuite/gcc.dg/pr102897.c b/gcc/testsuite/gcc.dg/pr102897.c > new file mode 100644 > index 00000000000..d96b0e48ccc > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr102897.c > @@ -0,0 +1,16 @@ > +/* { dg-do compile } */ > +/* Specify C99 to avoid the warning/error on compound literals. */ > +/* { dg-options "-std=c99" } */ > + > +/* Verify that there is no ICE. */ > + > +typedef __attribute__((vector_size(8))) signed char int8x8_t; > +typedef __attribute__((vector_size(8))) unsigned char uint8x8_t; > + > +int8x8_t fn1 (int8x8_t val20, char tmp) > +{ > + uint8x8_t __trans_tmp_3; > + __trans_tmp_3 = (uint8x8_t){tmp}; > + int8x8_t __a = (int8x8_t) __trans_tmp_3; > + return __builtin_shuffle (__a, val20, (uint8x8_t){0}); > +} > diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c > index 5b30d4c1a76..a830bab78ba 100644 > --- a/gcc/tree-ssa-forwprop.c > +++ b/gcc/tree-ssa-forwprop.c > @@ -2267,8 +2267,6 @@ simplify_permutation (gimple_stmt_iterator *gsi) > if (!VECTOR_TYPE_P (tgt_type)) > return 0; > tree op2_type = TREE_TYPE (op2); > - /* Should have folded this before. */ > - gcc_assert (op2_type != tgt_type); > > /* Figure out the shrunk factor. */ > poly_uint64 tgt_units = TYPE_VECTOR_SUBPARTS (tgt_type); > -- > 2.27.0
Hi Richi, on 2021/10/26 下午3:50, Richard Biener wrote: > On Tue, Oct 26, 2021 at 5:40 AM Kewen.Lin <linkw@linux.ibm.com> wrote: >> >> Hi, >> >> As PR102897 shows, there is one incorrect assertion in function >> simplify_permutation, which is based on the wrong assumption that >> all cases with op2_type == tgt_type are handled previously, the >> proposed fix is to remove this wrong assertion. >> >> Bootstrapped and regtested on x86_64-redhat-linux, >> aarch64-linux-gnu and powerpc64{,le}-linux-gnu. > > I think you need to enable optimization in the new testcase, gcc.dg/ only > runs -O0 by default which wouldn't trigger forwprop? Please verify the > testcase ICEs before the fix. > Thanks for catching! You are right, the optimization option is required, I just verified it and committed with the additional "-O1" as r12-4705. > Otherwise OK. > Thanks! BR, Kewen > Thanks, > Richard, > >> BR, >> Kewen >> ----- >> gcc/ChangeLog: >> >> PR tree-optimization/102897 >> * tree-ssa-forwprop.c (simplify_permutation): Remove a wrong assertion. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.dg/pr102897.c: New test. >> --- >> gcc/testsuite/gcc.dg/pr102897.c | 16 ++++++++++++++++ >> gcc/tree-ssa-forwprop.c | 2 -- >> 2 files changed, 16 insertions(+), 2 deletions(-) >> create mode 100644 gcc/testsuite/gcc.dg/pr102897.c >> >> diff --git a/gcc/testsuite/gcc.dg/pr102897.c b/gcc/testsuite/gcc.dg/pr102897.c >> new file mode 100644 >> index 00000000000..d96b0e48ccc >> --- /dev/null >> +++ b/gcc/testsuite/gcc.dg/pr102897.c >> @@ -0,0 +1,16 @@ >> +/* { dg-do compile } */ >> +/* Specify C99 to avoid the warning/error on compound literals. */ >> +/* { dg-options "-std=c99" } */ >> + >> +/* Verify that there is no ICE. */ >> + >> +typedef __attribute__((vector_size(8))) signed char int8x8_t; >> +typedef __attribute__((vector_size(8))) unsigned char uint8x8_t; >> + >> +int8x8_t fn1 (int8x8_t val20, char tmp) >> +{ >> + uint8x8_t __trans_tmp_3; >> + __trans_tmp_3 = (uint8x8_t){tmp}; >> + int8x8_t __a = (int8x8_t) __trans_tmp_3; >> + return __builtin_shuffle (__a, val20, (uint8x8_t){0}); >> +} >> diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c >> index 5b30d4c1a76..a830bab78ba 100644 >> --- a/gcc/tree-ssa-forwprop.c >> +++ b/gcc/tree-ssa-forwprop.c >> @@ -2267,8 +2267,6 @@ simplify_permutation (gimple_stmt_iterator *gsi) >> if (!VECTOR_TYPE_P (tgt_type)) >> return 0; >> tree op2_type = TREE_TYPE (op2); >> - /* Should have folded this before. */ >> - gcc_assert (op2_type != tgt_type); >> >> /* Figure out the shrunk factor. */ >> poly_uint64 tgt_units = TYPE_VECTOR_SUBPARTS (tgt_type); >> -- >> 2.27.0
diff --git a/gcc/testsuite/gcc.dg/pr102897.c b/gcc/testsuite/gcc.dg/pr102897.c new file mode 100644 index 00000000000..d96b0e48ccc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr102897.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* Specify C99 to avoid the warning/error on compound literals. */ +/* { dg-options "-std=c99" } */ + +/* Verify that there is no ICE. */ + +typedef __attribute__((vector_size(8))) signed char int8x8_t; +typedef __attribute__((vector_size(8))) unsigned char uint8x8_t; + +int8x8_t fn1 (int8x8_t val20, char tmp) +{ + uint8x8_t __trans_tmp_3; + __trans_tmp_3 = (uint8x8_t){tmp}; + int8x8_t __a = (int8x8_t) __trans_tmp_3; + return __builtin_shuffle (__a, val20, (uint8x8_t){0}); +} diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 5b30d4c1a76..a830bab78ba 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -2267,8 +2267,6 @@ simplify_permutation (gimple_stmt_iterator *gsi) if (!VECTOR_TYPE_P (tgt_type)) return 0; tree op2_type = TREE_TYPE (op2); - /* Should have folded this before. */ - gcc_assert (op2_type != tgt_type); /* Figure out the shrunk factor. */ poly_uint64 tgt_units = TYPE_VECTOR_SUBPARTS (tgt_type);