public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: gcc-patches@gcc.gnu.org
Cc: krebbel@linux.ibm.com, jasonwucj@gcc.gnu.org, zadeck@gcc.gnu.org,
	       jakub@redhat.com, vmakarov@redhat.com,
	       Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH] Fix hard regno checks
Date: Mon, 23 Jul 2018 09:14:00 -0000	[thread overview]
Message-ID: <20180723091424.5040-1-iii@linux.ibm.com> (raw)

FIRST_PSEUDO_REGISTER is not a hard regno, so comparisons should use
"<" instead of "<=", and ">=" instread of ">".

2018-07-19  Ilya Leoshkevich  <iii@linux.ibm.com>

	* config/nds32/nds32.c (nds32_hard_regno_mode_ok):
        Replace > with >=.
	* df-problems.c (df_remove_dead_eq_notes):
        Replace > with >=.
	* dwarf2out.c (mem_loc_descriptor):
        Replace > with >=.
	* lra-constraints.c (spill_hard_reg_in_range):
        Replace <= with <.
	* lra-remat.c (call_used_input_regno_present_p):
        Replace <= with <.
---
 gcc/config/nds32/nds32.c | 2 +-
 gcc/df-problems.c        | 2 +-
 gcc/dwarf2out.c          | 2 +-
 gcc/lra-constraints.c    | 2 +-
 gcc/lra-remat.c          | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index 85a29865c7a..721135e6ba1 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -4342,7 +4342,7 @@ nds32_hard_regno_nregs (unsigned regno ATTRIBUTE_UNUSED,
 static bool
 nds32_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
-  if (regno > FIRST_PSEUDO_REGISTER)
+  if (regno >= FIRST_PSEUDO_REGISTER)
     return true;
 
   if ((TARGET_FPU_SINGLE || TARGET_FPU_DOUBLE) && NDS32_IS_FPR_REGNUM (regno))
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 3d73bc5df10..7ccb57c287a 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3205,7 +3205,7 @@ df_remove_dead_eq_notes (rtx_insn *insn, bitmap live)
 	    bool deleted = false;
 
 	    FOR_EACH_INSN_EQ_USE (use, insn)
-	      if (DF_REF_REGNO (use) > FIRST_PSEUDO_REGISTER
+	      if (DF_REF_REGNO (use) >= FIRST_PSEUDO_REGISTER
 		  && DF_REF_LOC (use)
 		  && (DF_REF_FLAGS (use) & DF_REF_IN_NOTE)
 		  && !bitmap_bit_p (live, DF_REF_REGNO (use))
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index bd45e0b0685..d38aa10ebe6 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15478,7 +15478,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
 
 	  if (dwarf_strict && dwarf_version < 5)
 	    break;
-	  if (REGNO (rtl) > FIRST_PSEUDO_REGISTER)
+	  if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
 	    break;
 	  type_die = base_type_for_mode (mode, SCALAR_INT_MODE_P (mode));
 	  if (type_die == NULL)
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 7eeec767445..f2e4f36ebd0 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -5709,7 +5709,7 @@ spill_hard_reg_in_range (int regno, enum reg_class rclass, rtx_insn *from, rtx_i
       struct lra_insn_reg *reg;
       
       for (reg = id->regs; reg != NULL; reg = reg->next)
-	if (reg->regno <= FIRST_PSEUDO_REGISTER)
+	if (reg->regno < FIRST_PSEUDO_REGISTER)
 	  SET_HARD_REG_BIT (ignore, reg->regno);
       for (reg = static_id->hard_regs; reg != NULL; reg = reg->next)
 	SET_HARD_REG_BIT (ignore, reg->regno);
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index 527f2dd2b59..faf74ca8de7 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -708,7 +708,7 @@ call_used_input_regno_present_p (rtx_insn *insn)
     for (reg = (iter == 0 ? id->regs : static_id->hard_regs);
 	 reg != NULL;
 	 reg = reg->next)
-      if (reg->type == OP_IN && reg->regno <= FIRST_PSEUDO_REGISTER
+      if (reg->type == OP_IN && reg->regno < FIRST_PSEUDO_REGISTER
 	  && TEST_HARD_REG_BIT (call_used_reg_set, reg->regno))
 	return true;
   return false;
-- 
2.18.0

             reply	other threads:[~2018-07-23  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23  9:14 Ilya Leoshkevich [this message]
2018-07-27 15:36 ` Vladimir Makarov
2018-08-02 22:40   ` 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=20180723091424.5040-1-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jasonwucj@gcc.gnu.org \
    --cc=krebbel@linux.ibm.com \
    --cc=vmakarov@redhat.com \
    --cc=zadeck@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).