2016-01-11 Jakub Jelinek <jakub@redhat.com>
+ PR target/69071
+ * lra-eliminations.c (move_plus_up): Only move plus up
+ if subreg of the constant can be simplified into constant
+ and use the simplified subreg of the constant instead of
+ the original constant.
+
* fold-const.c (fold_convertible_p): Don't return true
for conversion of VECTOR_TYPE to same sized integral type.
(fold_convert_loc): Fix up formatting. Fold conversion of
if (GET_CODE (x) == SUBREG && GET_CODE (subreg_reg) == PLUS
&& GET_MODE_SIZE (x_mode) <= GET_MODE_SIZE (subreg_reg_mode)
&& CONSTANT_P (XEXP (subreg_reg, 1)))
- return gen_rtx_PLUS (x_mode, lowpart_subreg (x_mode, subreg_reg,
- subreg_reg_mode),
- XEXP (subreg_reg, 1));
+ {
+ rtx cst = simplify_subreg (x_mode, XEXP (subreg_reg, 1), subreg_reg_mode,
+ subreg_lowpart_offset (x_mode,
+ subreg_reg_mode));
+ if (cst && CONSTANT_P (cst))
+ return gen_rtx_PLUS (x_mode, lowpart_subreg (x_mode, subreg_reg,
+ subreg_reg_mode), cst);
+ }
return x;
}
2016-01-11 Jakub Jelinek <jakub@redhat.com>
+ PR target/69071
+ * gcc.dg/pr69071.c: New test.
+
PR c++/69211
* g++.dg/opt/pr69211.C: New test.
--- /dev/null
+/* PR target/69071 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+void *bar (void *);
+
+void
+foo (int c)
+{
+ unsigned char bf[65400];
+ unsigned char *p2 = bar (bf);
+ unsigned char *p3 = bar (bf);
+ for (; *p2; p2++, c++)
+ {
+ if (c)
+ {
+ short of = p2 - bf - 6;
+ unsigned ofu = of;
+ __builtin_memcpy (p3, &ofu, sizeof (ofu));
+ }
+ }
+}