re PR tree-optimization/81627 (ICE on valid code at -O3: in check_loop_closed_ssa_use...
authorBin Cheng <bin.cheng@arm.com>
Tue, 1 Aug 2017 09:20:08 +0000 (09:20 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Tue, 1 Aug 2017 09:20:08 +0000 (09:20 +0000)
PR tree-optimization/81627
* tree-predcom.c (prepare_finalizers): Always rewrite into loop
closed ssa form for store-store chain.

gcc/testsuite
* gcc.dg/tree-ssa/pr81627.c: New.

From-SVN: r250764

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr81627.c [new file with mode: 0644]
gcc/tree-predcom.c

index c8ed19d41ad25c0cda607dd646fb5a5c8d3d4b50..9e09d56d2b22636e041fef6fd36f8d807a132c8b 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-01  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/81627
+       * tree-predcom.c (prepare_finalizers): Always rewrite into loop
+       closed ssa form for store-store chain.
+
 2017-08-01  Bin Cheng  <bin.cheng@arm.com>
 
        PR tree-optimization/81620
index e2f695fa00112b3f9d8f6879f9c65871ad78b898..a86b281157e9e991f9e6cc275dad18735341a32f 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-01  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/81627
+       * gcc.dg/tree-ssa/pr81627.c: New.
+
 2017-08-01  Bin Cheng  <bin.cheng@arm.com>
 
        PR tree-optimization/81620
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81627.c
new file mode 100644 (file)
index 0000000..9ba43be
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fdump-tree-pcom-details" } */
+
+int a, b, c, d[6], e = 3, f;
+
+void abort (void);
+void fn1 ()
+{
+  for (b = 1; b < 5; b++)
+    {
+      for (c = 0; c < 5; c++)
+        d[b] = e;
+      if (a)
+        f++;
+      d[b + 1] = 1;
+    }
+}
+
+int main ()
+{
+  fn1 ();
+  if (d[0] != 0 || d[1] != 3 || d[2] != 3
+      || d[3] != 3 || d[4] != 3 || d[5] != 1)
+    abort ();
+
+  return 0;
+}
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 1 "pcom" } } */
index f7a57a43a0e6985634c39a7ab020a2e131875ede..4538773552cbf2d69b7399f1283c3885334fc60c 100644 (file)
@@ -2983,11 +2983,11 @@ prepare_finalizers (struct loop *loop, vec<chain_p> chains)
       if (prepare_finalizers_chain (loop, chain))
        {
          i++;
-         /* We don't corrupt loop closed ssa form for store elimination
-            chain if eliminated stores only store loop invariant values
-            into memory.  */
-         if (!chain->inv_store_elimination)
-           loop_closed_ssa |= (!chain->inv_store_elimination);
+         /* Be conservative, assume loop closed ssa form is corrupted
+            by store-store chain.  Though it's not always the case if
+            eliminated stores only store loop invariant values into
+            memory.  */
+         loop_closed_ssa = true;
        }
       else
        {