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
This commit is contained in:
Richard Guenther 2011-03-16 15:55:48 +00:00 committed by Richard Biener
parent 9977914ea5
commit 0b0081eca4
4 changed files with 30 additions and 0 deletions

View file

@ -1,3 +1,9 @@
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

View file

@ -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:

View file

@ -1,3 +1,8 @@
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

View file

@ -0,0 +1,11 @@
/* { 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" } } */