PR tree-optimization/69167
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Jan 2016 20:50:24 +0000 (20:50 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Jan 2016 20:50:24 +0000 (20:50 +0000)
        * gimple-fold.c (replace_stmt_with_simplification): Also punt if
new SSA_NAME_OCCURS_IN_ABNORMAL_PHI SSA_NAMEs appear in operands of
ops[0] comparison.
* gimple-match-head.c (maybe_push_res_to_seq): Likewise.

* gcc.dg/pr69167.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232178 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimple-fold.c
gcc/gimple-match-head.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr69167.c [new file with mode: 0644]

index 2cb0b01..194f390 100644 (file)
@@ -1,5 +1,13 @@
+2016-01-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/69167
+       * gimple-fold.c (replace_stmt_with_simplification): Also punt if
+       new SSA_NAME_OCCURS_IN_ABNORMAL_PHI SSA_NAMEs appear in operands of
+       ops[0] comparison.
+       * gimple-match-head.c (maybe_push_res_to_seq): Likewise.
+
 2016-01-08  Alan Lawrence  <alan.lawrence@arm.com>
-       Richard Biener  <rguenther@suse.de>
+           Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/68707
        * tree-vect-slp.c (vect_analyze_slp_instance): Cancel permuted SLP
index 2f379be..70871cf 100644 (file)
@@ -3309,7 +3309,14 @@ replace_stmt_with_simplification (gimple_stmt_iterator *gsi,
       || (ops[2]
          && TREE_CODE (ops[2]) == SSA_NAME
          && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2])
-         && !has_use_on_stmt (ops[2], stmt)))
+         && !has_use_on_stmt (ops[2], stmt))
+      || (COMPARISON_CLASS_P (ops[0])
+         && ((TREE_CODE (TREE_OPERAND (ops[0], 0)) == SSA_NAME
+              && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0], 0))
+              && !has_use_on_stmt (TREE_OPERAND (ops[0], 0), stmt))
+             || (TREE_CODE (TREE_OPERAND (ops[0], 1)) == SSA_NAME
+                 && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0], 1))
+                 && !has_use_on_stmt (TREE_OPERAND (ops[0], 1), stmt)))))
     return false;
 
   /* Don't insert new statements when INPLACE is true, even if we could
index a2400a3..3e6d15f 100644 (file)
@@ -299,7 +299,14 @@ maybe_push_res_to_seq (code_helper rcode, tree type, tree *ops,
              && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[1]))
          || (ops[2]
              && TREE_CODE (ops[2]) == SSA_NAME
-             && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2])))
+             && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2]))
+         || (COMPARISON_CLASS_P (ops[0])
+             && ((TREE_CODE (TREE_OPERAND (ops[0], 0)) == SSA_NAME
+                  && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0],
+                                                                    0)))
+                 || (TREE_CODE (TREE_OPERAND (ops[0], 1)) == SSA_NAME
+                     && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0],
+                                                                       1))))))
        return NULL_TREE;
       if (!res)
        {
index c7162e2..73ecf30 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/69167
+       * gcc.dg/pr69167.c: New test.
+
 2016-01-08  Marek Polacek  <polacek@redhat.com>
 
        PR c++/68449
        * g++.dg/pr68991-1.C: New test.
        * g++.dg/pr68991-2.C: Likewise.
 
-2016-01-05  Sergei Trofimovich <siarheit@google.com>
+2016-01-05  Sergei Trofimovich  <siarheit@google.com>
 
-        PR other/60465
+       PR other/60465
        * gcc.target/ia64/pr60465-gprel64.c: New test.
        * gcc.target/ia64/pr60465-gprel64-c37.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr69167.c b/gcc/testsuite/gcc.dg/pr69167.c
new file mode 100644 (file)
index 0000000..bda0226
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR tree-optimization/69167 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int sigsetjmp (char *);
+void foo ();
+void bar (void (*) (int *));
+extern char t[];
+
+void
+baz (int *x)
+{
+  int *a = x;
+  foo ();
+  x = 0;
+  if (sigsetjmp (t))
+    while (1)
+      bar (a ? baz : 0);
+  if (x)
+    foo ();
+}