diff options
author | Richard Guenther <rguenther@suse.de> | 2008-07-31 14:12:24 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-07-31 14:12:24 +0000 |
commit | 12aea97a8d4abf8c33654cc5de3c71debf3ce764 (patch) | |
tree | a58d95bb1902ad56655ad2f26bc42a410dd06917 | |
parent | 1e0f7ffb4383cbbba0f81ca01a8ddd03a3f84620 (diff) | |
download | gcc-12aea97a8d4abf8c33654cc5de3c71debf3ce764.zip gcc-12aea97a8d4abf8c33654cc5de3c71debf3ce764.tar.gz gcc-12aea97a8d4abf8c33654cc5de3c71debf3ce764.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr36978.c | 14 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-unswitch.c | 4 |
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb7a67b..c83a2fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 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 pass_early_warn_uninitialized. * opts.c (decode_options): Do not warn about -Wuninitialized diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ccbd971..f6e855a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gcc.dg/torture/pr36978.c b/gcc/testsuite/gcc.dg/torture/pr36978.c new file mode 100644 index 0000000..cd1af4e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36978.c @@ -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)) + { + } + } +} + diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 8ece4ac..850270f 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -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 |