127 lines
4.5 KiB
Diff
127 lines
4.5 KiB
Diff
From 900ccfa89dda3ab5f7e44a0dd4d1e9d108b5dc8b Mon Sep 17 00:00:00 2001
|
|
From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
|
|
Date: Tue, 26 Mar 2019 13:18:23 +0000
|
|
Subject: [PATCH] 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.
|
|
|
|
* 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: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@269942 138bc75d-0d04-0410-961f-82ee72b054a4
|
|
---
|
|
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
|
|
index 2480f4e..a349e3e 100644
|
|
--- a/gcc/tree-data-ref.c
|
|
+++ b/gcc/tree-data-ref.c
|
|
@@ -2118,6 +2118,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);
|
|
|
|
@@ -2499,7 +2501,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;
|
|
|
|
@@ -2536,9 +2538,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 fd97213..3992597 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 c93f1f2..a2e3ce2 100644
|
|
--- a/gcc/tree-ssa-sccvn.c
|
|
+++ b/gcc/tree-ssa-sccvn.c
|
|
@@ -2029,6 +2029,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
|
|
&& maxsize2 != -1
|
|
&& maxsize2 == size2
|
|
@@ -2041,11 +2042,14 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
|
|
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);
|
|
--
|
|
2.9.3
|