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: law@redhat.com,	dje.gcc@gmail.com,
	Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH 3/5] regrename: Don't rename restores
Date: Fri, 23 Sep 2016 08:23:00 -0000	[thread overview]
Message-ID: <f92b642e30f141bd5a2910b4b422857384d4369d.1474616087.git.segher@kernel.crashing.org> (raw)
In-Reply-To: <cover.1474616087.git.segher@kernel.crashing.org>
In-Reply-To: <cover.1474616087.git.segher@kernel.crashing.org>

A restore is supposed to restore some certain register.  Restoring it
into some other register will not work.  Don't.


2016-09-23  Segher Boessenkool  <segher@kernel.crashing.org>

	* regrename.c (build_def_use): Invalidate chains that have a
	REG_CFA_RESTORE on some instruction.

---
 gcc/regrename.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/regrename.c b/gcc/regrename.c
index 54c7768..00a5d02 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1867,6 +1867,12 @@ build_def_use (basic_block bb)
 		scan_rtx (insn, &XEXP (note, 0), NO_REGS, terminate_dead,
 			  OP_IN);
 	      }
+
+	  /* Step 8: Kill the chains involving register restores.  Those
+	     should restore _that_ register.  */
+	  for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
+	    if (REG_NOTE_KIND (note) == REG_CFA_RESTORE)
+	      scan_rtx (insn, &XEXP (note, 0), NO_REGS, mark_all_read, OP_IN);
 	}
       else if (DEBUG_INSN_P (insn)
 	       && !VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn)))
-- 
1.9.3

  parent reply	other threads:[~2016-09-23  8:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23  8:22 [PATCH v3 0/5] Separate shrink-wrapping Segher Boessenkool
2016-09-23  8:22 ` [PATCH 1/5] separate shrink-wrap: New command-line flag, status flag, hooks, and doc Segher Boessenkool
2016-09-26 17:02   ` Jeff Law
2016-09-23  8:22 ` [PATCH 2/5] dce: Don't dead-code delete separately wrapped restores Segher Boessenkool
2016-09-26 16:55   ` Jeff Law
2016-09-23  8:23 ` Segher Boessenkool [this message]
2016-09-26 16:44   ` [PATCH 3/5] regrename: Don't rename restores Jeff Law
2016-09-23  8:33 ` [PATCH 4/5] shrink-wrap: Shrink-wrapping for separate components Segher Boessenkool
2016-09-27 21:25   ` Jeff Law
2016-09-28  9:26     ` Segher Boessenkool
2016-09-28 16:36       ` Jeff Law
2016-09-30 10:14     ` Segher Boessenkool
     [not found]     ` <20160930102908.GB14933@gate.crashing.org>
2016-09-30 10:52       ` Segher Boessenkool
2016-10-10 21:21         ` Jeff Law
2016-10-10 22:23           ` Segher Boessenkool
2016-09-23  8:44 ` [PATCH 5/5] rs6000: Separate shrink-wrapping Segher Boessenkool
2016-09-26 16:39   ` Jeff Law
2016-09-26 18:16   ` David Edelsohn

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=f92b642e30f141bd5a2910b4b422857384d4369d.1474616087.git.segher@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.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).