aboutsummaryrefslogtreecommitdiff
path: root/gcc/ree.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-11-24 05:11:15 +0000
committerJeff Law <law@gcc.gnu.org>2015-11-23 22:11:15 -0700
commitd2c9e8ed7ae8cde8e64405eb130c9d7d99c68856 (patch)
tree958a7726dbd4cf9f21958bf40ac585273d135e56 /gcc/ree.c
parent267c9702f6223ed5b9694b8ba746ca7b344ec1ac (diff)
downloadgcc-d2c9e8ed7ae8cde8e64405eb130c9d7d99c68856.zip
gcc-d2c9e8ed7ae8cde8e64405eb130c9d7d99c68856.tar.gz
gcc-d2c9e8ed7ae8cde8e64405eb130c9d7d99c68856.tar.bz2
[PATCH] Fix invalid redundant extension elimination for rl78 port
* ree.c (add_removable_extension): Avoid mis-optimizing cases where the source/dest of the target extension require a different number of hard registers. (combine_set_extension): Remove #if 0 code. Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r230785
Diffstat (limited to 'gcc/ree.c')
-rw-r--r--gcc/ree.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/ree.c b/gcc/ree.c
index b8436f2..f3b79e0 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -332,16 +332,6 @@ combine_set_extension (ext_cand *cand, rtx_insn *curr_insn, rtx *orig_set)
else
new_reg = gen_rtx_REG (cand->mode, REGNO (SET_DEST (*orig_set)));
-#if 0
- /* Rethinking test. Temporarily disabled. */
- /* We're going to be widening the result of DEF_INSN, ensure that doing so
- doesn't change the number of hard registers needed for the result. */
- if (HARD_REGNO_NREGS (REGNO (new_reg), cand->mode)
- != HARD_REGNO_NREGS (REGNO (SET_DEST (*orig_set)),
- GET_MODE (SET_DEST (*orig_set))))
- return false;
-#endif
-
/* Merge constants by directly moving the constant into the register under
some conditions. Recall that RTL constants are sign-extended. */
if (GET_CODE (orig_src) == CONST_INT
@@ -1080,6 +1070,18 @@ add_removable_extension (const_rtx expr, rtx_insn *insn,
}
}
+ /* Fourth, if the extended version occupies more registers than the
+ original and the source of the extension is the same hard register
+ as the destination of the extension, then we can not eliminate
+ the extension without deep analysis, so just punt.
+
+ We allow this when the registers are different because the
+ code in combine_reaching_defs will handle that case correctly. */
+ if ((HARD_REGNO_NREGS (REGNO (dest), mode)
+ != HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg)))
+ && REGNO (dest) == REGNO (reg))
+ return;
+
/* Then add the candidate to the list and insert the reaching definitions
into the definition map. */
ext_cand e = {expr, code, mode, insn};