Commit 0b0081ec by Richard Guenther Committed by Richard Biener

re PR tree-optimization/48149 (Piecewise complex pass-through not optimized)

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

	PR tree-optimization/48149
	* fold-const.c (fold_binary_loc): Fold
	COMPLEX_EXPR <REALPART_EXPR <x>, IMAGPART_EXPR <x>>.

	* gcc.dg/fold-complex-1.c: New testcase.

From-SVN: r171048
parent 9977914e
2011-03-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48149
* fold-const.c (fold_binary_loc): Fold
COMPLEX_EXPR <REALPART_EXPR <x>, IMAGPART_EXPR <x>>.
2011-03-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/26134
* tree-ssa.c (maybe_rewrite_mem_ref_base): Handle rewriting
complex part accesses to REALPART_EXPR and IMAGPART_EXPR.
......
......@@ -13176,6 +13176,14 @@ fold_binary_loc (location_t loc,
|| (TREE_CODE (arg0) == INTEGER_CST
&& TREE_CODE (arg1) == INTEGER_CST))
return build_complex (type, arg0, arg1);
if (TREE_CODE (arg0) == REALPART_EXPR
&& TREE_CODE (arg1) == IMAGPART_EXPR
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg0, 0)))
== TYPE_MAIN_VARIANT (type))
&& operand_equal_p (TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0), 0))
return omit_one_operand_loc (loc, type, TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0));
return NULL_TREE;
case ASSERT_EXPR:
......
2011-03-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48149
* gcc.dg/fold-complex-1.c: New testcase.
2011-03-16 Richard Guenther <rguenther@suse.de>
PR testsuite/48147
* gcc.dg/guality/pr45882.c: Really make sure no inlining
or cloning happens.
......
/* { dg-do compile } */
/* { dg-options "-O -ffast-math -fdump-tree-original" } */
_Complex float
foo (_Complex float x)
{
return __real x + 1.0iF * __imag x;
}
/* { dg-final { scan-tree-dump-times "COMPLEX_EXPR" 0 "original" } } */
/* { dg-final { cleanup-tree-dump "original" } } */
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