re PR tree-optimization/61964 (krb5 database propagation enters infinite loop; reduce...
authorRichard Biener <rguenther@suse.de>
Thu, 31 Jul 2014 14:06:59 +0000 (14:06 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 31 Jul 2014 14:06:59 +0000 (14:06 +0000)
2014-07-31  Richard Biener  <rguenther@suse.de>

PR tree-optimization/61964
* tree-ssa-tail-merge.c (gimple_equal_p): Handle non-SSA LHS solely
by structural equality.

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

From-SVN: r213375

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr61964.c [new file with mode: 0644]
gcc/tree-ssa-tail-merge.c

index 2200cabbba71b93766f9668aad8b298c4a1cae24..f75f34682eb1ccea2a71234d5acfa35da3af085c 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-31  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61964
+       * tree-ssa-tail-merge.c (gimple_equal_p): Handle non-SSA LHS solely
+       by structural equality.
+
 2014-07-31  Yury Gribov  <y.gribov@samsung.com>
 
        * doc/cpp.texi (__SANITIZE_ADDRESS__): Updated description.
index c0e558593f51427a788168d3bf3ceff7d620d22a..1619d00dc815d835a6a17772a7c9817232cf06b4 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-31  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61964
+       * gcc.dg/torture/pr61964.c: New testcase.
+
 2014-07-31  Marc Glisse  <marc.glisse@inria.fr>
 
        PR c++/60517
diff --git a/gcc/testsuite/gcc.dg/torture/pr61964.c b/gcc/testsuite/gcc.dg/torture/pr61964.c
new file mode 100644 (file)
index 0000000..a03cfdc
--- /dev/null
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+struct node { struct node *next, *prev; } node;
+struct head { struct node *first; } heads[5];
+int k = 2;
+struct head *head = &heads[2];
+
+static int __attribute__((noinline))
+foo()
+{
+  node.prev = (void *)head;
+  head->first = &node;
+
+  struct node *n = head->first;
+  struct head *h = &heads[k];
+
+  if (n->prev == (void *)h)
+    h->first = n->next;
+  else
+    n->prev->next = n->next;
+
+  n->next = h->first;
+  return n->next == &node;
+}
+
+int main()
+{
+  if (foo ())
+    abort ();
+  return 0;
+}
index 9600e283cac3af79a631bba370ccce351cfdc991..4296c77c1ef69b24e89e6822696bb4f5f8e5dc66 100644 (file)
@@ -1161,17 +1161,9 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2)
       lhs2 = gimple_get_lhs (s2);
       if (TREE_CODE (lhs1) != SSA_NAME
          && TREE_CODE (lhs2) != SSA_NAME)
-       {
-         /* If the vdef is the same, it's the same statement.  */
-         if (vn_valueize (gimple_vdef (s1))
-             == vn_valueize (gimple_vdef (s2)))
-           return true;
-
-         /* Test for structural equality.  */
-         return (operand_equal_p (lhs1, lhs2, 0)
-                 && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1),
-                                                  gimple_assign_rhs1 (s2)));
-       }
+       return (operand_equal_p (lhs1, lhs2, 0)
+               && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1),
+                                                gimple_assign_rhs1 (s2)));
       else if (TREE_CODE (lhs1) == SSA_NAME
               && TREE_CODE (lhs2) == SSA_NAME)
        return vn_valueize (lhs1) == vn_valueize (lhs2);