re PR tree-optimization/36978 (ICE in gimple_cond_set_lhs for -O2 -funswitch-loops after tuples merge)

2008-07-31  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/36978
	* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Do not fold
	the generated condition.

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

From-SVN: r138415
This commit is contained in:
Richard Guenther 2008-07-31 14:12:24 +00:00 committed by Richard Biener
parent 1e0f7ffb43
commit 12aea97a8d
4 changed files with 27 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2008-07-31 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36978
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Do not fold
the generated condition.
2008-07-31 Richard Guenther <rguenther@suse.de>
* passes.c (init_optimization_passes): Always call

View file

@ -1,3 +1,8 @@
2008-07-31 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36978
* gcc.dg/torture/pr36978.c: New testcase.
2008-07-31 Arnaud Charlet <charlet@adacore.com>
* gnat.dg/sync_iface_test.ad[s,b]: New test.

View file

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-options "-funswitch-loops" } */
unsigned short status;
void foo (const _Bool flag)
{
if (status == 2 || status == 7)
{
while (status != 2 && (status != 7 || !flag))
{
}
}
}

View file

@ -123,8 +123,8 @@ tree_may_unswitch_on (basic_block bb, struct loop *loop)
return NULL_TREE;
}
cond = fold_build2 (gimple_cond_code (stmt), boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
cond = build2 (gimple_cond_code (stmt), boolean_type_node,
gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
/* To keep the things simple, we do not directly remove the conditions,
but just replace tests with 0/1. Prevent the infinite loop where we