+2019-02-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2019-02-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/89253
+ * tree-ssa-loop-split.c (tree_ssa_split_loops): Check we can
+ duplicate the loop.
+
+ 2019-02-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/89223
+ * tree-data-ref.c (initialize_matrix_A): Fail if constant
+ doesn't fit in HWI.
+ (analyze_subscript_affine_affine): Handle failure from
+ initialize_matrix_A.
+
+ 2019-01-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/88739
+ * tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid generating
+ BIT_FIELD_REFs of non-mode-precision integral operands.
+
2019-03-26 Richard Biener <rguenther@suse.de>
Backport from mainline
+2019-02-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2019-02-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/89253
+ * gfortran.dg/pr89253.f: New testcase.
+
+ 2019-02-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/89223
+ * gcc.dg/torture/pr89223.c: New testcase.
+
+ 2019-01-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/88739
+ * gcc.c-torture/execute/pr88739.c: New test.
+
2019-03-26 Richard Biener <rguenther@suse.de>
Backport from mainline
--- /dev/null
+/* PR tree-optimization/88739 */
+#if __SIZEOF_SHORT__ == 2 && __SIZEOF_INT__ == 4 && __CHAR_BIT__ == 8
+struct A
+{
+ unsigned int a, b, c;
+ unsigned int d : 30;
+ unsigned int e : 2;
+};
+
+union U
+{
+ struct A f;
+ unsigned int g[4];
+ unsigned short h[8];
+ unsigned char i[16];
+};
+volatile union U v = { .f.d = 0x4089 };
+
+__attribute__((noipa)) void
+bar (int x)
+{
+ static int i;
+ switch (i++)
+ {
+ case 0: if (x != v.f.d) __builtin_abort (); break;
+ case 1: if (x != v.f.e) __builtin_abort (); break;
+ case 2: if (x != v.g[3]) __builtin_abort (); break;
+ case 3: if (x != v.h[6]) __builtin_abort (); break;
+ case 4: if (x != v.h[7]) __builtin_abort (); break;
+ default: __builtin_abort (); break;
+ }
+}
+
+void
+foo (unsigned int x)
+{
+ union U u;
+ u.f.d = x >> 2;
+ u.f.e = 0;
+ bar (u.f.d);
+ bar (u.f.e);
+ bar (u.g[3]);
+ bar (u.h[6]);
+ bar (u.h[7]);
+}
+
+int
+main ()
+{
+ foo (0x10224);
+ return 0;
+}
+#else
+int
+main ()
+{
+ return 0;
+}
+#endif
--- /dev/null
+/* { dg-do compile { target int128 } } */
+
+int a[5];
+unsigned __int128 b;
+void c()
+{
+ b = 4;
+ for (;; b--)
+ a[b] = ({ a[b + b]; });
+}
--- /dev/null
+! { dg-do compile }
+! { dg-additional-options "-fsplit-loops -fno-tree-dominator-opts -std=legacy -w" }
+ program jr
+ integer :: w5, pg, zh
+ w5 = 0
+ write (w5)
+ assign 0002 to w5
+ do pg = 1, 3
+ if (pg .eq. 1) then
+ do zh = 1, pg
+ end do
+ else
+ goto w5
+ 0001 zh = 0
+ 0002 zh = 0
+ assign 0001 to w5
+ endif
+ end do
+ end
switch (TREE_CODE (chrec))
{
case POLYNOMIAL_CHREC:
+ if (!cst_and_fits_in_hwi (CHREC_RIGHT (chrec)))
+ return chrec_dont_know;
A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec));
return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult);
tree *last_conflicts)
{
unsigned nb_vars_a, nb_vars_b, dim;
- HOST_WIDE_INT init_a, init_b, gamma, gcd_alpha_beta;
+ HOST_WIDE_INT gamma, gcd_alpha_beta;
lambda_matrix A, U, S;
struct obstack scratch_obstack;
A = lambda_matrix_new (dim, 1, &scratch_obstack);
S = lambda_matrix_new (dim, 1, &scratch_obstack);
- init_a = int_cst_value (initialize_matrix_A (A, chrec_a, 0, 1));
- init_b = int_cst_value (initialize_matrix_A (A, chrec_b, nb_vars_a, -1));
- gamma = init_b - init_a;
+ tree init_a = initialize_matrix_A (A, chrec_a, 0, 1);
+ tree init_b = initialize_matrix_A (A, chrec_b, nb_vars_a, -1);
+ if (init_a == chrec_dont_know
+ || init_b == chrec_dont_know)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "affine-affine test failed: "
+ "representation issue.\n");
+ *overlaps_a = conflict_fn_not_known ();
+ *overlaps_b = conflict_fn_not_known ();
+ *last_conflicts = chrec_dont_know;
+ goto end_analyze_subs_aa;
+ }
+ gamma = int_cst_value (init_b) - int_cst_value (init_a);
/* Don't do all the hard work of solving the Diophantine equation
when we already know the solution: for example,
false, true)
&& niter.cmp != ERROR_MARK
/* We can't yet handle loops controlled by a != predicate. */
- && niter.cmp != NE_EXPR)
+ && niter.cmp != NE_EXPR
+ && can_duplicate_loop_p (loop))
{
if (split_loop (loop, &niter))
{
base2 = get_ref_base_and_extent (gimple_assign_lhs (def_stmt),
&offset2, &size2, &maxsize2,
&reverse);
+ tree def_rhs = gimple_assign_rhs1 (def_stmt);
if (!reverse
&& maxsize2 != -1
&& maxsize2 == size2
according to endianness. */
&& (! INTEGRAL_TYPE_P (vr->type)
|| ref->size == TYPE_PRECISION (vr->type))
- && ref->size % BITS_PER_UNIT == 0)
+ && ref->size % BITS_PER_UNIT == 0
+ && (! INTEGRAL_TYPE_P (TREE_TYPE (def_rhs))
+ || (TYPE_PRECISION (TREE_TYPE (def_rhs))
+ == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (def_rhs))))))
{
code_helper rcode = BIT_FIELD_REF;
tree ops[3];
- ops[0] = SSA_VAL (gimple_assign_rhs1 (def_stmt));
+ ops[0] = SSA_VAL (def_rhs);
ops[1] = bitsize_int (ref->size);
ops[2] = bitsize_int (offset - offset2);
tree val = vn_nary_build_or_lookup (rcode, vr->type, ops);