From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 7ACAB3858C74 for ; Thu, 27 Jan 2022 11:19:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7ACAB3858C74 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20RBAouA027978; Thu, 27 Jan 2022 11:19:52 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dur3x2t5f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jan 2022 11:19:51 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20RBC3eF001633; Thu, 27 Jan 2022 11:19:51 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 3dur3x2t4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jan 2022 11:19:51 +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 20RBCXXP019645; Thu, 27 Jan 2022 11:19:49 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 3dr96jy3g3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jan 2022 11:19:49 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20RBJk4937093852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jan 2022 11:19:47 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA91942042; Thu, 27 Jan 2022 11:19:46 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9EB942059; Thu, 27 Jan 2022 11:19:44 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.32.129]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 27 Jan 2022 11:19:44 +0000 (GMT) Subject: Re: PING^2 [PATCH] rs6000: Fix an assertion in update_target_cost_per_stmt [PR103702] To: Richard Biener Cc: GCC Patches , Bill Schmidt , david Edelsohn , Segher Boessenkool References: <1376c582-ac31-8877-a3ca-8a30f255c798@linux.ibm.com> From: "Kewen.Lin" Message-ID: Date: Thu, 27 Jan 2022 19:19:41 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: DfpY0mtIeNQpCTU1opohlAKGC26x3khQ X-Proofpoint-GUID: 7ModbTvvkjeNzZUFpo5X8haikypU6z_c Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-27_03,2022-01-27_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2201270063 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2022 11:19:53 -0000 on 2022/1/26 下午3:28, Richard Biener wrote: > On Wed, Jan 26, 2022 at 3:15 AM Kewen.Lin via Gcc-patches > wrote: >> >> Gentle ping: >> >> https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587309.html > > OK. > Thanks Richi! Rebased, re-tested and committed as r12-6891. BR, Kewen > Thanks, > Richard. > >> BR, >> Kewen >> >>> on 2021/12/23 上午10:06, Kewen.Lin via Gcc-patches wrote: >>>> Hi, >>>> >>>> This patch is to fix one wrong assertion which is too aggressive. >>>> Vectorizer can do vec_construct costing for the vector type which >>>> only has one unit. For the failed case, the passed-in vector type >>>> is "vector(1) int", though it doesn't end up with any construction >>>> eventually. We have to handle this kind of input in function >>>> rs6000_cost_data::update_target_cost_per_stmt. >>>> >>>> Bootstrapped and regtested on powerpc64le-linux-gnu P9 and >>>> powerpc64-linux-gnu P8. >>>> >>>> Is it ok for trunk? >>>> >>>> BR, >>>> Kewen >>>> ----- >>>> gcc/ChangeLog: >>>> >>>> PR target/103702 >>>> * config/rs6000/rs6000.c >>>> (rs6000_cost_data::update_target_cost_per_stmt): Fix one wrong >>>> assertion with early return. >>>> >>>> gcc/testsuite/ChangeLog: >>>> >>>> PR target/103702 >>>> * gcc.target/powerpc/pr103702.c: New test. >>>> --- >>>> gcc/config/rs6000/rs6000.c | 7 ++++-- >>>> gcc/testsuite/gcc.target/powerpc/pr103702.c | 24 +++++++++++++++++++++ >>>> 2 files changed, 29 insertions(+), 2 deletions(-) >>>> create mode 100644 gcc/testsuite/gcc.target/powerpc/pr103702.c >>>> >>>> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c >>>> index 0b09713b2f5..37f07fe5358 100644 >>>> --- a/gcc/config/rs6000/rs6000.c >>>> +++ b/gcc/config/rs6000/rs6000.c >>>> @@ -5461,8 +5461,11 @@ rs6000_cost_data::update_target_cost_per_stmt (vect_cost_for_stmt kind, >>>> { >>>> tree vectype = STMT_VINFO_VECTYPE (stmt_info); >>>> unsigned int nunits = vect_nunits_for_cost (vectype); >>>> - /* We don't expect strided/elementwise loads for just 1 nunit. */ >>>> - gcc_assert (nunits > 1); >>>> + /* As PR103702 shows, it's possible that vectorizer wants to do >>>> + costings for only one unit here, it's no need to do any >>>> + penalization for it, so simply early return here. */ >>>> + if (nunits == 1) >>>> + return; >>>> /* i386 port adopts nunits * stmt_cost as the penalized cost >>>> for this kind of penalization, we used to follow it but >>>> found it could result in an unreliable body cost especially >>>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr103702.c b/gcc/testsuite/gcc.target/powerpc/pr103702.c >>>> new file mode 100644 >>>> index 00000000000..585946fd64b >>>> --- /dev/null >>>> +++ b/gcc/testsuite/gcc.target/powerpc/pr103702.c >>>> @@ -0,0 +1,24 @@ >>>> +/* We don't have one powerpc.*_ok for Power6, use altivec_ok conservatively. */ >>>> +/* { dg-require-effective-target powerpc_altivec_ok } */ >>>> +/* { dg-options "-mdejagnu-cpu=power6 -O2 -ftree-loop-vectorize -fno-tree-scev-cprop" } */ >>>> + >>>> +/* Verify there is no ICE. */ >>>> + >>>> +unsigned short a, e; >>>> +int *b, *d; >>>> +int c; >>>> +extern int fn2 (); >>>> +void >>>> +fn1 () >>>> +{ >>>> + void *f; >>>> + for (;;) >>>> + { >>>> + fn2 (); >>>> + b = f; >>>> + e = 0; >>>> + for (; e < a; ++e) >>>> + b[e] = d[e * c]; >>>> + } >>>> +} >>>> + >>>> -- >>>> 2.27.0 >>>> >>