From: Richard Biener Date: Mon, 10 Nov 2014 14:31:31 +0000 (+0000) Subject: re PR tree-optimization/63800 (ICE on valid code at -O3 on x86_64-linux-gnu) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6be4c4ece59c3ee69e38acf065d2b760587f6eb0;p=gcc.git re PR tree-optimization/63800 (ICE on valid code at -O3 on x86_64-linux-gnu) 2014-11-10 Richard Biener PR tree-optimization/63800 * tree-ssa-pre.c (eliminate_push_avail): Push in a way so we can restore the previous availability in after_dom_children. (eliminate_dom_walker::after_dom_children): Restore previous availability. * gcc.dg/torture/pr63800.c: New testcase. From-SVN: r217288 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a2157f63203..663ba2c9748 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-11-10 Richard Biener + + PR tree-optimization/63800 + * tree-ssa-pre.c (eliminate_push_avail): Push in a way so + we can restore the previous availability in after_dom_children. + (eliminate_dom_walker::after_dom_children): Restore + previous availability. + 2014-11-10 Richard Biener PR middle-end/63798 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9695c2eece6..a3ef6295428 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-10 Richard Biener + + PR tree-optimization/63800 + * gcc.dg/torture/pr63800.c: New testcase. + 2014-11-10 Marek Polacek * c-c++-common/ubsan/align-7.c: Skip for -flto -fno-fat-lto-objects. diff --git a/gcc/testsuite/gcc.dg/torture/pr63800.c b/gcc/testsuite/gcc.dg/torture/pr63800.c new file mode 100644 index 00000000000..19546c25f0c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr63800.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ + +int a, b, c, d[2]; + +int +fn1 () +{ + int f = 0; + d[1] = b = 1; + for (; b; b--) + { + for (c = 0; c < 2; c++) + { + d[b] & 1 & b; + if (d[0]) + f = d[b] * a; + if (f) + return 0; + } + d[b] && (d[0] = 0); + } + return 0; +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 776dacf206b..ea991989267 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -3906,8 +3906,11 @@ eliminate_push_avail (tree op) { if (el_avail.length () <= SSA_NAME_VERSION (valnum)) el_avail.safe_grow_cleared (SSA_NAME_VERSION (valnum) + 1); + tree pushop = op; + if (el_avail[SSA_NAME_VERSION (valnum)]) + pushop = el_avail[SSA_NAME_VERSION (valnum)]; + el_avail_stack.safe_push (pushop); el_avail[SSA_NAME_VERSION (valnum)] = op; - el_avail_stack.safe_push (op); } } @@ -4451,7 +4454,14 @@ eliminate_dom_walker::after_dom_children (basic_block) { tree entry; while ((entry = el_avail_stack.pop ()) != NULL_TREE) - el_avail[SSA_NAME_VERSION (VN_INFO (entry)->valnum)] = NULL_TREE; + { + tree valnum = VN_INFO (entry)->valnum; + tree old = el_avail[SSA_NAME_VERSION (valnum)]; + if (old == entry) + el_avail[SSA_NAME_VERSION (valnum)] = NULL_TREE; + else + el_avail[SSA_NAME_VERSION (valnum)] = entry; + } } /* Eliminate fully redundant computations. */