re PR tree-optimization/61964 (krb5 database propagation enters infinite loop; reduced test case)

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
This commit is contained in:
Richard Biener 2014-07-31 14:06:59 +00:00 committed by Richard Biener
parent 5cb7516dca
commit 030e321a73
4 changed files with 47 additions and 11 deletions

View 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.

View 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

View File

@ -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;
}

View 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);