public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@nildram.co.uk>
To: gcc-patches@gcc.gnu.org
Subject: Fix postreload-gcse treatment of call-clobbered registers
Date: Mon, 21 May 2007 22:01:00 -0000	[thread overview]
Message-ID: <87d50t96r7.fsf@firetop.home> (raw)

This is the patch that inspired the HARD_REG_SET constructs I just posted
(and it depends on them).  postreload-gcse.c was only checking whether
REGNO (x) is call-clobbered, but it should check whether the whole
register is.

I verified that this bug is still present on dataflow-branch.
I tripped over it while doing some other changes, so I don't have
a mainline testcase.  Hopefully the fix is obvious enough not to
need one.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also
regression-tested on sh-elf (,-m2,-m3,-m4,-m4/-ml) and built
on arm-elf.  OK to install?

Richard


gcc/
	* postreload-gcse.c (reg_set_between_after_reload_p): Check
	whether any part of a multi-register value is call-clobbered.
	(reg_used_between_after_reload_p): Likewise.

Index: gcc/postreload-gcse.c
===================================================================
--- gcc/postreload-gcse.c	2007-05-21 00:23:48.000000000 +0100
+++ gcc/postreload-gcse.c	2007-05-21 00:26:28.000000000 +0100
@@ -880,7 +880,8 @@ reg_set_between_after_reload_p (rtx reg,
 	if (set_of (reg, insn) != NULL_RTX)
 	  return insn;
 	if ((CALL_P (insn)
-	      && call_used_regs[REGNO (reg)])
+	     && overlaps_hard_reg_set_p (call_used_reg_set,
+					 GET_MODE (reg), REGNO (reg)))
 	    || find_reg_fusage (insn, CLOBBER, reg))
 	  return insn;
 
@@ -913,7 +914,8 @@ reg_used_between_after_reload_p (rtx reg
       {
 	if (reg_overlap_mentioned_p (reg, PATTERN (insn))
 	    || (CALL_P (insn)
-		&& call_used_regs[REGNO (reg)])
+		&& overlaps_hard_reg_set_p (call_used_reg_set,
+					    GET_MODE (reg), REGNO (reg)))
 	    || find_reg_fusage (insn, USE, reg)
 	    || find_reg_fusage (insn, CLOBBER, reg))
 	  return insn;

             reply	other threads:[~2007-05-21 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-21 22:01 Richard Sandiford [this message]
2007-05-22 19:44 ` Eric Botcazou
2007-05-22 20:52   ` Richard Sandiford
2007-05-23  8:22     ` Eric Botcazou
2007-05-23 21:32       ` Richard Sandiford
2007-05-24 15:16         ` Eric Botcazou
2007-05-24 19:21           ` Richard Sandiford
2007-05-25  1:37 ` Ian Lance Taylor

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=87d50t96r7.fsf@firetop.home \
    --to=rsandifo@nildram.co.uk \
    --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).