Message ID | 20230109224007.146325-1-juzhe.zhong@rivai.ai |
---|---|
State | New |
Headers | show |
Series | RISC-V: Avoid redundant flow in forward fusion | expand |
committed, thanks. On Tue, Jan 10, 2023 at 6:40 AM <juzhe.zhong@rivai.ai> wrote: > 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 > >
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 ())
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(+)