diff options
author | Richard Guenther <rguenther@suse.de> | 2011-03-16 15:55:48 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-03-16 15:55:48 +0000 |
commit | 0b0081eca46587e27c16abc633fd199832616243 (patch) | |
tree | c5cd6c801e4c789da378446f25991564e80ee541 /gcc/fold-const.c | |
parent | 9977914ea5f6a5c6073891e770191e98beedad04 (diff) | |
download | gcc-0b0081eca46587e27c16abc633fd199832616243.zip gcc-0b0081eca46587e27c16abc633fd199832616243.tar.gz gcc-0b0081eca46587e27c16abc633fd199832616243.tar.bz2 |
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index f8630a2..9baa9eb 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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: |