public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
@ 2023-07-07  8:22 Li Xu
  2023-07-07  8:23 ` juzhe.zhong
  0 siblings, 1 reply; 5+ messages in thread
From: Li Xu @ 2023-07-07  8:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, palmer, juzhe.zhong, zhengyu, Li Xu

This patch fixes this issue happens on GCC-13.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110560

This patch should be backported to GCC-13.
GCC-14 has rewritten this function, so there is no issue.

PR target/110560

gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): Fix bug.
---
 gcc/config/riscv/riscv-vsetvl.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 35403b5679c..3355ca4e3fb 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1078,6 +1078,10 @@ local_eliminate_vsetvl_insn (const vector_insn_info &dem)
 
 	  if (has_vtype_op (i->rtl ()))
 	    {
+	      if (!PREV_INSN (i->rtl ()))
+		return;
+	      if (!NONJUMP_INSN_P (PREV_INSN (i->rtl ())))
+		return;
 	      if (!vsetvl_discard_result_insn_p (PREV_INSN (i->rtl ())))
 		return;
 	      rtx avl = get_avl (i->rtl ());
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
  2023-07-07  8:22 [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560] Li Xu
@ 2023-07-07  8:23 ` juzhe.zhong
  2023-07-07  9:04   ` Kito Cheng
  0 siblings, 1 reply; 5+ messages in thread
From: juzhe.zhong @ 2023-07-07  8:23 UTC (permalink / raw)
  To: Li Xu, gcc-patches; +Cc: kito.cheng, palmer, zhengyu, Li Xu

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

LGTM. Thanks.



juzhe.zhong@rivai.ai
 
From: Li Xu
Date: 2023-07-07 16:22
To: gcc-patches
CC: kito.cheng; palmer; juzhe.zhong; zhengyu; Li Xu
Subject: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
This patch fixes this issue happens on GCC-13.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110560
 
This patch should be backported to GCC-13.
GCC-14 has rewritten this function, so there is no issue.
 
PR target/110560
 
gcc/ChangeLog:
 
        * config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): Fix bug.
---
gcc/config/riscv/riscv-vsetvl.cc | 4 ++++
1 file changed, 4 insertions(+)
 
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 35403b5679c..3355ca4e3fb 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1078,6 +1078,10 @@ local_eliminate_vsetvl_insn (const vector_insn_info &dem)
  if (has_vtype_op (i->rtl ()))
    {
+       if (!PREV_INSN (i->rtl ()))
+ return;
+       if (!NONJUMP_INSN_P (PREV_INSN (i->rtl ())))
+ return;
      if (!vsetvl_discard_result_insn_p (PREV_INSN (i->rtl ())))
return;
      rtx avl = get_avl (i->rtl ());
-- 
2.17.1
 
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
  2023-07-07  8:23 ` juzhe.zhong
@ 2023-07-07  9:04   ` Kito Cheng
  2023-07-07  9:07     ` juzhe.zhong
  0 siblings, 1 reply; 5+ messages in thread
From: Kito Cheng @ 2023-07-07  9:04 UTC (permalink / raw)
  To: juzhe.zhong; +Cc: Li Xu, gcc-patches, palmer, zhengyu

LGTM

On Fri, Jul 7, 2023 at 4:26 PM juzhe.zhong@rivai.ai
<juzhe.zhong@rivai.ai> wrote:
>
> LGTM. Thanks.
>
>
>
> juzhe.zhong@rivai.ai
>
> From: Li Xu
> Date: 2023-07-07 16:22
> To: gcc-patches
> CC: kito.cheng; palmer; juzhe.zhong; zhengyu; Li Xu
> Subject: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
> This patch fixes this issue happens on GCC-13.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110560
>
> This patch should be backported to GCC-13.
> GCC-14 has rewritten this function, so there is no issue.
>
> PR target/110560
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): Fix bug.
> ---
> gcc/config/riscv/riscv-vsetvl.cc | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
> index 35403b5679c..3355ca4e3fb 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -1078,6 +1078,10 @@ local_eliminate_vsetvl_insn (const vector_insn_info &dem)
>   if (has_vtype_op (i->rtl ()))
>     {
> +       if (!PREV_INSN (i->rtl ()))
> + return;
> +       if (!NONJUMP_INSN_P (PREV_INSN (i->rtl ())))
> + return;
>       if (!vsetvl_discard_result_insn_p (PREV_INSN (i->rtl ())))
> return;
>       rtx avl = get_avl (i->rtl ());
> --
> 2.17.1
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
  2023-07-07  9:04   ` Kito Cheng
@ 2023-07-07  9:07     ` juzhe.zhong
  2023-07-07  9:35       ` Li, Pan2
  0 siblings, 1 reply; 5+ messages in thread
From: juzhe.zhong @ 2023-07-07  9:07 UTC (permalink / raw)
  To: kito.cheng; +Cc: Li Xu, gcc-patches, palmer, zhengyu, pan2.li

[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]

CCing Li Pan to backport this patch.

Thanks.



juzhe.zhong@rivai.ai
 
From: Kito Cheng
Date: 2023-07-07 17:04
To: juzhe.zhong@rivai.ai
CC: Li Xu; gcc-patches; palmer; zhengyu
Subject: Re: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
LGTM
 
On Fri, Jul 7, 2023 at 4:26 PM juzhe.zhong@rivai.ai
<juzhe.zhong@rivai.ai> wrote:
>
> LGTM. Thanks.
>
>
>
> juzhe.zhong@rivai.ai
>
> From: Li Xu
> Date: 2023-07-07 16:22
> To: gcc-patches
> CC: kito.cheng; palmer; juzhe.zhong; zhengyu; Li Xu
> Subject: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
> This patch fixes this issue happens on GCC-13.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110560
>
> This patch should be backported to GCC-13.
> GCC-14 has rewritten this function, so there is no issue.
>
> PR target/110560
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): Fix bug.
> ---
> gcc/config/riscv/riscv-vsetvl.cc | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
> index 35403b5679c..3355ca4e3fb 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -1078,6 +1078,10 @@ local_eliminate_vsetvl_insn (const vector_insn_info &dem)
>   if (has_vtype_op (i->rtl ()))
>     {
> +       if (!PREV_INSN (i->rtl ()))
> + return;
> +       if (!NONJUMP_INSN_P (PREV_INSN (i->rtl ())))
> + return;
>       if (!vsetvl_discard_result_insn_p (PREV_INSN (i->rtl ())))
> return;
>       rtx avl = get_avl (i->rtl ());
> --
> 2.17.1
>
>
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Re: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
  2023-07-07  9:07     ` juzhe.zhong
@ 2023-07-07  9:35       ` Li, Pan2
  0 siblings, 0 replies; 5+ messages in thread
From: Li, Pan2 @ 2023-07-07  9:35 UTC (permalink / raw)
  To: juzhe.zhong, kito.cheng; +Cc: Li Xu, gcc-patches, palmer, zhengyu

[-- Attachment #1: Type: text/plain, Size: 2447 bytes --]

Committed to gcc-13, thanks Juzhe and Kito.

Pan

From: juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
Sent: Friday, July 7, 2023 5:07 PM
To: kito.cheng <kito.cheng@gmail.com>
Cc: Li Xu <xuli1@eswincomputing.com>; gcc-patches <gcc-patches@gcc.gnu.org>; palmer <palmer@dabbelt.com>; zhengyu <zhengyu@eswincomputing.com>; Li, Pan2 <pan2.li@intel.com>
Subject: Re: Re: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]

CCing Li Pan to backport this patch.

Thanks.

________________________________
juzhe.zhong@rivai.ai<mailto:juzhe.zhong@rivai.ai>

From: Kito Cheng<mailto:kito.cheng@gmail.com>
Date: 2023-07-07 17:04
To: juzhe.zhong@rivai.ai<mailto:juzhe.zhong@rivai.ai>
CC: Li Xu<mailto:xuli1@eswincomputing.com>; gcc-patches<mailto:gcc-patches@gcc.gnu.org>; palmer<mailto:palmer@dabbelt.com>; zhengyu<mailto:zhengyu@eswincomputing.com>
Subject: Re: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
LGTM

On Fri, Jul 7, 2023 at 4:26 PM juzhe.zhong@rivai.ai<mailto:juzhe.zhong@rivai.ai>
<juzhe.zhong@rivai.ai<mailto:juzhe.zhong@rivai.ai>> wrote:
>
> LGTM. Thanks.
>
>
>
> juzhe.zhong@rivai.ai<mailto:juzhe.zhong@rivai.ai>
>
> From: Li Xu
> Date: 2023-07-07 16:22
> To: gcc-patches
> CC: kito.cheng; palmer; juzhe.zhong; zhengyu; Li Xu
> Subject: [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560]
> This patch fixes this issue happens on GCC-13.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110560
>
> This patch should be backported to GCC-13.
> GCC-14 has rewritten this function, so there is no issue.
>
> PR target/110560
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): Fix bug.
> ---
> gcc/config/riscv/riscv-vsetvl.cc | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
> index 35403b5679c..3355ca4e3fb 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -1078,6 +1078,10 @@ local_eliminate_vsetvl_insn (const vector_insn_info &dem)
>   if (has_vtype_op (i->rtl ()))
>     {
> +       if (!PREV_INSN (i->rtl ()))
> + return;
> +       if (!NONJUMP_INSN_P (PREV_INSN (i->rtl ())))
> + return;
>       if (!vsetvl_discard_result_insn_p (PREV_INSN (i->rtl ())))
> return;
>       rtx avl = get_avl (i->rtl ());
> --
> 2.17.1
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-07  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07  8:22 [PATCH] RISCV: Fix local_eliminate_vsetvl_insn bug in VSETVL PASS[PR110560] Li Xu
2023-07-07  8:23 ` juzhe.zhong
2023-07-07  9:04   ` Kito Cheng
2023-07-07  9:07     ` juzhe.zhong
2023-07-07  9:35       ` Li, Pan2

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).