From: Ju-Zhe Zhong Date: Mon, 9 Jan 2023 22:40:07 +0000 (+0800) Subject: RISC-V: Avoid redundant flow in forward fusion X-Git-Tag: basepoints/gcc-14~1796 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00fb7698f0b3ae14d6d472db0f8b64744c84678b;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index f67459ca8ca3..9140b1832bf4 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 ())