+2014-09-12 Wilco Dijkstra <wilco.dijkstra@arm.com>
+
+ * gcc/ree.c (combine_reaching_defs): Ensure inserted copy don't change
+ the number of hard registers.
+
2014-09-12 Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Anna Tikhonova <anna.tikhonova@intel.com>
if (!SCALAR_INT_MODE_P (GET_MODE (SET_DEST (PATTERN (cand->insn)))))
return false;
+ enum machine_mode dst_mode = GET_MODE (SET_DEST (PATTERN (cand->insn)));
+ rtx src_reg = get_extended_src_reg (SET_SRC (PATTERN (cand->insn)));
+
+ /* Ensure the number of hard registers of the copy match. */
+ if (HARD_REGNO_NREGS (REGNO (src_reg), dst_mode)
+ != HARD_REGNO_NREGS (REGNO (src_reg), GET_MODE (src_reg)))
+ return false;
+
/* There's only one reaching def. */
rtx_insn *def_insn = state->defs_list[0];
start_sequence ();
rtx pat = PATTERN (cand->insn);
rtx new_dst = gen_rtx_REG (GET_MODE (SET_DEST (pat)),
- REGNO (XEXP (SET_SRC (pat), 0)));
+ REGNO (get_extended_src_reg (SET_SRC (pat))));
rtx new_src = gen_rtx_REG (GET_MODE (SET_DEST (pat)),
REGNO (SET_DEST (pat)));
emit_move_insn (new_dst, new_src);