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

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).