RISC-V: Avoid redundant flow in backward fusion

Message ID 20230109225035.149190-1-juzhe.zhong@rivai.ai
State Unresolved
Headers
Series RISC-V: Avoid redundant flow in backward fusion |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

juzhe.zhong@rivai.ai Jan. 9, 2023, 10:50 p.m. UTC
  From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (pass_vsetvl::backward_demand_fusion): Add pre-check to avoid redundant flow.

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

Comments

Kito Cheng Jan. 26, 2023, 7:16 p.m. UTC | #1
merged into another commit,, thanks.

On Tue, Jan 10, 2023 at 6:51 AM <juzhe.zhong@rivai.ai> wrote:

> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc
> (pass_vsetvl::backward_demand_fusion): Add pre-check to avoid redundant
> flow.
>
> ---
>  gcc/config/riscv/riscv-vsetvl.cc | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc
> b/gcc/config/riscv/riscv-vsetvl.cc
> index 0ca1c51d121..a972c49561a 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -2020,6 +2020,8 @@ pass_vsetvl::backward_demand_fusion (void)
>
>        if (!backward_propagate_worthwhile_p (cfg_bb, curr_block_info))
>         continue;
> +
> +      if (cfg_bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
>         continue;
>
>        edge e;
> --
> 2.36.1
>
>
  

Patch

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 0ca1c51d121..a972c49561a 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2020,6 +2020,8 @@  pass_vsetvl::backward_demand_fusion (void)
 
       if (!backward_propagate_worthwhile_p (cfg_bb, curr_block_info))
 	continue;
+
+      if (cfg_bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
 	continue;
 
       edge e;