diff options
author | Richard Biener <rguenther@suse.de> | 2016-02-26 18:17:02 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2016-02-26 11:17:02 -0700 |
commit | 4a4f9d2bf86ef5f48d45ad39802d34dc349f6509 (patch) | |
tree | 31ef9d5cee18591d47b3be8f38ab372849e71b59 /gcc | |
parent | ad2a27062e2837a776fd0e5cb67ef4324c5c9936 (diff) |
re PR tree-optimization/69740 (gcc ICE at -O2 and above on valid code on x86_64-linux-gnu in "verify_loop_structure")
PR tree-optimization/69740
* cfghooks.c (remove_edge): Request loop fixups if we delete
an edge that might turn an irreducible loop into a natural
loop.
PR tree-optimization/69740
* gcc.c-torture/compile/pr69740-1.c: New test.
* gcc.c-torture/compile/pr69740-2.c: New test.
Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r233754
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cfghooks.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr69740-1.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr69740-2.c | 19 |
5 files changed, 60 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d9cfd0e08f5..6344092a55d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-02-26 Richard Biener <rguenther@suse.de> + Jeff Law <law@redhat.com> + + PR tree-optimization/69740 + * cfghooks.c (remove_edge): Request loop fixups if we delete + an edge that might turn an irreducible loop into a natural + loop. + 2016-02-26 Martin Jambor <mjambor@suse.cz> PR middle-end/69920 diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index bbb1017fd1f..06c05d1fb39 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -408,7 +408,20 @@ void remove_edge (edge e) { if (current_loops != NULL) - rescan_loop_exit (e, false, true); + { + rescan_loop_exit (e, false, true); + + /* Removal of an edge inside an irreducible region or which leads + to an irreducible region can turn the region into a natural loop. + In that case, ask for the loop structure fixups. + + FIXME: Note that LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS is not always + set, so always ask for fixups when removing an edge in that case. */ + if (!loops_state_satisfies_p (LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS) + || (e->flags & EDGE_IRREDUCIBLE_LOOP) + || (e->dest->flags & BB_IRREDUCIBLE_LOOP)) + loops_state_set (LOOPS_NEED_FIXUP); + } /* This is probably not needed, but it doesn't hurt. */ /* FIXME: This should be called via a remove_edge hook. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a928892cb7..316720b5b4b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-02-26 Richard Biener <rguenther@suse.de> + Jeff Law <law@redhat.com> + + PR tree-optimization/69740 + * gcc.c-torture/compile/pr69740-1.c: New test. + * gcc.c-torture/compile/pr69740-2.c: New test. + 2016-02-26 Martin Jambor <mjambor@suse.cz> PR middle-end/69920 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr69740-1.c b/gcc/testsuite/gcc.c-torture/compile/pr69740-1.c new file mode 100644 index 00000000000..ac867d8a999 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr69740-1.c @@ -0,0 +1,12 @@ +char a; +short b; +void fn1() { + if (b) + ; + else { + int c[1] = {0}; + l1:; + } + if (a) + goto l1; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr69740-2.c b/gcc/testsuite/gcc.c-torture/compile/pr69740-2.c new file mode 100644 index 00000000000..a89c9a0fd12 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr69740-2.c @@ -0,0 +1,19 @@ +inline int foo(int *p1, int p2) { + int z = *p1; + while (z > p2) + p2 = 2; + return z; +} +int main() { + int i; + for (;;) { + int j, k; + i = foo(&k, 7); + if (k) + j = i; + else + k = j; + if (2 != j) + __builtin_abort(); + } +} |