The test case is too complicated and I can't simplify it, so no test case is 
added.

--------------
Li Xu
>From: xuli <xu...@eswincomputing.com>
>
>This patch fixes this issue happens on GCC-13.
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111074
>
>This patch should be backported to GCC-13.
>GCC-14 has rewritten propagate_avl function, so there is no issue.
>
>PR target/111074
>
>gcc/ChangeLog:
>
>        * config/riscv/riscv-vsetvl.cc (extract_single_source): Fix bug.
>---
> gcc/config/riscv/riscv-vsetvl.cc | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/gcc/config/riscv/riscv-vsetvl.cc 
>b/gcc/config/riscv/riscv-vsetvl.cc
>index 789eb04b78d..bd45cb97e63 100644
>--- a/gcc/config/riscv/riscv-vsetvl.cc
>+++ b/gcc/config/riscv/riscv-vsetvl.cc
>@@ -1183,6 +1183,9 @@ extract_single_source (set_info *set)
>     return nullptr;
>   hash_set<set_info *> sets = get_all_sets (set, true, false, true);
>
>+  if (sets.is_empty ())
>+    return nullptr;
>+
>   insn_info *first_insn = (*sets.begin ())->insn ();
>   if (first_insn->is_artificial ())
>     return nullptr;
>--
>2.17.1

Reply via email to