The following patch fixes
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65648
The patch was bootstrapped and tested on x86-64.
I am lost to produce a test for the PR which can work on all arm
sub-targets and have no sub-target hardware to test it.
Therefore the patch does not contain the test. It would be nice if
somebody knowing arm well add a test for the PR.
Committed as rev. 221901.
2015-04-07 Vladimir Makarov <vmaka...@redhat.com>
PR target/65678
* lra-remat.c (do_remat): Process input and non-input insn
registers separately.
Index: lra-remat.c
===================================================================
--- lra-remat.c (revision 221867)
+++ lra-remat.c (working copy)
@@ -1234,22 +1234,25 @@ do_remat (void)
for (i = 0; i < nregs; i++)
CLEAR_HARD_REG_BIT (live_hard_regs, hard_regno + i);
}
- else if (reg->type != OP_IN
- && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
+ /* Process also hard regs (e.g. CC register) which are part
+ of insn definition. */
+ for (reg = static_id->hard_regs; reg != NULL; reg = reg->next)
+ if (reg->type == OP_IN
+ && find_regno_note (insn, REG_DEAD, reg->regno) != NULL)
+ CLEAR_HARD_REG_BIT (live_hard_regs, reg->regno);
+ /* Inputs have been processed, now process outputs. */
+ for (reg = id->regs; reg != NULL; reg = reg->next)
+ if (reg->type != OP_IN
+ && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
{
if ((hard_regno = get_hard_regs (reg, nregs)) < 0)
continue;
for (i = 0; i < nregs; i++)
SET_HARD_REG_BIT (live_hard_regs, hard_regno + i);
}
- /* Process also hard regs (e.g. CC register) which are part
- of insn definition. */
for (reg = static_id->hard_regs; reg != NULL; reg = reg->next)
- if (reg->type == OP_IN
- && find_regno_note (insn, REG_DEAD, reg->regno) != NULL)
- CLEAR_HARD_REG_BIT (live_hard_regs, reg->regno);
- else if (reg->type != OP_IN
- && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
+ if (reg->type != OP_IN
+ && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
SET_HARD_REG_BIT (live_hard_regs, reg->regno);
}
}