From 7f5ddfcb3cb9e5d89d08e08d2a3aaed948aaf1af Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 16 Jul 2019 13:37:05 +0200 Subject: [PATCH] re PR rtl-optimization/91164 (ICE in verify_dominators, at dominance.c:1184 (error: dominator of 114 should be 112, not 16)) PR rtl-optimization/91164 * dse.c (rest_of_handle_dse): If dead edges have been purged, invalidate dominance info. * g++.dg/opt/pr91164.C: New test. From-SVN: r273522 --- gcc/ChangeLog | 6 +++ gcc/dse.c | 5 ++- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/opt/pr91164.C | 89 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr91164.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30e6e7e..1eb2797 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-16 Jakub Jelinek + + PR rtl-optimization/91164 + * dse.c (rest_of_handle_dse): If dead edges have been purged, + invalidate dominance info. + 2019-07-16 Richard Sandiford * read-md.h (md_reader::record_potential_iterator_use): Add a diff --git a/gcc/dse.c b/gcc/dse.c index a1c7e3b..8d7358d 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -3621,7 +3621,10 @@ rest_of_handle_dse (void) if ((locally_deleted || globally_deleted) && cfun->can_throw_non_call_exceptions && purge_all_dead_edges ()) - cleanup_cfg (0); + { + free_dominance_info (CDI_DOMINATORS); + cleanup_cfg (0); + } return 0; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 633ded6..1f04ebb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-16 Jakub Jelinek + + PR rtl-optimization/91164 + * g++.dg/opt/pr91164.C: New test. + 2019-07-16 Jan Hubicka * g++.dg/lto/alias-1_0.C: Use -O3. diff --git a/gcc/testsuite/g++.dg/opt/pr91164.C b/gcc/testsuite/g++.dg/opt/pr91164.C new file mode 100644 index 0000000..8cf4fd0 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr91164.C @@ -0,0 +1,89 @@ +// PR rtl-optimization/91164 +// { dg-do compile { target c++11 } } +// { dg-options "-O2 -fdelete-dead-exceptions -fnon-call-exceptions -fno-rerun-cse-after-loop -fno-tree-forwprop" } + +template class b; +template struct d { static constexpr int e = v; }; +template using g = f; +struct h { template using j = i; }; +template using k = h::j; +void *operator new(__SIZE_TYPE__, void *); +struct l { l(); }; +struct m; +template n aa(m); +struct o { template using ab = l; }; +template struct b { + struct q : o::ab { q(int, l = l()) : p() {} int p; } ac; + void ad(); + b() : ac(0) {} + ~b() { bool r = ac.p == 0; if (r) ad(); } + const wchar_t *ae(); +}; +struct m {}; +struct t { virtual void f(); }; +struct u { l a; }; +struct af : t { + struct ag { ag(l); }; + af(l ah) : ai(ah) {} + ag ai; +}; +struct w { + template w(f, x y) { new (0) af(y.a); } +}; +struct z { + using aj = int; + template z(x ah) : ak(al, ah) {} + aj al; + w ak; +}; +struct am : z { template am(x ah) : z(ah) {} }; +template am an(x) { return u{}; } +template am ao() { return an(l()); } +struct ap { + k aq; + k ar; + k as; +}; +struct at { ap a; long au; ap av; ap aw; }; +struct ax { at c; ax() : c() {} }; +enum ay : int; +ay az, ba; +struct bb { bb(wchar_t *, wchar_t *, ay, m); }; +template struct bd { + typedef typename bc::be *bf; + bd(bf, bf, const typename bc::bg &, ay); + ay bh; + bb bi; + am bj; + typename bc::bk e; + ax bl; + int bm; +}; +template using bn = g::e, am>; +template +bd::bd(bf ah, bf y, const typename bc::bg &bu, ay) + : bi(ah, y, bh, bu), bj(ao()), bm(aa(bu)) {} +struct bt { typedef wchar_t be; typedef b bk; typedef m bg; }; +template bn bar(); +template bn bq(bo) { + typename bc::bg bp; + auto bs = nullptr; + using br = bd; + br(bs, bs, bp, ba); + return bar(); +} +struct bw { + bw(); + template void assign(b ah) { + const wchar_t by = *ah.ae(); + bw(&by, ah.ae(), bp, az); + } + template bw(bo, bo y, m, ay) : automaton(bq(y)) {} + m bp; + am automaton; +}; +void bx() { + b s; + bw ca; + ca.assign(s); +} -- 2.7.4