aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-remat.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2014-12-18 20:49:44 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2014-12-18 20:49:44 +0000
commit32b38e8972c738b4c8d0bd701d30c0c7daa30dbe (patch)
tree20525ea20c15df06786c4027bb588dff9b59f300 /gcc/lra-remat.c
parent6e4992ca7811bcb1d3ebe587d06e346c09d72cc1 (diff)
downloadgcc-32b38e8972c738b4c8d0bd701d30c0c7daa30dbe.zip
gcc-32b38e8972c738b4c8d0bd701d30c0c7daa30dbe.tar.gz
gcc-32b38e8972c738b4c8d0bd701d30c0c7daa30dbe.tar.bz2
re PR rtl-optimization/64291 (Miscompile t-div in GMP's testsuite)
2014-12-18 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/64291 * lra-remat.c (bad_for_rematerialization_p): Add UNPSEC_VLOATILE. (create_cands): Process only output reload insn with potential cands. 2014-12-18 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/64291 * testsuite/gcc.target/i386/pr64291-[12].c: New tests. From-SVN: r218874
Diffstat (limited to 'gcc/lra-remat.c')
-rw-r--r--gcc/lra-remat.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index 3b8a806..95ed015 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -350,12 +350,12 @@ finish_cand_table (void)
-/* Return true if X contains memory or UNSPEC. We can not just check
- insn operands as memory or unspec might be not an operand itself
- but contain an operand. Insn with memory access is not profitable
- for rematerialization. Rematerialization of UNSPEC might result in
- wrong code generation as the UNPEC effect is unknown
- (e.g. generating a label). */
+/* Return true if X contains memory or some UNSPEC. We can not just
+ check insn operands as memory or unspec might be not an operand
+ itself but contain an operand. Insn with memory access is not
+ profitable for rematerialization. Rematerialization of UNSPEC
+ might result in wrong code generation as the UNPEC effect is
+ unknown (e.g. generating a label). */
static bool
bad_for_rematerialization_p (rtx x)
{
@@ -363,7 +363,7 @@ bad_for_rematerialization_p (rtx x)
const char *fmt;
enum rtx_code code;
- if (MEM_P (x) || GET_CODE (x) == UNSPEC)
+ if (MEM_P (x) || GET_CODE (x) == UNSPEC || GET_CODE (x) == UNSPEC_VOLATILE)
return true;
code = GET_CODE (x);
fmt = GET_RTX_FORMAT (code);
@@ -406,7 +406,7 @@ operand_to_remat (rtx_insn *insn)
if (reg->regno == STACK_POINTER_REGNUM && frame_pointer_needed)
return -1;
else if (reg->type == OP_OUT && ! reg->subreg_p
- && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
+ && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
{
/* We permits only one spilled reg. */
if (found_reg != NULL)
@@ -508,11 +508,14 @@ create_cands (void)
if ((set = single_set (insn)) != NULL
&& REG_P (SET_SRC (set)) && REG_P (SET_DEST (set))
- && (src_regno = REGNO (SET_SRC (set))) >= FIRST_PSEUDO_REGISTER
+ && ((src_regno = REGNO (SET_SRC (set)))
+ >= lra_constraint_new_regno_start)
&& (dst_regno = REGNO (SET_DEST (set))) >= FIRST_PSEUDO_REGISTER
&& reg_renumber[dst_regno] < 0
&& (insn2 = regno_potential_cand[src_regno].insn) != NULL
&& BLOCK_FOR_INSN (insn2) == BLOCK_FOR_INSN (insn))
+ /* It is an output reload insn after insn can be
+ rematerialized (potential candidate). */
create_cand (insn2, regno_potential_cand[src_regno].nop, dst_regno);
if (nop < 0)
goto fail;