tree-ssa-reassoc.c (sort_by_operand_rank): Skip checking gimple_bb when there is...
authorKugan Vivekanandarajah <kuganv@linaro.org>
Tue, 24 May 2016 22:29:27 +0000 (22:29 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Tue, 24 May 2016 22:29:27 +0000 (22:29 +0000)
gcc/ChangeLog:

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

* tree-ssa-reassoc.c (sort_by_operand_rank): Skip checking gimple_bb
when there is stmt_to_insert.

gcc/testsuite/ChangeLog:

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

* gcc.dg/tree-ssa/reassoc-44.c: New test.

From-SVN: r236673

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

index b07aa808891687a5ca7132af76fa04bda8b8c47b..238cd07178daf6de4172d76b48f9f20bf1b156ed 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-24  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * tree-ssa-reassoc.c (sort_by_operand_rank): Skip checking gimple_bb
+       when there is stmt_to_insert.
+
 2016-05-24  Martin Sebor  <msebor@redhat.com>
 
        PR c++/71147
index a2821a7c9c7aabd7cf0232150c5e616f1ea92fc0..d81eedda0238821c092d03576646605b560ac2cf 100644 (file)
@@ -1,3 +1,7 @@
+2016-05-24  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * gcc.dg/tree-ssa/reassoc-44.c: New test.
+
 2016-05-24  Pat Haugen  <pthaugen@us.ibm.com>
 
        PR target/71050
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-44.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-44.c
new file mode 100644 (file)
index 0000000..1d946f6
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+unsigned int a;
+int b, c;
+void fn1 ()
+{
+  b = a + c + c;
+}
index 3b0266767a3c3ce6c90b5e1e06acb11da1b2527d..c9ed67956793bc685e3c200ed7d3dd688449d14e 100644 (file)
@@ -519,6 +519,8 @@ sort_by_operand_rank (const void *pa, const void *pb)
         See PR60418.  */
       if (!SSA_NAME_IS_DEFAULT_DEF (oea->op)
          && !SSA_NAME_IS_DEFAULT_DEF (oeb->op)
+         && !oea->stmt_to_insert
+         && !oeb->stmt_to_insert
          && SSA_NAME_VERSION (oeb->op) != SSA_NAME_VERSION (oea->op))
        {
          gimple *stmta = SSA_NAME_DEF_STMT (oea->op);