diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-02-13 10:02:47 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-02-13 10:02:47 +0000 |
commit | 1c442c53a8b1053ac20ddcd4c6aa5cec233c8a03 (patch) | |
tree | 7d7d94afa32a0bd4b41f8a8ddd56d4f2ef38d262 | |
parent | 805eaf0ed4e28ecdcd825a9dc5b19f75fe5aaf9d (diff) |
2019-02-13 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.
* gfortran.dg/pr89253.f: New testcase.
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.
* gcc.dg/torture/pr89223.c: New testcase.
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.
* gcc.c-torture/execute/pr88739.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@268838 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 23 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr88739.c | 59 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr89223.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr89253.f | 19 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 21 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-split.c | 3 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 7 |
8 files changed, 153 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83d85a21f19..e4432454231 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,26 @@ +2019-02-13 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-02-12 Jan Hubicka <hubicka@ucw.cz> Backport from mainline: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 339f6528830..505657e7588 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2019-02-13 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-02-11 Stefan Agner <stefan@agner.ch> Backport from mainline diff --git a/gcc/testsuite/gcc.c-torture/execute/pr88739.c b/gcc/testsuite/gcc.c-torture/execute/pr88739.c new file mode 100644 index 00000000000..d4b32fbfc2d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr88739.c @@ -0,0 +1,59 @@ +/* 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 diff --git a/gcc/testsuite/gcc.dg/torture/pr89223.c b/gcc/testsuite/gcc.dg/torture/pr89223.c new file mode 100644 index 00000000000..1e828118ecb --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89223.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target int128 } } */ + +int a[5]; +unsigned __int128 b; +void c() +{ + b = 4; + for (;; b--) + a[b] = ({ a[b + b]; }); +} diff --git a/gcc/testsuite/gfortran.dg/pr89253.f b/gcc/testsuite/gfortran.dg/pr89253.f new file mode 100644 index 00000000000..6dc9df138fd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr89253.f @@ -0,0 +1,19 @@ +! { 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 diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 0917d6dff01..670d0de4465 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -3189,6 +3189,8 @@ initialize_matrix_A (lambda_matrix A, tree chrec, unsigned index, int mult) 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); @@ -3570,7 +3572,7 @@ analyze_subscript_affine_affine (tree chrec_a, 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; @@ -3607,9 +3609,20 @@ analyze_subscript_affine_affine (tree chrec_a, 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, diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index 12f6665ca40..238e0f580a4 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -649,7 +649,8 @@ tree_ssa_split_loops (void) 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)) { diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 34e460c6c6e..25a50ff4cab 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2079,6 +2079,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, 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 && known_size_p (maxsize2) && known_eq (maxsize2, size2) @@ -2090,11 +2091,13 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, according to endianness. */ && (! INTEGRAL_TYPE_P (vr->type) || known_eq (ref->size, TYPE_PRECISION (vr->type))) - && multiple_p (ref->size, BITS_PER_UNIT)) + && multiple_p (ref->size, BITS_PER_UNIT) + && (! INTEGRAL_TYPE_P (TREE_TYPE (def_rhs)) + || type_has_mode_precision_p (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); |