diff mbox series

RISCV: Fix PR111074 [GCC13 BUG]

Message ID 20230822022935.9877-1-xuli1@eswincomputing.com
State New
Headers show
Series RISCV: Fix PR111074 [GCC13 BUG] | expand

Commit Message

Li Xu Aug. 22, 2023, 2:29 a.m. UTC
From: xuli <xuli1@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(+)

Comments

juzhe.zhong@rivai.ai Aug. 22, 2023, 2:40 a.m. UTC | #1
Thanks for fixing it.

I am wonder could you add testcase into the patch?
Or the testcase is too big and not appropriate to add.




juzhe.zhong@rivai.ai
 
From: Li Xu
Date: 2023-08-22 10:29
To: gcc-patches
CC: kito.cheng; palmer; juzhe.zhong; xuli
Subject: [PATCH] RISCV: Fix PR111074 [GCC13 BUG]
From: xuli <xuli1@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;
Li Xu Aug. 22, 2023, 2:42 a.m. UTC | #2
The test case is too complicated and I can't simplify it, so no test case is added.

--------------
Li Xu
>From: xuli <xuli1@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
juzhe.zhong@rivai.ai Aug. 22, 2023, 2:44 a.m. UTC | #3
Ok to backport GCC 13.

You could disscuss with Pan Li whether you backport it or he backport it.

Thanks.


juzhe.zhong@rivai.ai
 
From: Li Xu
Date: 2023-08-22 10:42
To: xuli1; gcc-patches
CC: kito.cheng; palmer; juzhe.zhong
Subject: Re: [PATCH] RISCV: Fix PR111074 [GCC13 BUG]
The test case is too complicated and I can't simplify it, so no test case is added.
 
--------------
Li Xu
>From: xuli <xuli1@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
Li Xu Aug. 22, 2023, 7:28 a.m. UTC | #4
Committed, thanks all.

--------------
Li Xu
>The test case is too complicated and I can't simplify it, so no test case is added.
>
>--------------
>Li Xu
>>From: xuli <xuli1@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
diff mbox series

Patch

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;