re PR tree-optimization/59388 (ICE on valid code at -O1 and above on x86_64-linux-gnu)

PR tree-optimization/59388
	* tree-ssa-reassoc.c (update_range_test): If op == range->exp,
	gimplify tem after stmt rather than before it.

	* gcc.c-torture/execute/pr59388.c: New test.

From-SVN: r205761
This commit is contained in:
Jakub Jelinek 2013-12-06 22:00:49 +01:00 committed by Jakub Jelinek
parent a3698dfc4a
commit 5f07cbdb0d
4 changed files with 33 additions and 3 deletions

View File

@ -1,5 +1,9 @@
2013-12-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/59388
* tree-ssa-reassoc.c (update_range_test): If op == range->exp,
gimplify tem after stmt rather than before it.
* tree-data-ref.c (struct data_ref_loc_d): Replace pos field with ref.
(get_references_in_stmt): Don't record operand addresses, but
operands themselves.

View File

@ -1,3 +1,8 @@
2013-12-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/59388
* gcc.c-torture/execute/pr59388.c: New test.
2013-12-06 Dominique d'Humieres <dominiq@lps.ens.fr>
PR testsuite/59043

View File

@ -0,0 +1,11 @@
/* PR tree-optimization/59388 */
int a;
struct S { unsigned int f:1; } b;
int
main ()
{
a = (0 < b.f) | b.f;
return a;
}

View File

@ -2072,9 +2072,19 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange,
tem = fold_convert_loc (loc, optype, tem);
gsi = gsi_for_stmt (stmt);
tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, true,
GSI_SAME_STMT);
for (gsi_prev (&gsi); !gsi_end_p (gsi); gsi_prev (&gsi))
/* In rare cases range->exp can be equal to lhs of stmt.
In that case we have to insert after the stmt rather then before
it. */
if (op == range->exp)
tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, false,
GSI_CONTINUE_LINKING);
else
{
tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, true,
GSI_SAME_STMT);
gsi_prev (&gsi);
}
for (; !gsi_end_p (gsi); gsi_prev (&gsi))
if (gimple_uid (gsi_stmt (gsi)))
break;
else