On 12/01/2015 12:32 PM, Richard Sandiford wrote:
Jeff Law <l...@redhat.com> writes:
@@ -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};
I might be wrong, but the check looks specific to little-endian. Would
it make sense to use reg_overlap_mentioned_p instead of the REGNO check?
Fixed thusly. Installed on the trunk after the usual testing on
x86_64-linux-gnu and verifying that rl78-elf doesn't botch pr42833.c.
Jeff
commit 362f406136207b89bddab99f5ff904b0798b7115
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Dec 16 20:34:31 2015 +0000
* ree.c (add_removable_extension): Use reg_overlap_mentioned_p
rather than testing hard register #s.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231719
138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1d2a994..a8475b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-16 Jeff Law <l...@redhat.com>
+
+ * ree.c (add_removable_extension): Use reg_overlap_mentioned_p
+ rather than testing hard register #s.
+
2015-12-16 Nathan Sidwell <nat...@acm.org>
* config/nvptx/nvptx.h (OUTGOING_STATIC_CHAIN_REGNUM): Remove.
diff --git a/gcc/ree.c b/gcc/ree.c
index 6cfc477..d12e24d 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -1085,7 +1085,7 @@ add_removable_extension (const_rtx expr, rtx_insn *insn,
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))
+ && reg_overlap_mentioned_p (dest, reg))
return;
/* Then add the candidate to the list and insert the reaching definitions