public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Avoid redundant flow in forward fusion
@ 2023-01-09 22:40 juzhe.zhong
  2023-01-26 19:14 ` Kito Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: juzhe.zhong @ 2023-01-09 22:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, palmer, Ju-Zhe Zhong

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

gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (pass_vsetvl::forward_demand_fusion): Add pre-check for redundant flow.

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

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 7800c2ee509..18c6f437db6 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2140,6 +2140,9 @@ pass_vsetvl::forward_demand_fusion (void)
       if (!prop.valid_or_dirty_p ())
 	continue;
 
+      if (cfg_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+	continue;
+
       edge e;
       edge_iterator ei;
       /* Forward propagate to each successor.  */
@@ -2153,6 +2156,11 @@ pass_vsetvl::forward_demand_fusion (void)
 	  /* It's quite obvious, we don't need to propagate itself.  */
 	  if (e->dest->index == cfg_bb->index)
 	    continue;
+	  /* We don't propagate through critical edges.  */
+	  if (e->flags & EDGE_COMPLEX)
+	    continue;
+	  if (e->dest->index == EXIT_BLOCK_PTR_FOR_FN (cfun)->index)
+	    continue;
 
 	  /* If there is nothing to propagate, just skip it.  */
 	  if (!local_dem.valid_or_dirty_p ())
-- 
2.36.1


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

end of thread, other threads:[~2023-01-26 19:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 22:40 [PATCH] RISC-V: Avoid redundant flow in forward fusion juzhe.zhong
2023-01-26 19:14 ` 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).