public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Richard Biener <richard.guenther@gmail.com>,
	"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 17:11:06 +0200	[thread overview]
Message-ID: <e49aa156-267d-dcb2-36fc-8cce42acb26c@suse.cz> (raw)
In-Reply-To: <CAFiYyc0TmEfBsCR1SbA0sY6=4G0m=wP_YE8pdpsOJRFbfQHYAA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

On 10/12/21 15:37, Richard Biener wrote:
> by adding EnabledBy(funroll-loops) to the respective options instead
> (and funroll-loops EnabledBy(funroll-all-loops))

All right, so the suggested approach works correctly.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

[-- Attachment #2: 0001-Fix-handling-of-flag_rename_registers-by-a-target.patch --]
[-- Type: text/x-patch, Size: 2746 bytes --]

From c42efec30d7cce36c92d9369791826c9120dd3d1 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 12 Oct 2021 16:05:49 +0200
Subject: [PATCH] Fix handling of flag_rename_registers by a target.

gcc/ChangeLog:

	* common.opt: Use EnabledBy instead of detection in
	finish_options and process_options.
	* opts.c (finish_options): Remove handling of
	x_flag_unroll_all_loops.
	* toplev.c (process_options): Likewise for flag_web and
	flag_rename_registers.

diff --git a/gcc/common.opt b/gcc/common.opt
index 4099effcc80..bcbf95aada3 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) Optimization EnabledBy(funroll-loops)
 Perform a register renaming optimization pass.
 
 fschedule-fusion
@@ -2939,7 +2939,7 @@ Common Var(flag_unroll_loops) Optimization
 Perform loop unrolling when iteration count is known.
 
 funroll-all-loops
-Common Var(flag_unroll_all_loops) Optimization
+Common Var(flag_unroll_all_loops) Optimization EnabledBy(funroll-all-loops)
 Perform loop unrolling for all loops.
 
 funroll-completely-grow-size
@@ -3158,7 +3158,7 @@ Common Var(flag_value_profile_transformations) Optimization
 Use expression value profiles in optimizations.
 
 fweb
-Common Var(flag_web) Optimization
+Common Var(flag_web) Optimization EnabledBy(funroll-loops)
 Construct webs and split unrelated uses of single variable.
 
 ftree-builtin-call-dce
diff --git a/gcc/opts.c b/gcc/opts.c
index 2116c2991dd..fc71b6e4242 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1321,11 +1321,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 				       opts->x_flag_live_patching,
 				       loc);
 
-  /* Unrolling all loops implies that standard loop unrolling must also
-     be done.  */
-  if (opts->x_flag_unroll_all_loops)
-    opts->x_flag_unroll_loops = 1;
-
   /* Allow cunroll to grow size accordingly.  */
   if (!opts_set->x_flag_cunroll_grow_size)
     opts->x_flag_cunroll_grow_size
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 167feac2583..81546b19e91 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1331,13 +1331,6 @@ process_options (bool no_backend)
       flag_abi_version = 2;
     }
 
-  /* web and rename-registers help when run after loop unrolling.  */
-  if (!OPTION_SET_P (flag_web))
-    flag_web = flag_unroll_loops;
-
-  if (!OPTION_SET_P (flag_rename_registers))
-    flag_rename_registers = flag_unroll_loops;
-
   if (flag_non_call_exceptions)
     flag_asynchronous_unwind_tables = 1;
   if (flag_asynchronous_unwind_tables)
-- 
2.33.0


  parent reply	other threads:[~2021-10-12 15:11 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
2021-10-12 14:03   ` Martin Liška
2021-10-12 15:11   ` Martin Liška [this message]
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=e49aa156-267d-dcb2-36fc-8cce42acb26c@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=richard.guenther@gmail.com \
    /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).