aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>2023-01-10 06:40:07 +0800
committerKito Cheng <kito.cheng@sifive.com>2023-01-27 03:10:16 +0800
commit00fb7698f0b3ae14d6d472db0f8b64744c84678b (patch)
treea5a44b1b3aa3409f8b78ea74f3efbcd58349d0c3
parentcfe3fbc678d7b69785d2b017d3ff3cd78cd91580 (diff)
downloadgcc-00fb7698f0b3ae14d6d472db0f8b64744c84678b.zip
gcc-00fb7698f0b3ae14d6d472db0f8b64744c84678b.tar.gz
gcc-00fb7698f0b3ae14d6d472db0f8b64744c84678b.tar.bz2
RISC-V: Avoid redundant flow in forward fusion
gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pass_vsetvl::forward_demand_fusion): Add pre-check for redundant flow.
-rw-r--r--gcc/config/riscv/riscv-vsetvl.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index f67459c..9140b18 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2141,6 +2141,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. */
@@ -2154,6 +2157,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 ())