CCing Li Pan to backport this patch. Thanks.
juzhe.zh...@rivai.ai From: Kito Cheng Date: 2023-07-07 17:04 To: juzhe.zh...@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.zh...@rivai.ai <juzhe.zh...@rivai.ai> wrote: > > LGTM. Thanks. > > > > juzhe.zh...@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 > >