re PR tree-optimization/81744 (ICE: verify_ssa failed, at tree-ssa.c:1186)
authorBin Cheng <bin.cheng@arm.com>
Tue, 8 Aug 2017 11:32:05 +0000 (11:32 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Tue, 8 Aug 2017 11:32:05 +0000 (11:32 +0000)
PR tree-optimization/81744
* tree-predcom.c (prepare_finalizers_chain): Deep copy expr of
loop's number of iterations.

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

From-SVN: r250950

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

index dde91ceea5ba70db67f76560825b3718ff8f13b1..d830fd65c12810a7798c420210d559081d5d0299 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-08  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/81744
+       * tree-predcom.c (prepare_finalizers_chain): Deep copy expr of
+       loop's number of iterations.
+
 2017-08-08  Martin Liska  <mliska@suse.cz>
 
        * asan.c: Include header files.
index e08c2e848f404cfe12211b637351c86e5bf47250..211e629fda311f82591300066805a561c359b3fe 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-08  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/81744
+       * gcc.dg/tree-ssa/pr81744.c: New.
+
 2017-08-08  Marek Polacek  <polacek@redhat.com>
 
        PR c++/81607
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81744.c
new file mode 100644 (file)
index 0000000..b0f5d38
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-inline -fdump-tree-pcom-details" } */
+
+typedef struct {
+  int a, b;
+} CompandSegment;
+int a;
+CompandSegment *b;
+void fn1() {
+  for (; a; a++)
+    b[a].a = b[a].b = b[a - 1].a = b[a - 1].b = 0;
+}
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 2 "pcom"} } */
index 4538773552cbf2d69b7399f1283c3885334fc60c..e7b10cb390fc53cc59ea82cc50add786b01825fd 100644 (file)
@@ -2940,7 +2940,7 @@ prepare_finalizers_chain (struct loop *loop, chain_p chain)
 
       if (TREE_CODE (niters) != INTEGER_CST && TREE_CODE (niters) != SSA_NAME)
        {
-         niters = copy_node (niters);
+         niters = unshare_expr (niters);
          niters = force_gimple_operand (niters, &stmts, true, NULL);
          if (stmts)
            {