re PR middle-end/19706 (Recognize common Fortran usages of copysign.)
authorTamar Christina <tamar.christina@arm.com>
Wed, 23 Aug 2017 11:32:47 +0000 (11:32 +0000)
committerTamar Christina <tnfchris@gcc.gnu.org>
Wed, 23 Aug 2017 11:32:47 +0000 (11:32 +0000)
2017-08-23  Tamar Christina  <tamar.christina@arm.com>

PR middle-end/19706
* tree-ssa-math-opts.c (convert_expand_mult_copysign):
Fix single-use check.

From-SVN: r251303

gcc/ChangeLog
gcc/tree-ssa-math-opts.c

index d5ada51a67104a9122170dc0e1d15a6322672100..1c7462f7ef214524fa7bb3b43ef8669a0472f170 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-23  Tamar Christina  <tamar.christina@arm.com>
+
+       PR middle-end/19706
+       * tree-ssa-math-opts.c (convert_expand_mult_copysign):
+       Fix single-use check.
+
 2017-08-23  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * gcc.c (execute): Only test for SIGKILL and SIGQUIT if available.
index 0d75751f230723c5c1a4c80474171bf99e6d1338..073c9dc19acc7e38c5311783697296f2bf16d274 100644 (file)
@@ -3200,21 +3200,20 @@ convert_expand_mult_copysign (gimple *stmt, gimple_stmt_iterator *gsi)
   type = TREE_TYPE (lhs);
   machine_mode mode = TYPE_MODE (type);
 
-  if (HONOR_SNANS (type) || !has_single_use (lhs))
+  if (HONOR_SNANS (type))
     return false;
 
   if (TREE_CODE (treeop0) == SSA_NAME && TREE_CODE (treeop1) == SSA_NAME)
     {
       gimple *call0 = SSA_NAME_DEF_STMT (treeop0);
-      if (!is_copysign_call_with_1 (call0))
+      if (!has_single_use (treeop0) || !is_copysign_call_with_1 (call0))
        {
          call0 = SSA_NAME_DEF_STMT (treeop1);
-         if (!is_copysign_call_with_1 (call0))
+         if (!has_single_use (treeop1) || !is_copysign_call_with_1 (call0))
            return false;
 
          treeop1 = treeop0;
        }
-
        if (optab_handler (xorsign_optab, mode) == CODE_FOR_nothing)
          return false;