This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 3/5] Use simplify_subreg_regno in combine.c:subst
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 18 Sep 2014 11:13:09 +0100
- Subject: [PATCH 3/5] Use simplify_subreg_regno in combine.c:subst
- Authentication-results: sourceware.org; auth=none
- References: <87ppetnsxd dot fsf at e105548-lin dot cambridge dot arm dot com>
combine.c:subst should refuse to substitute a hard register
into a subreg if the new subreg would not be simplified to a
simple hard register, since the result would have to be reloaded.
This is more for optimisation than correctness, since in theory
the RA should be able to fix up any unsimplified subregs.
gcc/
* combine.c (subst): Use simplify_subreg_regno rather than
REG_CANNOT_CHANGE_MODE_P to detect invalid mode changes.
Index: gcc/combine.c
===================================================================
--- gcc/combine.c 2014-09-15 10:00:17.545330404 +0100
+++ gcc/combine.c 2014-09-15 10:00:17.545330404 +0100
@@ -5121,15 +5121,13 @@ #define COMBINE_RTX_EQUAL_P(X,Y) \
)
return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
-#ifdef CANNOT_CHANGE_MODE_CLASS
if (code == SUBREG
&& REG_P (to)
&& REGNO (to) < FIRST_PSEUDO_REGISTER
- && REG_CANNOT_CHANGE_MODE_P (REGNO (to),
- GET_MODE (to),
- GET_MODE (x)))
+ && simplify_subreg_regno (REGNO (to), GET_MODE (to),
+ SUBREG_BYTE (x),
+ GET_MODE (x)) < 0)
return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
-#endif
new_rtx = (unique_copy && n_occurrences ? copy_rtx (to) : to);
n_occurrences++;