From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 1A86B385E440 for ; Wed, 26 Jan 2022 07:29:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1A86B385E440 Received: by mail-ed1-x535.google.com with SMTP id m11so67513399edi.13 for ; Tue, 25 Jan 2022 23:29:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GtKCRYZXIy8RdsyAlZpXU8ki8MoChegcQGS+MHhKC4w=; b=lAXtMxRIKqFwz7qsLukUsV6FrNlbfjfoHEuSgqirDkXGo2C/VlTV2mSZJAd3uFLJrv KuNjMa983LBtFvViOxz5yyCF47A8DBLY686IPgzhuRIyxK7hYutKYZj8w4HXfVPh7hqK v5SMKQ24vZekzHkD1PsHLMxYZThe+JRLYveDWHIavRKkhhfWFvMVE8wg+/ae70OBfaoV Ebm7wmVsoRKtCJa/+C259hHUbgDmqOaAeiCl7tm3Y4XtYkT6UH6RyBAlD/gBy8xoyhfM 4aGFYFjHJxvgv4sz4MB5vPfbsm82q0osa8VOnBFxuc8/2hvtEVzYEaN7Si1cAM5++scu L2Yg== X-Gm-Message-State: AOAM530OIyhrGeKN8tvkXV5OLsDWUR4nEPP/ho0ihpE13oBI2Nim3d6e 6f4b/u+nXJEgzjGEYxiCNSeQP4tq3vbVBvqDWp0= X-Google-Smtp-Source: ABdhPJxy5+mvKry45ZQoTGzAZac2UsvPjGiA8Bg6fWiPSanSswvJRyGscQ1YzwAk9bGyB/gUXy6NnTmQnr0YsFu6o48= X-Received: by 2002:aa7:d0c5:: with SMTP id u5mr4364465edo.124.1643182144553; Tue, 25 Jan 2022 23:29:04 -0800 (PST) MIME-Version: 1.0 References: <1376c582-ac31-8877-a3ca-8a30f255c798@linux.ibm.com> In-Reply-To: <1376c582-ac31-8877-a3ca-8a30f255c798@linux.ibm.com> From: Richard Biener Date: Wed, 26 Jan 2022 08:28:53 +0100 Message-ID: Subject: Re: PING^2 [PATCH] rs6000: Fix an assertion in update_target_cost_per_stmt [PR103702] To: "Kewen.Lin" Cc: GCC Patches , Bill Schmidt , david Edelsohn , Segher Boessenkool Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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: Wed, 26 Jan 2022 07:29:07 -0000 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, Richard. > BR, > Kewen > > > on 2021/12/23 =E4=B8=8A=E5=8D=8810: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 =3D STMT_VINFO_VECTYPE (stmt_info); > >> unsigned int nunits =3D 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 =3D=3D 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/testsui= te/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 conserva= tively. */ > >> +/* { dg-require-effective-target powerpc_altivec_ok } */ > >> +/* { dg-options "-mdejagnu-cpu=3Dpower6 -O2 -ftree-loop-vectorize -fn= o-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 =3D f; > >> + e =3D 0; > >> + for (; e < a; ++e) > >> + b[e] =3D d[e * c]; > >> + } > >> +} > >> + > >> -- > >> 2.27.0 > >> >