From e533e26c0afe3a117418acc65ccaae536f59f105 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Fri, 12 Sep 2014 09:29:16 +0000 Subject: [PATCH] [Ree] Ensure inserted copy don't change the number of hard registers 2014-09-12 Wilco Dijkstra gcc/ * ree.c (combine_reaching_defs): Ensure inserted copy don't change the number of hard registers. From-SVN: r215205 --- gcc/ChangeLog | 5 +++++ gcc/ree.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b70dd5e01f..4d43c393d30 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-12 Wilco Dijkstra + + * gcc/ree.c (combine_reaching_defs): Ensure inserted copy don't change + the number of hard registers. + 2014-09-12 Alexander Ivchenko Maxim Kuznetsov Anna Tikhonova diff --git a/gcc/ree.c b/gcc/ree.c index 1431b7a0a88..a58f114df83 100644 --- a/gcc/ree.c +++ b/gcc/ree.c @@ -743,6 +743,14 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state) 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]; @@ -792,7 +800,7 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state) 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); -- 2.30.2