OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-math-opts.c
index e8f9037..6e2213c 100644 (file)
@@ -1557,6 +1557,9 @@ convert_mult_to_fma (gimple mul_stmt, tree op1, tree op2)
       /* A negate on the multiplication leads to FNMA.  */
       if (use_code == NEGATE_EXPR)
        {
+         ssa_op_iter iter;
+         tree use;
+
          result = gimple_assign_lhs (use_stmt);
 
          /* Make sure the negate statement becomes dead with this
@@ -1565,6 +1568,11 @@ convert_mult_to_fma (gimple mul_stmt, tree op1, tree op2)
                               &use_p, &neguse_stmt))
            return false;
 
+         /* Make sure the multiplication isn't also used on that stmt.  */
+         FOR_EACH_SSA_TREE_OPERAND (use, neguse_stmt, iter, SSA_OP_USE)
+           if (use == mul_result)
+             return false;
+
          /* Re-validate.  */
          use_stmt = neguse_stmt;
          if (gimple_bb (use_stmt) != gimple_bb (mul_stmt))
@@ -1707,7 +1715,8 @@ execute_optimize_widening_mul (void)
                default:;
                }
            }
-         else if (is_gimple_call (stmt))
+         else if (is_gimple_call (stmt)
+                  && gimple_call_lhs (stmt))
            {
              tree fndecl = gimple_call_fndecl (stmt);
              if (fndecl