public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Fix ICE for avl_single-86/avl_single-88/avl_single-90
@ 2023-03-05 10:24 juzhe.zhong
  2023-03-05 17:24 ` Kito Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: juzhe.zhong @ 2023-03-05 10:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, Ju-Zhe Zhong

From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-86.c  -Og -g  (internal
compiler error: Segmentation fault)
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-86.c  -Og -g  (test for
excess errors)
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-88.c  -Og -g  (internal
compiler error: Segmentation fault)
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-88.c  -Og -g  (test for
excess errors)
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-90.c  -Og -g  (internal
compiler error: Segmentation fault)
FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-90.c  -Og -g  (test for
excess errors)

gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (reg_available_p): Fix bug.
        (pass_vsetvl::backward_demand_fusion): Ditto.

---
 gcc/config/riscv/riscv-vsetvl.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 9e25102a4f2..73f36a70331 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1528,7 +1528,7 @@ static bool
 reg_available_p (const bb_info *bb, const vector_insn_info &info)
 {
   if (!info.get_avl_source ())
-    return true;
+    return false;
   insn_info *insn = info.get_avl_source ()->insn ();
   if (insn->bb () == bb)
     return before_p (insn, info.get_insn ());
@@ -3040,6 +3040,12 @@ pass_vsetvl::backward_demand_fusion (void)
 	    continue;
 	  if (e->src->index == ENTRY_BLOCK_PTR_FOR_FN (cfun)->index)
 	    continue;
+	  /* If prop is demand of vsetvl instruction and reaching doesn't demand
+	     AVL. We don't backward propagate since vsetvl instruction has no
+	     side effects.  */
+	  if (vsetvl_insn_p (prop.get_insn ()->rtl ())
+	      && propagate_avl_across_demands_p (prop, block_info.reaching_out))
+	    continue;
 
 	  if (block_info.reaching_out.unknown_p ())
 	    continue;
-- 
2.36.3


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

* Re: [PATCH] RISC-V: Fix ICE for avl_single-86/avl_single-88/avl_single-90
  2023-03-05 10:24 [PATCH] RISC-V: Fix ICE for avl_single-86/avl_single-88/avl_single-90 juzhe.zhong
@ 2023-03-05 17:24 ` Kito Cheng
  0 siblings, 0 replies; 2+ messages in thread
From: Kito Cheng @ 2023-03-05 17:24 UTC (permalink / raw)
  To: juzhe.zhong; +Cc: gcc-patches

Committed, thanks for the fix :)

On Sun, Mar 5, 2023 at 6:25 PM <juzhe.zhong@rivai.ai> wrote:
>
> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-86.c  -Og -g  (internal
> compiler error: Segmentation fault)
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-86.c  -Og -g  (test for
> excess errors)
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-88.c  -Og -g  (internal
> compiler error: Segmentation fault)
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-88.c  -Og -g  (test for
> excess errors)
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-90.c  -Og -g  (internal
> compiler error: Segmentation fault)
> FAIL: gcc.target/riscv/rvv/vsetvl/avl_single-90.c  -Og -g  (test for
> excess errors)
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc (reg_available_p): Fix bug.
>         (pass_vsetvl::backward_demand_fusion): Ditto.
>
> ---
>  gcc/config/riscv/riscv-vsetvl.cc | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
> index 9e25102a4f2..73f36a70331 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -1528,7 +1528,7 @@ static bool
>  reg_available_p (const bb_info *bb, const vector_insn_info &info)
>  {
>    if (!info.get_avl_source ())
> -    return true;
> +    return false;
>    insn_info *insn = info.get_avl_source ()->insn ();
>    if (insn->bb () == bb)
>      return before_p (insn, info.get_insn ());
> @@ -3040,6 +3040,12 @@ pass_vsetvl::backward_demand_fusion (void)
>             continue;
>           if (e->src->index == ENTRY_BLOCK_PTR_FOR_FN (cfun)->index)
>             continue;
> +         /* If prop is demand of vsetvl instruction and reaching doesn't demand
> +            AVL. We don't backward propagate since vsetvl instruction has no
> +            side effects.  */
> +         if (vsetvl_insn_p (prop.get_insn ()->rtl ())
> +             && propagate_avl_across_demands_p (prop, block_info.reaching_out))
> +           continue;
>
>           if (block_info.reaching_out.unknown_p ())
>             continue;
> --
> 2.36.3
>

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

end of thread, other threads:[~2023-03-05 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-05 10:24 [PATCH] RISC-V: Fix ICE for avl_single-86/avl_single-88/avl_single-90 juzhe.zhong
2023-03-05 17:24 ` Kito Cheng

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