]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/56559 (ICE in propagate_op_to_single_use, at tree-ssa-reassoc.c...
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Mar 2013 14:34:15 +0000 (15:34 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Mar 2013 14:34:15 +0000 (15:34 +0100)
PR tree-optimization/56559
* tree-ssa-reassoc.c (zero_one_operation): When looking at rhs2,
check that it has only a single use.

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

From-SVN: r196520

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

index af3dd814b2ffafdce5e66ceab3dc30942987c154..ff171e2a90b7500b3a149edbaeae13e50c1c567f 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/56559
+       * tree-ssa-reassoc.c (zero_one_operation): When looking at rhs2,
+       check that it has only a single use.
+
 2013-03-07  Richard Biener  <rguenther@suse.de>
 
        * doc/invoke.texi (fwhole-program): Discourage use in combination
index 3c456e2021e2218713745931af5c6a15ed67f046..ee5c580e3c3076c72669fcae6db5c3ea4301b68a 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/56559
+       * gcc.dg/tree-ssa/reassoc-26.c: New test.
+
 2013-03-07  Andreas Schwab  <schwab@suse.de>
 
        * gcc.dg/pr31490.c: Fix last change.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-26.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-26.c
new file mode 100644 (file)
index 0000000..ae4bdaa
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR tree-optimization/56559 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+double a, b, c, d, e;
+
+void
+foo ()
+{
+  a = e * e;
+  b = d * e + c * e * a;
+}
index f53526b56d39661eec80ba5b4f569dfa8f47a344..27161cd18600dfa6818d9a2abe03a02b141737d4 100644 (file)
@@ -1107,7 +1107,8 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op)
         the operand might be hiding in the rightmost one.  */
       if (opcode == MULT_EXPR
          && gimple_assign_rhs_code (stmt) == opcode
-         && TREE_CODE (gimple_assign_rhs2 (stmt)) == SSA_NAME)
+         && TREE_CODE (gimple_assign_rhs2 (stmt)) == SSA_NAME
+         && has_single_use (gimple_assign_rhs2 (stmt)))
        {
          gimple stmt2 = SSA_NAME_DEF_STMT (gimple_assign_rhs2 (stmt));
          if (stmt_is_power_of_op (stmt2, op))