re PR tree-optimization/56150 (ICE segfault in do_pre / tail_merge_optimize)

2013-01-31  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/56150
	* tree-ssa-tail-merge.c (gimple_equal_p): Properly handle
	mixed store non-store stmts.

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

From-SVN: r195608
This commit is contained in:
Richard Biener 2013-01-31 08:52:56 +00:00 committed by Richard Biener
parent b713829735
commit fcfa87ac3d
4 changed files with 36 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2013-01-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/56150
* tree-ssa-tail-merge.c (gimple_equal_p): Properly handle
mixed store non-store stmts.
2013-01-30 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/55374

View File

@ -1,3 +1,8 @@
2013-01-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/56150
* gcc.dg/torture/pr56150.c: New testcase.
2013-01-30 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/55374

View File

@ -0,0 +1,17 @@
/* { dg-do compile } */
struct {
int f4;
} g1;
long g2;
volatile long g3;
void func_1 ()
{
if (g2)
g1 = g1;
else
g3;
}

View File

@ -1119,17 +1119,14 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2)
case GIMPLE_ASSIGN:
lhs1 = gimple_get_lhs (s1);
lhs2 = gimple_get_lhs (s2);
if (gimple_vdef (s1))
{
if (vn_valueize (gimple_vdef (s1)) != vn_valueize (gimple_vdef (s2)))
return false;
if (TREE_CODE (lhs1) != SSA_NAME
&& TREE_CODE (lhs2) != SSA_NAME)
return true;
}
return (TREE_CODE (lhs1) == SSA_NAME
&& TREE_CODE (lhs2) == SSA_NAME
&& vn_valueize (lhs1) == vn_valueize (lhs2));
if (TREE_CODE (lhs1) != SSA_NAME
&& TREE_CODE (lhs2) != SSA_NAME)
return (vn_valueize (gimple_vdef (s1))
== vn_valueize (gimple_vdef (s2)));
else if (TREE_CODE (lhs1) == SSA_NAME
&& TREE_CODE (lhs2) == SSA_NAME)
return vn_valueize (lhs1) == vn_valueize (lhs2);
return false;
case GIMPLE_COND:
t1 = gimple_cond_lhs (s1);