From: Richard Biener Date: Mon, 17 Aug 2015 14:17:33 +0000 (+0000) Subject: re PR tree-optimization/67221 (ICE at -Os and above on x86_64-linux-gnu: Segmentation... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28251e2ce19fbbe5715ac33cf4a8c349d0c95faa;p=gcc.git re PR tree-optimization/67221 (ICE at -Os and above on x86_64-linux-gnu: Segmentation fault (program cc1)) 2015-08-17 Richard Biener PR tree-optimization/67221 * tree-ssa-sccvn.c (visit_phi): Keep all-TOP args TOP. (sccvn_dom_walker::before_dom_children): Mark backedges of non-executable blocks as not executable. * gcc.dg/torture/pr67221.c: New testcase. From-SVN: r226938 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76d1d07043b..93ec58f4946 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-08-17 Richard Biener + + PR tree-optimization/67221 + * tree-ssa-sccvn.c (visit_phi): Keep all-TOP args TOP. + (sccvn_dom_walker::before_dom_children): Mark backedges of + non-executable blocks as not executable. + 2015-08-17 David Sherwood * config/arm/arm.c (neon_element_bits): Replace call to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 394a42fafdd..93aed719457 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-17 Richard Biener + + PR tree-optimization/67221 + * gcc.dg/torture/pr67221.c: New testcase. + 2015-08-17 Mike Stump Kyrylo Tkachov diff --git a/gcc/testsuite/gcc.dg/torture/pr67221.c b/gcc/testsuite/gcc.dg/torture/pr67221.c new file mode 100644 index 00000000000..d7d33c5826e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67221.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ + +int a, b; + +int +fn1 (int p) +{ + return 0 == 0 ? p : 0; +} + +void +fn2 () +{ + int c = 1, d[1] = { 1 }; +lbl: + for (;;) + { + int e; + c ? 0 : 0 / c; + c = 0; + if (fn1 (d[0])) + break; + for (e = 0; e < 1; e++) + for (c = 1; b;) + { + if (a) + break; + goto lbl; + } + } +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index a72a9208f07..aea6acc0451 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3271,6 +3271,11 @@ visit_phi (gimple phi) break; } } + + /* If none of the edges was executable or all incoming values are + undefined keep the value-number at VN_TOP. */ + if (sameval == VN_TOP) + return set_ssa_val_to (PHI_RESULT (phi), VN_TOP); /* First see if it is equivalent to a phi node in this block. We prefer this as it allows IV elimination - see PRs 66502 and 67167. */ @@ -4463,7 +4468,7 @@ sccvn_dom_walker::before_dom_children (basic_block bb) reachable |= (e->flags & EDGE_EXECUTABLE); /* If the block is not reachable all outgoing edges are not - executable. */ + executable. Neither are incoming edges with src dominated by us. */ if (!reachable) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -4472,6 +4477,18 @@ sccvn_dom_walker::before_dom_children (basic_block bb) FOR_EACH_EDGE (e, ei, bb->succs) e->flags &= ~EDGE_EXECUTABLE; + + FOR_EACH_EDGE (e, ei, bb->preds) + { + if (dominated_by_p (CDI_DOMINATORS, e->src, bb)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "Marking backedge from BB %d into " + "unreachable BB %d as not executable\n", + e->src->index, bb->index); + e->flags &= ~EDGE_EXECUTABLE; + } + } return; }