diff options
author | Richard Biener <rguenther@suse.de> | 2018-01-29 09:16:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-01-29 09:16:09 +0000 |
commit | 27837e0c35badaa19b418d460c0cf69012bc9f07 (patch) | |
tree | 1e3999e7c6c63148f4903fb7cba0897e7dbcdb32 | |
parent | 3be34c0b1dec1272dfabec1e94a4666e9499fdc1 (diff) | |
download | gcc-27837e0c35badaa19b418d460c0cf69012bc9f07.zip gcc-27837e0c35badaa19b418d460c0cf69012bc9f07.tar.gz gcc-27837e0c35badaa19b418d460c0cf69012bc9f07.tar.bz2 |
re PR tree-optimization/84057 (ICE: Segmentation fault (in can_remove_branch_p))
2018-01-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/84057
* tree-ssa-loop-ivcanon.c (unloop_loops): Deal with already
removed paths when removing edges.
* gcc.dg/graphite/pr84057.c: New testcase.
From-SVN: r257139
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/pr84057.c | 31 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-ivcanon.c | 17 |
4 files changed, 54 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8bd02a7..ac75869 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-01-29 Richard Biener <rguenther@suse.de> + + PR tree-optimization/84057 + * tree-ssa-loop-ivcanon.c (unloop_loops): Deal with already + removed paths when removing edges. + 2018-01-27 H.J. Lu <hongjiu.lu@intel.com> * doc/invoke.texi: Replace -mfunction-return==@var{choice} with diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fa663f2..18e19af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-29 Richard Biener <rguenther@suse.de> + + PR tree-optimization/84057 + * gcc.dg/graphite/pr84057.c: New testcase. + 2017-01-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/84073 diff --git a/gcc/testsuite/gcc.dg/graphite/pr84057.c b/gcc/testsuite/gcc.dg/graphite/pr84057.c new file mode 100644 index 0000000..9f7cea7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr84057.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fgraphite -funroll-loops -fno-tree-ccp -fno-tree-dce" } */ + +int ue; + +void +fr (int ct) +{ + int au = 0; + int *ra = &au; + + while (au < 1) + { + au -= 0x7878788; + if (au != ct && ue != 0) + { + while (au < 1) + { + } + +fc: + while (ct != 0) + { + } + } + } + + for (au = 0; au < 2; ++au) + if (ct != 0) + goto fc; +} diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 15c378a..a87ed0b 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -660,14 +660,21 @@ unloop_loops (bitmap loop_closed_ssa_invalidated, loops_to_unloop.release (); loops_to_unloop_nunroll.release (); - /* Remove edges in peeled copies. */ + /* Remove edges in peeled copies. Given remove_path removes dominated + regions we need to cope with removal of already removed paths. */ unsigned i; edge e; + auto_vec<int, 20> src_bbs; + src_bbs.reserve_exact (edges_to_remove.length ()); FOR_EACH_VEC_ELT (edges_to_remove, i, e) - { - bool ok = remove_path (e, irred_invalidated, loop_closed_ssa_invalidated); - gcc_assert (ok); - } + src_bbs.quick_push (e->src->index); + FOR_EACH_VEC_ELT (edges_to_remove, i, e) + if (BASIC_BLOCK_FOR_FN (cfun, src_bbs[i])) + { + bool ok = remove_path (e, irred_invalidated, + loop_closed_ssa_invalidated); + gcc_assert (ok); + } edges_to_remove.release (); } |