This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix hard regno checks
- From: Ilya Leoshkevich <iii at linux dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: krebbel at linux dot ibm dot com, jasonwucj at gcc dot gnu dot org, zadeck at gcc dot gnu dot org, jakub at redhat dot com, vmakarov at redhat dot com, Ilya Leoshkevich <iii at linux dot ibm dot com>
- Date: Mon, 23 Jul 2018 11:14:24 +0200
- Subject: [PATCH] Fix hard regno checks
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