https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124901

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #9 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #8)
> FTR: Adding *another* pass_cprop_hardreg after pass_reorder_blocks with:
> 
> --cut here--
> diff --git a/gcc/passes.def b/gcc/passes.def
> index cdddb87302f..b5c6e99974b 100644
> --- a/gcc/passes.def
> +++ b/gcc/passes.def
> @@ -543,6 +543,7 @@ along with GCC; see the file COPYING3.  If not see
>         NEXT_PASS (pass_cprop_hardreg);
>         NEXT_PASS (pass_fast_rtl_dce);
>         NEXT_PASS (pass_reorder_blocks);
> +       NEXT_PASS (pass_cprop_hardreg);
>         NEXT_PASS (pass_leaf_regs);
>         NEXT_PASS (pass_split_before_sched2);
>         NEXT_PASS (pass_sched2);
> diff --git a/gcc/regcprop.cc b/gcc/regcprop.cc
> index 2a9956353cc..806dc944b97 100644
> --- a/gcc/regcprop.cc
> +++ b/gcc/regcprop.cc
> @@ -1358,6 +1358,7 @@ public:
>    {}
>  
>    /* opt_pass methods: */
> +  opt_pass *clone () override { return new pass_cprop_hardreg (m_ctxt); }
>    bool gate (function *) final override
>      {
>        return (optimize > 0 && (flag_cprop_registers));
> --cut here--
> 
> also shows some code size improvements with x86_64 default linux kernel:
> 
> $ size *.o
>    text    data     bss     dec     hex filename
> 29378531        4929075  744820 35052426        216db8a vmlinux-add.o
> 29382751        4929075  744820 35056646        216ec06 vmlinux-baseline.o
> 29384459        4929075  744820 35058354        216f2b2 vmlinux-moved.o
> 
> where vmlinux-baseline.o is compiled with vanilla GCC, vmlinux-add.o is
> compiled with additional pass_cprop_hardreg after pass_reorder_blocks, and
> vmlinux-moved.o is compiled with pass_cprop_hardreg moved from its current
> position to after pass_reorder_blocks.
> 
> The code size changes are:
> 
> vmlinux-moved.o: +1708 bytes
> vmlinux-add.o  : -4220 bytes
> 
> So, it looks there is some benefit by adding another pass_cprop_hardreg
> after pass_reorder_blocks.


Maybe only enabling this pass at -O2+ and not for -Os (because bb reorder for
-Os should not be duplicating the bb).

Reply via email to