Commit a758fd67 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/48067 (FMA with no add operand produced by convert_mul_to_fma)

2011-03-11  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/48067
	* tree-ssa-math-opts.c (convert_mult_to_fma): Verify the
	multiplication result will be only used once on the target
	stmt.

	* gcc.dg/pr48067.c: New testcase.

From-SVN: r170877
parent 03dfda54
2011-03-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48067
* tree-ssa-math-opts.c (convert_mult_to_fma): Verify the
multiplication result will be only used once on the target
stmt.
2011-03-11 Richard Guenther <rguenther@suse.de>
* doc/invoke.texi (max-inline-insns-single): Adjust default value.
2011-03-11 Richard Guenther <rguenther@suse.de>
......
2011-03-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48067
* gcc.dg/pr48067.c: New testcase.
2011-03-11 Richard Guenther <rguenther@suse.de>
PR lto/48073
* g++.dg/lto/20110311-1_0.C: New testcase.
......
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-tree-forwprop -fno-tree-reassoc" } */
/* { dg-options "-O2 -ffast-math -fno-tree-forwprop -fno-tree-reassoc -mfma4" { target x86_64-*-* i?86-*-* } } */
float
foo (float x, float cim)
{
float c = x * cim;
float d = -c;
return c - d;
}
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment