re PR tree-optimization/71252 (ICE: verify_ssa failed : definition in block 7 does...
authorKugan Vivekanandarajah <kuganv@linaro.org>
Mon, 30 May 2016 10:45:19 +0000 (10:45 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Mon, 30 May 2016 10:45:19 +0000 (10:45 +0000)
gcc/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  <kuganv@linaro.org>

PR middle-end/71252
* tree-ssa-reassoc.c (swap_ops_for_binary_stmt): Fix swap such that
all fields including stmt_to_insert are swapped.

gcc/testsuite/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  <kuganv@linaro.org>

PR middle-end/71252
* gcc.dg/tree-ssa/pr71252-2.c: New test.

From-SVN: r236875

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr71252-2.c [new file with mode: 0644]
gcc/tree-ssa-reassoc.c

index 815a43da5ecba537c8a96bc00ab68e940aafda1e..c88748f8840f882dc290f4f20bc6fa5389eb4aad 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-30  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       PR middle-end/71252
+       * tree-ssa-reassoc.c (swap_ops_for_binary_stmt): Fix swap such that
+       all fields including stmt_to_insert are swapped.
+
 2016-05-30  Jan Hubicka  <hubicka@ucw.cz>
 
        * predict.h (force_edge_cold): Declare.
index 8b989b4e5d64f2bd4ad4d85724d7e7a20f02ddea..37f06b78c9946a17c9da4b76a32300020a5a25a1 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-30  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       PR middle-end/71252
+       * gcc.dg/tree-ssa/pr71252-2.c: New test.
+
 2016-05-30  Jan Hubicka  <hubicka@ucw.cz>
 
        * gcc.dg/tree-ssa/cunroll-12.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71252-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71252-2.c
new file mode 100644 (file)
index 0000000..e621d3e
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR middle-end/71252 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+unsigned a;
+int b, c;
+void fn1 ()
+{
+  b = a + c + 3 + c;
+}
index c9ed67956793bc685e3c200ed7d3dd688449d14e..d13be29ffc772507b899f80d45082aff493d8f0d 100644 (file)
@@ -3763,25 +3763,13 @@ swap_ops_for_binary_stmt (vec<operand_entry *> ops,
       || (stmt && is_phi_for_stmt (stmt, oe3->op)
          && !is_phi_for_stmt (stmt, oe1->op)
          && !is_phi_for_stmt (stmt, oe2->op)))
-    {
-      operand_entry temp = *oe3;
-      oe3->op = oe1->op;
-      oe3->rank = oe1->rank;
-      oe1->op = temp.op;
-      oe1->rank= temp.rank;
-    }
+    std::swap (*oe1, *oe3);
   else if ((oe1->rank == oe3->rank
            && oe2->rank != oe3->rank)
           || (stmt && is_phi_for_stmt (stmt, oe2->op)
               && !is_phi_for_stmt (stmt, oe1->op)
               && !is_phi_for_stmt (stmt, oe3->op)))
-    {
-      operand_entry temp = *oe2;
-      oe2->op = oe1->op;
-      oe2->rank = oe1->rank;
-      oe1->op = temp.op;
-      oe1->rank = temp.rank;
-    }
+    std::swap (*oe1, *oe3);
 }
 
 /* If definition of RHS1 or RHS2 dominates STMT, return the later of those