From 049b866d3c110f152f8b11c6de30d88e299fa474 Mon Sep 17 00:00:00 2001 From: Sebastian Perta Date: Mon, 22 Jan 2018 13:53:48 +0000 Subject: [PATCH] rl78.c (rl78_note_reg_set): fixed dead reg check for non-QImode registers 2018-01-12 Sebastian Perta * config/rl78/rl78.c (rl78_note_reg_set): fixed dead reg check for non-QImode registers From-SVN: r256945 --- gcc/ChangeLog | 5 +++++ gcc/config/rl78/rl78.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bba9f63c11f..17f22767582 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-01-22 Sebastian Perta + + * config/rl78/rl78.c (rl78_note_reg_set): fixed dead reg check + for non-QImode registers + 2018-01-22 Richard Biener PR tree-optimization/83963 diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c index efa4b391058..3e34a88f0b7 100644 --- a/gcc/config/rl78/rl78.c +++ b/gcc/config/rl78/rl78.c @@ -3792,16 +3792,21 @@ static void rl78_note_reg_set (char *dead, rtx d, rtx insn) { int r, i; - + bool is_dead; if (GET_CODE (d) == MEM) rl78_note_reg_uses (dead, XEXP (d, 0), insn); if (GET_CODE (d) != REG) return; + /* Do not mark the reg unused unless all QImode parts of it are dead. */ r = REGNO (d); - if (dead [r]) - add_reg_note (insn, REG_UNUSED, gen_rtx_REG (GET_MODE (d), r)); + is_dead = true; + for (i = 0; i < GET_MODE_SIZE (GET_MODE (d)); i ++) + if (!dead [r + i]) + is_dead = false; + if(is_dead) + add_reg_note (insn, REG_UNUSED, gen_rtx_REG (GET_MODE (d), r)); if (dump_file) fprintf (dump_file, "note set reg %d size %d\n", r, GET_MODE_SIZE (GET_MODE (d))); for (i = 0; i < GET_MODE_SIZE (GET_MODE (d)); i ++) -- 2.30.2