From: Richard Biener Date: Thu, 15 Sep 2016 07:17:45 +0000 (+0000) Subject: re PR tree-optimization/77514 (ICE in VN_INFO_GET, at tree-ssa-sccvn.c:406 w/ -O2... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d08615f28f4f12a5f633e11a460f9187a54a59af;p=gcc.git re PR tree-optimization/77514 (ICE in VN_INFO_GET, at tree-ssa-sccvn.c:406 w/ -O2 (and above)) 2016-09-15 Richard Biener PR tree-optimization/77514 * tree-ssa-pre.c (create_expression_by_pieces): Handle garbage only forced_stmts sequence. * gcc.dg/torture/pr77514.c: New testcase. From-SVN: r240153 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45850766d71..0c74a2caec2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-15 Richard Biener + + PR tree-optimization/77514 + * tree-ssa-pre.c (create_expression_by_pieces): Handle garbage + only forced_stmts sequence. + 2016-09-15 Kugan Vivekanandarajah * tree-ssanames.h (FOR_EACH_SSA_NAME): New. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 023fcd484fd..623a764e339 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-15 Richard Biener + + PR tree-optimization/77514 + * gcc.dg/torture/pr77514.c: New testcase. + 2016-09-14 Jakub Jelinek PR c++/77549 diff --git a/gcc/testsuite/gcc.dg/torture/pr77514.c b/gcc/testsuite/gcc.dg/torture/pr77514.c new file mode 100644 index 00000000000..464841ce364 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77514.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +void +m1 (char l0, char e8, int hw) +{ + char *rs = &l0; + +yu: + l0 = 1; + while (l0 != 0) + { + l0 = -l0; + l0 += (*rs ^ (l0 &= 1)); + } + for (;;) + { + if (hw != 0) + goto yu; + rs = &e8; + } +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 67a05133850..d1fe72cca3f 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2879,7 +2879,21 @@ create_expression_by_pieces (basic_block block, pre_expr expr, gimple_seq_discard (forced_stmts); return folded; } - + /* Likewise if we simplified to sth not queued for insertion. */ + bool found = false; + gsi = gsi_start (forced_stmts); + for (; !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple *stmt = gsi_stmt (gsi); + tree forcedname = gimple_get_lhs (stmt); + if (forcedname == folded) + found = true; + } + if (! found) + { + gimple_seq_discard (forced_stmts); + return folded; + } gcc_assert (TREE_CODE (folded) == SSA_NAME); /* If we have any intermediate expressions to the value sets, add them