diff mbox

[3/5] Use simplify_subreg_regno in combine.c:subst

Message ID 87d2atnsne.fsf@e105548-lin.cambridge.arm.com
State New
Headers show

Commit Message

Richard Sandiford Sept. 18, 2014, 10:13 a.m. UTC
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.

Comments

Jeff Law Sept. 19, 2014, 6:17 a.m. UTC | #1
On 09/18/14 04:13, Richard Sandiford wrote:
> 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.
OK independent of other changes.

jeff
diff mbox

Patch

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++;