From a8886f7d1859cebce5db37598c4bae54cc51db1d Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Tue, 4 Sep 2012 09:28:58 +0000 Subject: [PATCH] re PR tree-optimization/54458 (ICE get_loop_body, at cfgloop.c:830) 2012-09-04 Richard Guenther PR tree-optimization/54458 * tree-ssa-threadupdate.c (thread_through_loop_header): If we turn the loop into one with multiple latches mark it so. * gcc.dg/torture/pr54458.c: New testcase. From-SVN: r190918 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr54458.c | 20 ++++++++++++++++++++ gcc/tree-ssa-threadupdate.c | 10 ++++++++++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr54458.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 70aecdda5a0..5ba70bf6b60 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-09-04 Richard Guenther + + PR tree-optimization/54458 + * tree-ssa-threadupdate.c (thread_through_loop_header): If we + turn the loop into one with multiple latches mark it so. + 2012-09-04 Senthil Kumar Selvaraj PR target/54220 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4a0532188cd..b7354f48aba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-09-04 Richard Guenther + + PR tree-optimization/54458 + * gcc.dg/torture/pr54458.c: New testcase. + 2012-09-04 Christophe Lyon * gcc.target/arm/neon-vext.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr54458.c b/gcc/testsuite/gcc.dg/torture/pr54458.c new file mode 100644 index 00000000000..3d2e12fc2fd --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr54458.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +unsigned int a, b, c; + +void +foo (unsigned int x) +{ + do + { + if (a == 0 ? 1 : 1 % a) + for (; b; b--) + lab:; + else + while (x) + ; + if (c) + goto lab; + } + while (1); +} diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 86ad74f1bc8..30336a18e81 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -1037,11 +1037,21 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers) } free (bblocks); + /* If the new header has multiple latches mark it so. */ + FOR_EACH_EDGE (e, ei, loop->header->preds) + if (e->src->loop_father == loop + && e->src != loop->latch) + { + loop->latch = NULL; + loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES); + } + /* Cancel remaining threading requests that would make the loop a multiple entry loop. */ FOR_EACH_EDGE (e, ei, header->preds) { edge e2; + if (e->aux == NULL) continue; -- 2.30.2