re PR tree-optimization/77514 (ICE in VN_INFO_GET, at tree-ssa-sccvn.c:406 w/ -O2...
authorRichard Biener <rguenther@suse.de>
Thu, 15 Sep 2016 07:17:45 +0000 (07:17 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 15 Sep 2016 07:17:45 +0000 (07:17 +0000)
2016-09-15  Richard Biener  <rguenther@suse.de>

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr77514.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index 45850766d71a4c53700ad56019ac33a7378a83b6..0c74a2caec2e9b41bf181f495cdf3f2428461b2e 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-15  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77514
+       * tree-ssa-pre.c (create_expression_by_pieces): Handle garbage
+       only forced_stmts sequence.
+
 2016-09-15  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        * tree-ssanames.h (FOR_EACH_SSA_NAME): New.
index 023fcd484fd96034392b38b4b6491111c0b339a1..623a764e339ca8e3a3b7c86860e176ab8595b347 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-15  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77514
+       * gcc.dg/torture/pr77514.c: New testcase.
+
 2016-09-14  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..464841c
--- /dev/null
@@ -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;
+    }
+}
index 67a05133850ee1660fc0b03ac7d385b1cadf75e7..d1fe72cca3f699402fc4e70c435ae692e47f462c 100644 (file)
@@ -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