RISC-V: Refine codes in backward fusion

Message ID 20230109224726.148263-1-juzhe.zhong@rivai.ai
State Accepted
Headers
Series RISC-V: Refine codes in backward fusion |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

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

This NFC patch is preparing for the following patches.
gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (pass_vsetvl::backward_demand_fusion): Refine codes.

---
 gcc/config/riscv/riscv-vsetvl.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
  

Comments

Kito Cheng Jan. 26, 2023, 7:15 p.m. UTC | #1
committed, thanks.

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

> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> This NFC patch is preparing for the following patches.
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vsetvl.cc
> (pass_vsetvl::backward_demand_fusion): Refine codes.
>
> ---
>  gcc/config/riscv/riscv-vsetvl.cc | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv-vsetvl.cc
> b/gcc/config/riscv/riscv-vsetvl.cc
> index 18c6f437db6..0ca1c51d121 100644
> --- a/gcc/config/riscv/riscv-vsetvl.cc
> +++ b/gcc/config/riscv/riscv-vsetvl.cc
> @@ -2010,15 +2010,16 @@ pass_vsetvl::backward_demand_fusion (void)
>    for (const bb_info *bb : crtl->ssa->reverse_bbs ())
>      {
>        basic_block cfg_bb = bb->cfg_bb ();
> -      const auto &prop
> -       = m_vector_manager->vector_block_infos[cfg_bb->index].local_dem;
> +      const auto &curr_block_info
> +       = m_vector_manager->vector_block_infos[cfg_bb->index];
> +      const auto &prop = curr_block_info.local_dem;
>
>        /* If there is nothing to propagate, just skip it.  */
>        if (!prop.valid_or_dirty_p ())
>         continue;
>
> -      if (!backward_propagate_worthwhile_p (
> -           cfg_bb, m_vector_manager->vector_block_infos[cfg_bb->index]))
> +      if (!backward_propagate_worthwhile_p (cfg_bb, curr_block_info))
> +       continue;
>         continue;
>
>        edge e;
> --
> 2.36.1
>
>
  

Patch

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 18c6f437db6..0ca1c51d121 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2010,15 +2010,16 @@  pass_vsetvl::backward_demand_fusion (void)
   for (const bb_info *bb : crtl->ssa->reverse_bbs ())
     {
       basic_block cfg_bb = bb->cfg_bb ();
-      const auto &prop
-	= m_vector_manager->vector_block_infos[cfg_bb->index].local_dem;
+      const auto &curr_block_info
+	= m_vector_manager->vector_block_infos[cfg_bb->index];
+      const auto &prop = curr_block_info.local_dem;
 
       /* If there is nothing to propagate, just skip it.  */
       if (!prop.valid_or_dirty_p ())
 	continue;
 
-      if (!backward_propagate_worthwhile_p (
-	    cfg_bb, m_vector_manager->vector_block_infos[cfg_bb->index]))
+      if (!backward_propagate_worthwhile_p (cfg_bb, curr_block_info))
+	continue;
 	continue;
 
       edge e;