public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "Martin Liška" <mliska@suse.cz>,
	"Joseph S. Myers" <joseph@codesourcery.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix handling of flag_rename_registers.
Date: Tue, 12 Oct 2021 15:37:49 +0200	[thread overview]
Message-ID: <CAFiYyc0TmEfBsCR1SbA0sY6=4G0m=wP_YE8pdpsOJRFbfQHYAA@mail.gmail.com> (raw)
In-Reply-To: <12fd0c18-79e0-d20d-2973-92639071c050@suse.cz>

On Tue, Oct 12, 2021 at 2:18 PM Martin Liška <mliska@suse.cz> wrote:
>
> Hello.
>
> The option is disabled in rs6000 target with:
>
>      { OPT_LEVELS_ALL, OPT_frename_registers, NULL, 0 },
>
> Thus, we have to do an auto-detection only if it's really unset and also
> equal to the Init value.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> And the problematic test-case works on ppc64le.
>
> Ready to be installed?

Hmm, I can see how it fixes the reported problem but I think the
thing is fragile.  I wonder if we can express things like

+  if (!OPTION_SET_P (flag_web))
     flag_web = flag_unroll_loops;

or

+  if (!OPTION_SET_P (flag_rename_registers))
     flag_rename_registers = flag_unroll_loops;

by adding EnabledBy(funroll-loops) to the respective options instead
(and funroll-loops EnabledBy(funroll-all-loops))

All SET_OPTION_IF_UNSET are fragile with respect to target overrides
(-fprofile-use does a lot of those for example).

I suppose opts_set could also record whether the target overrided
sth with its option_optimization_table.

Richard.

> Thanks,
> Martin
>
>         PR target/102688
>
> gcc/ChangeLog:
>
>         * common.opt: Enable flag_rename_registers by default.
>         * toplev.c (process_options): Auto-detect flag_rename_registers
>         only if it is not turned off in a target.
> ---
>   gcc/common.opt | 2 +-
>   gcc/toplev.c   | 3 ++-
>   2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index 4099effcc80..2c6be1bdd36 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -2399,7 +2399,7 @@ Common Var(flag_live_range_shrinkage) Init(0) Optimization
>   Relief of register pressure through live range shrinkage.
>
>   frename-registers
> -Common Var(flag_rename_registers) Optimization
> +Common Var(flag_rename_registers) Init(1) Optimization
>   Perform a register renaming optimization pass.
>
>   fschedule-fusion
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index 167feac2583..ee7d8854f90 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -1335,7 +1335,8 @@ process_options (bool no_backend)
>     if (!OPTION_SET_P (flag_web))
>       flag_web = flag_unroll_loops;
>
> -  if (!OPTION_SET_P (flag_rename_registers))
> +  /* The option can be turned off in a target.  */
> +  if (!OPTION_SET_P (flag_rename_registers) && flag_rename_registers)
>       flag_rename_registers = flag_unroll_loops;
>
>     if (flag_non_call_exceptions)
> --
> 2.33.0
>

  reply	other threads:[~2021-10-12 13:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 12:17 Martin Liška
2021-10-12 13:37 ` Richard Biener [this message]
2021-10-12 14:03   ` Martin Liška
2021-10-12 15:11   ` Martin Liška
2021-10-13  8:39     ` Richard Biener
2021-10-13 10:02       ` Martin Liška
2021-10-13 11:49         ` Richard Biener
2021-10-14 14:27         ` Jeff Law
2021-10-15 15:27           ` Martin Liška
2021-10-16 19:51             ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc0TmEfBsCR1SbA0sY6=4G0m=wP_YE8pdpsOJRFbfQHYAA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).