Message ID | 20230418020311.36368-1-juzhe.zhong@rivai.ai |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2527988vqo; Mon, 17 Apr 2023 19:05:02 -0700 (PDT) X-Google-Smtp-Source: AKy350YvU1LgsI1kM0K8grgLW0QZHmDunHjaC2NExntnFa9zWLBUx6ySaeFz46jlqB/LiQHG7DHw X-Received: by 2002:a17:907:8a1e:b0:94f:694e:b953 with SMTP id sc30-20020a1709078a1e00b0094f694eb953mr6623452ejc.59.1681783502715; Mon, 17 Apr 2023 19:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681783502; cv=none; d=google.com; s=arc-20160816; b=ndsxSGkBfUWEL7IK7++X8zxeF5jvwpv7pgHgFRNW+VeUXDcvtqqUPBum61w4y/HvHp Fezs6uROIBLAv16kCWNoghlqhUmRzNS+D2Jbm22u7lo29pOs/nJc/5ymEp3BGQ5ujsCX vYKgnC2kKIkj9fVykTEtZriM5RGsrw5f1OL/rTdewZpODKTDu2gPTn5DCyuFKGoY70gJ dwCn1FZTVK0zERtFSdoPFD8JOioxRJrilsE9qbBONTysudqsvts7Q0AUlGQoD31Zhvt2 99Rh7pQeA3x23ppcrvdRM10ZEgTYQmo9rrIe0IYWFfH2RmvuM4z2fm2BwM1rBAATaJk9 NGog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=ZQFBGY8m9WZ3040fx1/SKM0DFfkISrBqnHLa17gZdJk=; b=V4Xyuu6H+3WMB9LYz9Ut1WAskJS4OFZwfCGBVEgg8eBWNAtCXkPNUlz/x0StkPhRRw +cXlHT8jxHsayJhx819oT/CUuR155LTw00teub1q/JmLX030JLMxVoVAhRzgByeFwIcJ Lafo6x7dUY1ZPx+ra9m4mdhxMHtaJCMi/9QNEYaY1QHyOfc/mO3TsNXuXhYiTFYO95dc Bkd3xwQmNvLa8mptBPyfHXsDsKY0LgrexI8rLPVbVvy16fezX0W9i8//Il7hy0GhkVDc eqSxDu7tvVBrh2WdKvFwR4BK6D1zSYVQfh+noctcvjIYRvdh8J7ERrYRn231Njz6OevB DMwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id fl13-20020a1709072a8d00b0094ef020584asi8123890ejc.32.2023.04.17.19.05.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 19:05:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D16023858C39 for <ouuuleilei@gmail.com>; Tue, 18 Apr 2023 02:04:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) by sourceware.org (Postfix) with ESMTPS id 67A5C3858D28 for <gcc-patches@gcc.gnu.org>; Tue, 18 Apr 2023 02:04:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 67A5C3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp88t1681783394tr20doj9 Received: from rios-cad5.localdomain ( [58.60.1.11]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 18 Apr 2023 10:03:12 +0800 (CST) X-QQ-SSF: 01400000000000F0P000000A0000000 X-QQ-FEAT: szTy5SWxjRlf53mTlHXprlE1XlsJ6rj+9189Zpz3LlLlkHAOj3tRCjUxlBLLq ykYRvjjCrEFj0Qu4ym9nbdfLvjHDW6yGMTfifjhwfeBlGvw3nQrucsXWxeAoJsZZYBuwkcY Rk2FCAynNtHkF+hz+KYeCVbR4TCpla/TUc2cM1TS852l6hTYBw6PKrw2kQ1XOnQLRokGwly UMOHKgQM3CU9RNv/Nzbm56lQhhic3Zkvjaxd3rP5qteUNDlx952xtcE/ljH/H6BajhQvlEm DGHt4aPHVIMKLTkfHURMrHMX5wUNGIFBBvHFKs0yzywAkwB5P+C6vyLC8SDmqugfVRmC71b lXdcOb81gAscilUfsQRQ0U/b3ieZnSc67Vc50qCK/1Oe8Fol7k= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 10440558313435390688 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, Ju-Zhe Zhong <juzhe.zhong@rivai.ai> Subject: [PATCH] RISC-V: Fix PR109535 Date: Tue, 18 Apr 2023 10:03:11 +0800 Message-Id: <20230418020311.36368-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvr:qybglogicsvr7 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763477818230615749?= X-GMAIL-MSGID: =?utf-8?q?1763477818230615749?= |
Series |
RISC-V: Fix PR109535
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
juzhe.zhong@rivai.ai
April 18, 2023, 2:03 a.m. UTC
From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (count_regno_occurrences): New function.
(pass_vsetvl::cleanup_insns): Fix bug.
---
gcc/config/riscv/riscv-vsetvl.cc | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
Comments
On 4/17/23 20:03, juzhe.zhong@rivai.ai wrote: > From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai> > > gcc/ChangeLog: > > * config/riscv/riscv-vsetvl.cc (count_regno_occurrences): New function. > (pass_vsetvl::cleanup_insns): Fix bug. ChangeLog should reference the bug number, like this: PR target/109535 > > --- > gcc/config/riscv/riscv-vsetvl.cc | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc > index 1b66e3b9eeb..43e2cf08377 100644 > --- a/gcc/config/riscv/riscv-vsetvl.cc > +++ b/gcc/config/riscv/riscv-vsetvl.cc > @@ -1592,6 +1592,19 @@ backward_propagate_worthwhile_p (const basic_block cfg_bb, > return true; > } > > +/* Count the number of REGNO in RINSN. */ > +int > +count_regno_occurrences (rtx_insn *rinsn, unsigned int regno) Seems like this ought to be static. Though it's not clear why count_occurrences didn't do what you needed. Can you explain why count_occurrences was insufficient for your needs? Jeff
Hi Jeff, Ju-Zhe: Let you know that I am running creduce with this testcase for reduce the size of testcsae, it's really too huge... On Wed, Apr 19, 2023 at 3:00 AM Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > > > On 4/17/23 20:03, juzhe.zhong@rivai.ai wrote: > > From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai> > > > > gcc/ChangeLog: > > > > * config/riscv/riscv-vsetvl.cc (count_regno_occurrences): New function. > > (pass_vsetvl::cleanup_insns): Fix bug. > ChangeLog should reference the bug number, like this: > > PR target/109535 > > > > > > --- > > gcc/config/riscv/riscv-vsetvl.cc | 15 ++++++++++++++- > > 1 file changed, 14 insertions(+), 1 deletion(-) > > > > diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc > > index 1b66e3b9eeb..43e2cf08377 100644 > > --- a/gcc/config/riscv/riscv-vsetvl.cc > > +++ b/gcc/config/riscv/riscv-vsetvl.cc > > @@ -1592,6 +1592,19 @@ backward_propagate_worthwhile_p (const basic_block cfg_bb, > > return true; > > } > > > > +/* Count the number of REGNO in RINSN. */ > > +int > > +count_regno_occurrences (rtx_insn *rinsn, unsigned int regno) > Seems like this ought to be static. Though it's not clear why > count_occurrences didn't do what you needed. Can you explain why > count_occurrences was insufficient for your needs? > > > > > Jeff
>> ChangeLog should reference the bug number, like this: >> PR target/109535 >> Seems like this ought to be static. Though it's not clear why >> count_occurrences didn't do what you needed. Can you explain why >> count_occurrences was insufficient for your needs? Address comment, I will resend a patch with referencing bug PR number and adding "static". The reason why count_occurrences can not work since we want to count the regno occurrences instead of rtx occurrences. The bug issue reported by google/highway project: (set(..........) (reg:QI s0) (reg:DI s0)) The "avl" operand rtx = (reg:DI s0) count_occurrences return 1 however the actual regno occurrences should be 2. Thanks juzhe.zhong@rivai.ai From: Jeff Law Date: 2023-04-19 03:00 To: juzhe.zhong; gcc-patches CC: kito.cheng; palmer Subject: Re: [PATCH] RISC-V: Fix PR109535 On 4/17/23 20:03, juzhe.zhong@rivai.ai wrote: > From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai> > > gcc/ChangeLog: > > * config/riscv/riscv-vsetvl.cc (count_regno_occurrences): New function. > (pass_vsetvl::cleanup_insns): Fix bug. ChangeLog should reference the bug number, like this: PR target/109535 > > --- > gcc/config/riscv/riscv-vsetvl.cc | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc > index 1b66e3b9eeb..43e2cf08377 100644 > --- a/gcc/config/riscv/riscv-vsetvl.cc > +++ b/gcc/config/riscv/riscv-vsetvl.cc > @@ -1592,6 +1592,19 @@ backward_propagate_worthwhile_p (const basic_block cfg_bb, > return true; > } > > +/* Count the number of REGNO in RINSN. */ > +int > +count_regno_occurrences (rtx_insn *rinsn, unsigned int regno) Seems like this ought to be static. Though it's not clear why count_occurrences didn't do what you needed. Can you explain why count_occurrences was insufficient for your needs? Jeff
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 1b66e3b9eeb..43e2cf08377 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1592,6 +1592,19 @@ backward_propagate_worthwhile_p (const basic_block cfg_bb, return true; } +/* Count the number of REGNO in RINSN. */ +int +count_regno_occurrences (rtx_insn *rinsn, unsigned int regno) +{ + int count = 0; + extract_insn (rinsn); + for (int i = 0; i < recog_data.n_operands; i++) + if (REG_P (recog_data.operand[i]) + && REGNO (recog_data.operand[i]) == regno) + count++; + return count; +} + avl_info::avl_info (const avl_info &other) { m_value = other.get_value (); @@ -3924,7 +3937,7 @@ pass_vsetvl::cleanup_insns (void) const if (!has_vl_op (rinsn) || !REG_P (get_vl (rinsn))) continue; rtx avl = get_vl (rinsn); - if (count_occurrences (PATTERN (rinsn), avl, 0) == 1) + if (count_regno_occurrences (rinsn, REGNO (avl)) == 1) { /* Get the list of uses for the new instruction. */ auto attempt = crtl->ssa->new_change_attempt ();