]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport PRs 89677, 90071, 90194, 90213, 90474, 90637, 90930
authorRichard Biener <rguenther@suse.de>
Fri, 30 Aug 2019 16:44:17 +0000 (16:44 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 30 Aug 2019 16:44:17 +0000 (16:44 +0000)
2019-08-30  Richard Biener  <rguenther@suse.de>

Backport from mainline
2019-05-27  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90637
* tree-ssa-sink.c (statement_sink_location): Honor the
computed sink location for single-uses.

* gcc.dg/gomp/pr90637.c: New testcase.

2019-06-21  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90930
* tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Set visited
flag on new stmts to avoid re-processing them.

2019-05-15  Richard Biener  <rguenther@suse.de>

PR c/90474
* c-common.c (c_common_mark_addressable_vec): Also mark
a COMPOUND_LITERAL_EXPR_DECL addressable similar to
c_mark_addressable.

2019-04-25  Richard Biener  <rguenther@suse.de>

PR middle-end/90194
* match.pd: Add pattern to simplify view-conversion of an
empty constructor.

* g++.dg/torture/pr90194.C: New testcase.

2019-04-24  Richard Biener  <rguenther@suse.de>

PR middle-end/90213
* gimple-fold.c (fold_const_aggregate_ref_1): Do multiplication
by size and BITS_PER_UNIT on poly-wide-ints.

2019-04-15  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90071
* tree-ssa-reassoc.c (init_range_entry): Do not pick up
abnormal operands from def stmts.

* gcc.dg/torture/pr90071.c: New testcase.

2019-03-13  Richard Biener  <rguenther@suse.de>

PR middle-end/89677
* tree-scalar-evolution.c (simplify_peeled_chrec): Do not
throw FP expressions at tree-affine.

* gcc.dg/torture/pr89677.c: New testcase.

From-SVN: r275208

12 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/gimple-fold.c
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr90194.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr89677.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr90071.c [new file with mode: 0644]
gcc/tree-scalar-evolution.c
gcc/tree-ssa-reassoc.c
gcc/tree-ssa-sink.c

index ec53c7969f7c1267ea3f7c95221f349214e23b50..a4610414723cc3dc2edeb1e6f3bc504d9d9f2586 100644 (file)
@@ -1,3 +1,44 @@
+2019-08-30  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-05-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90637
+       * tree-ssa-sink.c (statement_sink_location): Honor the
+       computed sink location for single-uses.
+
+       * gcc.dg/gomp/pr90637.c: New testcase.
+
+       2019-06-21  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90930
+       * tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Set visited
+       flag on new stmts to avoid re-processing them.
+
+       2019-04-25  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/90194
+       * match.pd: Add pattern to simplify view-conversion of an
+       empty constructor.
+
+       2019-04-24  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/90213
+       * gimple-fold.c (fold_const_aggregate_ref_1): Do multiplication
+       by size and BITS_PER_UNIT on poly-wide-ints.
+
+       2019-04-15  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90071
+       * tree-ssa-reassoc.c (init_range_entry): Do not pick up
+       abnormal operands from def stmts.
+
+       2019-03-13  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/89677
+       * tree-scalar-evolution.c (simplify_peeled_chrec): Do not
+       throw FP expressions at tree-affine.
+
 2019-08-30  Segher Boessenkool  <segher@kernel.crashing.org>
 
        Backport from trunk
index 5d5a8e5d479c779795c60e0df0686cdd5f234d86..8c77a6ab9007dd344a4226bbdc0c22d37523d1c4 100644 (file)
@@ -1,3 +1,13 @@
+2019-08-30  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-05-15  Richard Biener  <rguenther@suse.de>
+
+       PR c/90474
+       * c-common.c (c_common_mark_addressable_vec): Also mark
+       a COMPOUND_LITERAL_EXPR_DECL addressable similar to
+       c_mark_addressable.
+
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
index 45be4bd1cbe3217a4f555d8fff57478f3df53bfb..c3fb3b671cb7b6493b3e6f6a52a07ee5706e37cb 100644 (file)
@@ -6529,6 +6529,8 @@ c_common_mark_addressable_vec (tree t)
     return;
   if (!VAR_P (t) || !DECL_HARD_REGISTER (t))
     TREE_ADDRESSABLE (t) = 1;
+  if (TREE_CODE (t) == COMPOUND_LITERAL_EXPR)
+    TREE_ADDRESSABLE (COMPOUND_LITERAL_EXPR_DECL (t)) = 1;
 }
 
 
index 4325aaeb3c9b01e5fc330cb3088f0c40320333de..25b407497158226e4c5bece96e5b81c37854fd8c 100644 (file)
@@ -6318,14 +6318,11 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree))
                = wi::sext (wi::to_offset (idx) - wi::to_offset (low_bound),
                            TYPE_PRECISION (TREE_TYPE (idx)));
 
+             woffset *= tree_to_uhwi (unit_size);
+             woffset *= BITS_PER_UNIT;
              if (wi::fits_shwi_p (woffset))
                {
                  offset = woffset.to_shwi ();
-                 /* TODO: This code seems wrong, multiply then check
-                    to see if it fits.  */
-                 offset *= tree_to_uhwi (unit_size);
-                 offset *= BITS_PER_UNIT;
-
                  base = TREE_OPERAND (t, 0);
                  ctor = get_base_constructor (base, &offset, valueize);
                  /* Empty constructor.  Always fold to 0.  */
index e405d9e84e9068de3aed424b16935439329ff1bb..59ac91cc785da5e608921026cf973b411befbdda 100644 (file)
@@ -1753,6 +1753,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        && (TYPE_SIZE (TREE_TYPE (@0)) == TYPE_SIZE (TREE_TYPE (@1))))
    (view_convert @1)))
 
+/* Simplify a view-converted empty constructor.  */
+(simplify
+  (view_convert CONSTRUCTOR@0)
+  (if (TREE_CODE (@0) != SSA_NAME
+       && CONSTRUCTOR_NELTS (@0) == 0)
+   { build_zero_cst (type); }))
+
 /* Re-association barriers around constants and other re-association
    barriers can be removed.  */
 (simplify
index e4634e13ed371a285ae538778f528416df42bb84..1ec666b6c850fa69fa5de6c53fda82a2e50ea8ed 100644 (file)
@@ -1,3 +1,21 @@
+2019-08-30  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-04-25  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/90194
+       * g++.dg/torture/pr90194.C: New testcase.
+
+       2019-04-15  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90071
+       * gcc.dg/torture/pr90071.c: New testcase.
+
+       2019-03-13  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/89677
+       * gcc.dg/torture/pr89677.c: New testcase.
+
 2019-08-30  Segher Boessenkool  <segher@kernel.crashing.org>
 
        Backport from trunk
diff --git a/gcc/testsuite/g++.dg/torture/pr90194.C b/gcc/testsuite/g++.dg/torture/pr90194.C
new file mode 100644 (file)
index 0000000..f0c3a77
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-additional-options "-g" }
+
+struct cb {
+    int yr;
+};
+
+void *
+operator new (__SIZE_TYPE__, void *nq)
+{
+  return nq;
+}
+
+void
+af (int xn)
+{
+  new (&xn) cb { };
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr89677.c b/gcc/testsuite/gcc.dg/torture/pr89677.c
new file mode 100644 (file)
index 0000000..a45ca1f
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int32plus } */
+
+int a, b, d;
+unsigned c;
+float e, f, g;
+void h() {
+    float *i = &g;
+    for (; c < 10; c += 3)
+      for (; d; d += 3) {
+         a = *i;
+         g = f + 0;
+         f = b + *i + (b - e + 305219) + -b + 3;
+      }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr90071.c b/gcc/testsuite/gcc.dg/torture/pr90071.c
new file mode 100644 (file)
index 0000000..bfa7239
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+int a;
+static int b;
+
+void
+foo ()
+{
+  int d;
+  int e = (int) (__INTPTR_TYPE__) &&f;
+  void *g = &&h;
+h: ++e;
+   if (a)
+     i: goto *g;
+   for (;;)
+     {
+       e = 0;
+       if (b)
+        goto i;
+     }
+f:
+   goto *({ d || e < 0 || e >= 2; });
+   &e;
+}
index 790050a20c9ba2d52aa1c6ab61afe31b065a8498..95ad137b02ac3af61e0cbbf7e16c4990e79dc779 100644 (file)
@@ -1413,6 +1413,11 @@ simplify_peeled_chrec (struct loop *loop, tree arg, tree init_cond)
       return build_polynomial_chrec (loop->num, init_cond, right);
     }
 
+  /* The affine code only deals with pointer and integer types.  */
+  if (!POINTER_TYPE_P (type)
+      && !INTEGRAL_TYPE_P (type))
+    return chrec_dont_know;
+
   /* Try harder to check if they are equal.  */
   tree_to_aff_combination_expand (left, type, &aff1, &peeled_chrec_map);
   tree_to_aff_combination_expand (step_val, type, &aff2, &peeled_chrec_map);
index b4f13ef75c4da48072588f61f36f177f1141151d..0b31de324d26e713485fb61473b49c15c8a6fd23 100644 (file)
@@ -2140,7 +2140,8 @@ init_range_entry (struct range_entry *r, tree exp, gimple *stmt)
          exp_type = boolean_type_node;
        }
 
-      if (TREE_CODE (arg0) != SSA_NAME)
+      if (TREE_CODE (arg0) != SSA_NAME
+         || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (arg0))
        break;
       loc = gimple_location (stmt);
       switch (code)
@@ -4593,6 +4594,7 @@ rewrite_expr_tree_parallel (gassign *stmt, int width,
       else
        {
          stmts[i] = build_and_add_sum (TREE_TYPE (last_rhs1), op1, op2, opcode);
+         gimple_set_visited (stmts[i], true);
        }
       if (dump_file && (dump_flags & TDF_DETAILS))
        {
index 7a9fcde4f9421cbc12f2c7c99812a5da5688ce7e..ce591327c81658e7d6369a5a2f19436bb9ca95fc 100644 (file)
@@ -431,7 +431,10 @@ statement_sink_location (gimple *stmt, basic_block frombb,
          if (sinkbb == frombb)
            return false;
 
-         *togsi = gsi_for_stmt (use);
+         if (sinkbb == gimple_bb (use))
+           *togsi = gsi_for_stmt (use);
+         else
+           *togsi = gsi_after_labels (sinkbb);
 
          return true;
        }