shrink-wraping already gated by Os so I think we don't need add more gate here, unless we are trying to claim force optimize for size if zcmp is present.
On Sat, May 6, 2023 at 4:41 PM Fei Gao <gao...@eswincomputing.com> wrote: > > zcmp aims to reduce code size, while shrink-wrap-separate prefers > speed to code size. So disable shrink-wrap-separate if zcmp > enabled, just like what save-restore has done. > > author: Zhangjin Liao liaozhang...@eswincomputing.com > > gcc/ChangeLog: > > * config/riscv/riscv.cc (riscv_get_separate_components): > --- > gcc/config/riscv/riscv.cc | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > index 45a63cab9c9..629e5e45cac 100644 > --- a/gcc/config/riscv/riscv.cc > +++ b/gcc/config/riscv/riscv.cc > @@ -5729,7 +5729,8 @@ riscv_get_separate_components (void) > > if (riscv_use_save_libcall (&cfun->machine->frame) > || cfun->machine->interrupt_handler_p > - || !cfun->machine->frame.gp_sp_offset.is_constant ()) > + || !cfun->machine->frame.gp_sp_offset.is_constant () > + || TARGET_ZCMP) > return components; > > offset = cfun->machine->frame.gp_sp_offset.to_constant (); > -- > 2.17.1 >