[PATCH] cfgexpand: Skip doing conflicts if there is only 1 variable

Richard Biener richard.guenther@gmail.com
Thu Nov 14 08:29:39 GMT 2024


On Wed, Nov 13, 2024 at 5:21 PM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> This is a small speed up. If there is only one know stack variable, there
> is no reason figure out the scope conflicts as there are none. So don't
> go through all the live range calculations just to see there are none.
>
> Bootstrapped and tested on x86_64-linux-gnu with no regressions.

OK.

> gcc/ChangeLog:
>
>         * cfgexpand.cc (add_scope_conflicts): Return right away
>         if there are only one stack variable.
>
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
>  gcc/cfgexpand.cc | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
> index f3a33ff9a07..ed890f692e5 100644
> --- a/gcc/cfgexpand.cc
> +++ b/gcc/cfgexpand.cc
> @@ -703,6 +703,11 @@ add_scope_conflicts_1 (basic_block bb, bitmap work, bool for_conflict)
>  static void
>  add_scope_conflicts (void)
>  {
> +  /* If there is only one variable, there is nothing to be done as
> +     there is only possible partition.  */
> +  if (stack_vars_num == 1)
> +    return;
> +
>    basic_block bb;
>    bool changed;
>    bitmap work = BITMAP_ALLOC (NULL);
> --
> 2.43.0
>


More information about the Gcc-patches mailing list