From d6f2373894eeb4fdf52141d9c94bba7c5c884d43 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 21 Jul 2011 10:13:27 +0000 Subject: [PATCH] regcprop.c (maybe_mode_change): Check HARD_REGNO_MODE_OK. gcc/ * regcprop.c (maybe_mode_change): Check HARD_REGNO_MODE_OK. From-SVN: r176558 --- gcc/ChangeLog | 4 ++++ gcc/regcprop.c | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2f3578696b9..cf575372d1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2011-07-21 Richard Sandiford + + * regcprop.c (maybe_mode_change): Check HARD_REGNO_MODE_OK. + 2011-07-21 Kai Tietz * tree-ssa-propagate.c (substitute_and_fold): Use diff --git a/gcc/regcprop.c b/gcc/regcprop.c index 911f59eb083..aca005d7afd 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -418,10 +418,9 @@ maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode, offset = ((WORDS_BIG_ENDIAN ? wordoffset : 0) + (BYTES_BIG_ENDIAN ? byteoffset : 0)); - return gen_rtx_raw_REG (new_mode, - regno + subreg_regno_offset (regno, orig_mode, - offset, - new_mode)); + regno += subreg_regno_offset (regno, orig_mode, offset, new_mode); + if (HARD_REGNO_MODE_OK (regno, new_mode)) + return gen_rtx_raw_REG (new_mode, regno); } return NULL_RTX; } -- 2.30.2