016-08-04 Bernd Edlinger <bernd.edlinger@hotmail.de>
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 4 Aug 2016 13:23:36 +0000 (13:23 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Thu, 4 Aug 2016 13:23:36 +0000 (13:23 +0000)
        PR rtl-optimization/71779
        * emit-rtl.c (set_reg_attrs_from_value): Only propagate REG_POINTER,
        if the value was sign-extended according to POINTERS_EXTEND_UNSIGNED
        or if it was truncated.

From-SVN: r239123

gcc/ChangeLog
gcc/emit-rtl.c

index 6c41321c47a26e1298a01c0b6170ca8d8526260f..551019e7f3c47148c392091d5d3465bdc2294ab9 100644 (file)
@@ -1,5 +1,10 @@
 2016-08-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
+       PR rtl-optimization/71779
+       * emit-rtl.c (set_reg_attrs_from_value): Only propagate REG_POINTER,
+       if the value was sign-extended according to POINTERS_EXTEND_UNSIGNED
+       or if it was truncated.
+
        PR rtl-optimization/70903
        * cse.c (cse_insn): If DEST is a paradoxical SUBREG, don't record DEST.
 
index 055cee9e7a02fe255e8b09781f0aee4ce158b81f..99f052d22d7f0100dbd7fef605776b28d1ef9f2c 100644 (file)
@@ -1156,7 +1156,11 @@ set_reg_attrs_from_value (rtx reg, rtx x)
     {
 #if defined(POINTERS_EXTEND_UNSIGNED)
       if (((GET_CODE (x) == SIGN_EXTEND && POINTERS_EXTEND_UNSIGNED)
-          || (GET_CODE (x) != SIGN_EXTEND && ! POINTERS_EXTEND_UNSIGNED))
+          || (GET_CODE (x) == ZERO_EXTEND && ! POINTERS_EXTEND_UNSIGNED)
+          || (paradoxical_subreg_p (x)
+              && ! (SUBREG_PROMOTED_VAR_P (x)
+                    && SUBREG_CHECK_PROMOTED_SIGN (x,
+                                                   POINTERS_EXTEND_UNSIGNED))))
          && !targetm.have_ptr_extend ())
        can_be_reg_pointer = false;
 #endif