public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org
Cc: bschmidt@redhat.com,	Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH 5/9] regrename: Don't run if function was separately shrink-wrapped
Date: Mon, 01 Aug 2016 02:12:00 -0000	[thread overview]
Message-ID: <fb99bf2f5a70c60f262469a6d55d59390afe7564.1470015604.git.segher@kernel.crashing.org> (raw)
In-Reply-To: <cover.1470015604.git.segher@kernel.crashing.org>
In-Reply-To: <cover.1470015604.git.segher@kernel.crashing.org>

Unfortunately even after the previous patch there are still a few cases
where regrename creates invalid code when used together with separate
shrink-wrapping.  At noreturn exits regrename thinks it can use all
callee-saved registers, but that is not true.  This patch disables
regrename for functions that were separately shrink-wrapped.

2016-06-07  Segher Boessenkool  <segher@kernel.crashing.org>

	* regrename.c (gate): Disable regrename if shrink_wrapped_separate
	is set in crtl.
---
 gcc/regrename.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/regrename.c b/gcc/regrename.c
index 00a5d02..e2d2483 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1956,7 +1956,12 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *)
     {
-      return (optimize > 0 && (flag_rename_registers));
+      /* regrename can decide to use callee-saved registers in places where
+	 those should hold their original contents.  This happens when
+	 separate shrink-wrapping is used.  Disable regrename in that case,
+	 until this problem is fixed.  */
+      return (optimize > 0 && flag_rename_registers
+	      && !crtl->shrink_wrapped_separate);
     }
 
   virtual unsigned int execute (function *) { return regrename_optimize (); }
-- 
1.9.3

  parent reply	other threads:[~2016-08-01  2:12 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01  1:43 [PATCH v2 0/9] Separate shrink-wrapping Segher Boessenkool
2016-08-01  1:43 ` [PATCH 3/9] dce: Don't dead-code delete separately wrapped restores Segher Boessenkool
2016-09-08 17:52   ` Jeff Law
2016-09-09 15:59     ` Segher Boessenkool
2016-09-09 16:39       ` Jeff Law
2016-08-01  1:43 ` [PATCH 2/9] cfgcleanup: Don't confuse CFI when -fshrink-wrap-separate Segher Boessenkool
2016-09-08 17:51   ` Jeff Law
2016-08-01  1:43 ` [PATCH 1/9] separate shrink-wrap: New command-line flag, status flag, hooks, and doc Segher Boessenkool
2016-08-29  9:31   ` Bernd Schmidt
2016-08-29 14:30     ` Segher Boessenkool
2016-09-08 17:37     ` Jeff Law
2016-09-09 11:03       ` Bernd Schmidt
2016-09-09 15:13         ` Segher Boessenkool
2016-09-09 18:31           ` Jeff Law
2016-09-09 20:41             ` Segher Boessenkool
2016-09-12 16:49               ` Jeff Law
2016-09-09 15:51         ` Jeff Law
2016-09-09 15:40       ` Segher Boessenkool
2016-09-09 16:58         ` Jeff Law
2016-09-08 17:48   ` Jeff Law
2016-09-09 15:44     ` Segher Boessenkool
2016-08-01  1:57 ` [PATCH 4/9] regrename: Don't rename restores Segher Boessenkool
2016-09-08 17:54   ` Jeff Law
2016-09-09 21:05     ` Segher Boessenkool
2016-09-12 17:01       ` Jeff Law
2016-08-01  1:57 ` [PATCH 9/9] rs6000: Separate shrink-wrapping Segher Boessenkool
2016-08-01  1:57 ` [PATCH 8/9] shrink-wrap: shrink-wrapping for separate components Segher Boessenkool
2016-09-08 19:03   ` Jeff Law
2016-09-09 22:03     ` Segher Boessenkool
2016-09-12 18:21       ` Jeff Law
2016-09-14 13:45         ` Segher Boessenkool
2016-09-15 16:47           ` Jeff Law
2016-08-01  1:57 ` [PATCH 7/9] cprop: Leave RTX_FRAME_RELATED_P instructions alone Segher Boessenkool
2016-09-08 18:34   ` Jeff Law
2016-09-09 21:21     ` Segher Boessenkool
2016-08-01  2:12 ` Segher Boessenkool [this message]
2016-09-08 17:54   ` [PATCH 5/9] regrename: Don't run if function was separately shrink-wrapped Jeff Law
2016-08-01  2:12 ` [PATCH 6/9] sel-sched: Don't mess with register restores Segher Boessenkool
2016-08-04  7:33   ` Andrey Belevantsev
2016-09-08 17:55   ` Jeff Law
2016-09-09 21:13     ` Segher Boessenkool
2016-09-12 17:39       ` Jeff Law
2016-09-14 13:28         ` Segher Boessenkool
2016-08-04  0:05 ` [PATCH v2 0/9] Separate shrink-wrapping Segher Boessenkool
2016-08-24 16:04   ` Segher Boessenkool
2016-08-26 13:03 ` Bernd Schmidt
2016-08-26 13:48   ` David Malcolm
2016-08-26 13:55     ` Bernd Schmidt
2016-08-26 14:50   ` Segher Boessenkool
2016-08-26 15:03     ` Bernd Schmidt
2016-08-26 16:27       ` Segher Boessenkool
2016-09-08 16:58         ` Jeff Law
2016-09-09 15:26           ` Segher Boessenkool
2016-09-09 16:26             ` Jeff Law
2016-09-09 16:51               ` Segher Boessenkool
2016-09-09 17:22                 ` Jeff Law
2016-08-30 12:31       ` Michael Matz
2016-09-08 16:41         ` Jeff Law
2016-09-09  6:31           ` Segher Boessenkool
2016-09-09 15:28             ` Jeff Law
2016-09-09 15:43               ` Segher Boessenkool
2016-09-09 18:25                 ` Jeff Law
2016-09-09 20:29                   ` Segher Boessenkool
2016-09-08 17:20       ` Jeff Law
2016-09-09 15:33         ` Segher Boessenkool
2016-09-09 16:49           ` Jeff Law
2016-09-09 17:00             ` Segher Boessenkool
2016-09-09 17:44               ` Jeff Law
2016-09-09 19:36   ` Jeff Law
2016-09-09 21:00     ` Segher Boessenkool
2016-09-12 11:00       ` Bernd Schmidt
2016-09-12 16:59       ` Jeff Law
2016-09-14 13:22         ` Segher Boessenkool
  -- strict thread matches above, loose matches on Subject: below --
2016-06-08  1:48 [PATCH 0/9] separate shrink-wrapping Segher Boessenkool
2016-06-08  1:54 ` [PATCH 5/9] regrename: Don't run if function was separately shrink-wrapped Segher Boessenkool
2016-06-08  9:18   ` Bernd Schmidt
2016-09-09 18:41     ` Jeff Law
2016-09-09 20:56       ` Segher Boessenkool
2016-09-09 23:12         ` Jeff Law
2016-09-10  6:59           ` Segher Boessenkool
2016-09-12 16:36             ` Jeff Law
     [not found]               ` <CAGWvny=fHHZtKF4_D2098+3PTPPzxtg3EjKDWHyJwUxz8g_tEA@mail.gmail.com>
     [not found]                 ` <CAGWvnymZVg_FR_PHqhwkgrAkHDntVMEiG4shfst_GA9OnZKvWg@mail.gmail.com>
     [not found]                   ` <CAGWvnykQ3oz0UpcF6U1WYivbJww65h2EH5n3FocQ8JGY9hrOrA@mail.gmail.com>
2016-09-12 17:04                     ` Jeff Law
2016-09-14 13:08               ` Segher Boessenkool
2016-09-14 13:18                 ` Bernd Schmidt
2016-09-14 14:01                   ` Segher Boessenkool
2016-09-14 14:54                     ` Bernd Schmidt
2016-09-14 16:33                       ` Segher Boessenkool
2016-09-14 19:10                       ` Jeff Law
2016-09-14 17:55                     ` Jeff Law
2016-09-14 19:13                       ` Segher Boessenkool
2016-09-14 19:36                         ` Jeff Law
2016-09-14 18:21                 ` Jeff Law
2016-09-14 19:13                   ` Segher Boessenkool
2016-09-14 19:38                     ` Jeff Law
2016-09-14 22:34                       ` Segher Boessenkool
2016-09-15 17:28                         ` Jeff Law
2016-09-19 17:11                       ` Segher Boessenkool
2016-09-14 20:04                     ` Jeff Law
2016-09-14 22:51                       ` Segher Boessenkool

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=fb99bf2f5a70c60f262469a6d55d59390afe7564.1470015604.git.segher@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).