+2014-08-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/61964
+ * tree-ssa-tail-merge.c (gimple_operand_equal_value_p): New
+ function merged from trunk.
+ (gimple_equal_p): Handle non-SSA LHS solely by structural
+ equality.
+
2014-07-25 Uros Bizjak <ubizjak@gmail.com>
* config/alpha/elf.h: Define TARGET_UNWIND_TABLES_DEFAULT.
+2014-08-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/61964
+ * gcc.dg/torture/pr61964.c: New testcase.
+ * gcc.dg/pr51879-18.c: XFAIL.
+
2014-07-28 Richard Biener <rguenther@suse.de>
PR rtl-optimization/61801
*q = foo ();
}
-/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre"} } */
+/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "pre" } } */
--- /dev/null
+/* { 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;
+}
gcc_unreachable ();
}
+/* Return true if gimple operands T1 and T2 have the same value. */
+
+static bool
+gimple_operand_equal_value_p (tree t1, tree t2)
+{
+ if (t1 == t2)
+ return true;
+
+ if (t1 == NULL_TREE
+ || t2 == NULL_TREE)
+ return false;
+
+ if (operand_equal_p (t1, t2, 0))
+ return true;
+
+ return gvn_uses_equal (t1, t2);
+}
+
/* Return true if gimple statements S1 and S2 are equal. Gimple_bb (s1) and
gimple_bb (s2) are members of SAME_SUCC. */
lhs2 = gimple_get_lhs (s2);
if (TREE_CODE (lhs1) != SSA_NAME
&& TREE_CODE (lhs2) != SSA_NAME)
- return (vn_valueize (gimple_vdef (s1))
- == vn_valueize (gimple_vdef (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);