re PR tree-optimization/38807 (ice: gimple check: expected gimple_assign(error_mark), have gimple_phi())

PR tree-optimization/38807
	* tree-ssa-reassoc.c (remove_visited_stmt_chain): Don't look at
	gimple_visited_p unless stmt is GIMPLE_ASSIGN.

	* gcc.c-torture/compile/pr38807.c: New test.

From-SVN: r143289
This commit is contained in:
Jakub Jelinek 2009-01-12 12:11:40 +01:00 committed by Jakub Jelinek
parent 0e510b3e4e
commit c2152239ac
4 changed files with 37 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2009-01-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/38807
* tree-ssa-reassoc.c (remove_visited_stmt_chain): Don't look at
gimple_visited_p unless stmt is GIMPLE_ASSIGN.
2009-01-11 Adam Nemet <anemet@caviumnetworks.com>
* expmed.c (store_bit_field_1): Properly truncate the paradoxical

View File

@ -1,3 +1,8 @@
2009-01-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/38807
* gcc.c-torture/compile/pr38807.c: New test.
2009-01-11 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/ins-2.c: New test.

View File

@ -0,0 +1,23 @@
/* PR tree-optimization/38807 */
int
baz (short x)
{
return x;
}
int a, b;
int
bar (int x)
{
if (baz (a ^ x ^ a))
return b;
return 0;
}
int
foo (void)
{
return bar (a == 0 || 1 == 1 - a) ? 1 : bar (1 && a);
}

View File

@ -1,5 +1,5 @@
/* Reassociation for trees.
Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org>
This file is part of GCC.
@ -1279,7 +1279,8 @@ remove_visited_stmt_chain (tree var)
if (TREE_CODE (var) != SSA_NAME || !has_zero_uses (var))
return;
stmt = SSA_NAME_DEF_STMT (var);
if (!gimple_visited_p (stmt))
if (!is_gimple_assign (stmt)
|| !gimple_visited_p (stmt))
return;
var = gimple_assign_rhs1 (stmt);
gsi = gsi_for_stmt (stmt);