regcprop.c (maybe_mode_change): Check HARD_REGNO_MODE_OK.
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 21 Jul 2011 10:13:27 +0000 (10:13 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 21 Jul 2011 10:13:27 +0000 (10:13 +0000)
gcc/
* regcprop.c (maybe_mode_change): Check HARD_REGNO_MODE_OK.

From-SVN: r176558

gcc/ChangeLog
gcc/regcprop.c

index 2f3578696b9a64c395e2b72749cada25b68220fa..cf575372d1a767337df2c703df5a5969b8238880 100644 (file)
@@ -1,3 +1,7 @@
+2011-07-21  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * regcprop.c (maybe_mode_change): Check HARD_REGNO_MODE_OK.
+
 2011-07-21  Kai Tietz  <ktietz@redhat.com>
 
        * tree-ssa-propagate.c (substitute_and_fold): Use
index 911f59eb083224c0048e77ce5af4f2f3be9c7cfa..aca005d7afd9ad778d1e1d5b13a2e7ef93c071e7 100644 (file)
@@ -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;
 }