]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: [multiple changes]
authorRichard Biener <rguenther@suse.de>
Fri, 12 Feb 2016 14:04:29 +0000 (14:04 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 12 Feb 2016 14:04:29 +0000 (14:04 +0000)
2016-02-12  Richard Biener  <rguenther@suse.de>

Backport from mainline
2016-02-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/69715
* tree-ssa.c (execute_update_addresses_taken): Mark non-decl
LHS on calls as non-rewritable.

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

2016-02-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/69579
* tree-ssa-loop-ivcanon.c (propagate_constants_for_unrolling):
Do not propagate through abnormal PHI results.

* gcc.dg/setjmp-6.c: New testcase.

2016-02-01  Richard Biener  <rguenther@suse.de>

PR tree-optimization/69574
* tree-chrec.c (hide_evolution_in_other_loops_than_loop): Instead
of asserting return chrec_dont_know.

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

From-SVN: r233378

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/setjmp-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr69574.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr69715.c [new file with mode: 0644]
gcc/tree-chrec.c
gcc/tree-ssa-loop-ivcanon.c
gcc/tree-ssa.c

index 2c3133d1bdfa22a218aa83342132c1fa33dd4d2d..17c8a2485c7b700726853e1fc7a4859222f72322 100644 (file)
@@ -1,3 +1,24 @@
+2016-02-12  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2016-02-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69715
+       * tree-ssa.c (execute_update_addresses_taken): Mark non-decl
+       LHS on calls as non-rewritable.
+
+       2016-02-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69579
+       * tree-ssa-loop-ivcanon.c (propagate_constants_for_unrolling):
+       Do not propagate through abnormal PHI results.
+
+       2016-02-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69574
+       * tree-chrec.c (hide_evolution_in_other_loops_than_loop): Instead
+       of asserting return chrec_dont_know.
+
 2016-02-11  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index 9a7f198a98b4506538104ea131dc82639e2192f3..835010156d56fe25b4fb4800ec335d77e16bd195 100644 (file)
@@ -1,3 +1,21 @@
+2016-02-12  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2016-02-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69715
+       * gcc.dg/torture/pr69715.c: New testcase.
+
+       2016-02-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69579
+       * gcc.dg/setjmp-6.c: New testcase.
+
+       2016-02-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69574
+       * gcc.dg/torture/pr69574.c: New testcase.
+
 2016-02-11  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/setjmp-6.c b/gcc/testsuite/gcc.dg/setjmp-6.c
new file mode 100644 (file)
index 0000000..0781f05
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR69569 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include <setjmp.h>
+
+jmp_buf buf;
+
+struct str {
+    int Count;
+};
+int fun2(struct str *p1)
+{
+    int i = 1;
+    while (1) {
+       setjmp(buf);
+       break;
+    }
+    for (; i;) {
+       i = 0;
+       for (; i < (p1 ? p1->Count : 1); i++)
+         fun2(p1);
+    }
+    return 1;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr69574.c b/gcc/testsuite/gcc.dg/torture/pr69574.c
new file mode 100644 (file)
index 0000000..feaac24
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+typedef unsigned mytype;
+
+struct S {
+    mytype *pu;
+};
+
+mytype f(struct S *e)
+{
+  mytype x;
+  if(&x != e->pu)
+    __builtin_memcpy(&x, e->pu, sizeof(unsigned));
+  return x;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr69715.c b/gcc/testsuite/gcc.dg/torture/pr69715.c
new file mode 100644 (file)
index 0000000..cecc82c
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+struct __attribute__((may_alias)) S { long long low; int high; };
+struct S foo (void);
+long double
+bar (void)
+{
+  long double a;
+  *(struct S *)&a = foo ();
+  return a;
+}
index b9350f015e2c4b49845cfa8cb2350cef446fa5c4..c6c5015d7b91bc712cb0a20eb31e76ea179e655e 100644 (file)
@@ -730,12 +730,12 @@ hide_evolution_in_other_loops_than_loop (tree chrec,
        /* There is no evolution in this loop.  */
        return initial_condition (chrec);
 
+      else if (flow_loop_nested_p (loop, chloop))
+       return hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
+                                                       loop_num);
+
       else
-       {
-         gcc_assert (flow_loop_nested_p (loop, chloop));
-         return hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
-                                                         loop_num);
-       }
+       return chrec_dont_know;
 
     default:
       return chrec;
index b475b067bb5b206fe7c88c16ca6ac3a6f635fd55..00f26b8dd9156509be528f96c9f386eaba394cce 100644 (file)
@@ -1072,7 +1072,9 @@ propagate_constants_for_unrolling (basic_block bb)
       tree result = gimple_phi_result (phi);
       tree arg = gimple_phi_arg_def (phi, 0);
 
-      if (gimple_phi_num_args (phi) == 1 && TREE_CODE (arg) == INTEGER_CST)
+      if (! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (result)
+         && gimple_phi_num_args (phi) == 1
+         && TREE_CODE (arg) == INTEGER_CST)
        {
          propagate_into_all_uses (result, arg);
          gsi_remove (&gsi, true);
index 20f061ffaf0c7ee56d51d00e7ce44d2f1f7e3bec..8ea1853fa89263ecb912945f517d089afe4bf234 100644 (file)
@@ -1474,7 +1474,8 @@ execute_update_addresses_taken (void)
               tree lhs = gimple_get_lhs (stmt);
               if (lhs
                  && TREE_CODE (lhs) != SSA_NAME
-                 && non_rewritable_lvalue_p (lhs))
+                 && ((code == GIMPLE_CALL && ! DECL_P (lhs))
+                     || non_rewritable_lvalue_p (lhs)))
                {
                  decl = get_base_address (lhs);
                  if (DECL_P (decl))