diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-16 13:53:09 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-16 13:53:09 +0000 |
commit | 8ba0d70dfdcd03def648c59974d5746fdcc0862e (patch) | |
tree | 32a1004eb827fcb9616372fced22401fe1a5db3d /gcc/tree-ssa.c | |
parent | 63eb2430e848fdcbfe820908ca5de8680359861e (diff) | |
download | gcc-8ba0d70dfdcd03def648c59974d5746fdcc0862e.tar.gz |
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.
(non_rewritable_mem_ref_base): Handle complex type component
accesses, constrain offsets for vector and complex extracts
more properly.
* gcc.dg/tree-ssa/complex-6.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171046 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index f28e5d15c72..e7e3edcf6f1 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1855,6 +1855,14 @@ maybe_rewrite_mem_ref_base (tree *tp) bitsize_int (BITS_PER_UNIT), TREE_OPERAND (*tp, 1), 0)); } + else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE + && useless_type_conversion_p (TREE_TYPE (*tp), + TREE_TYPE (TREE_TYPE (sym)))) + { + *tp = build1 (integer_zerop (TREE_OPERAND (*tp, 1)) + ? REALPART_EXPR : IMAGPART_EXPR, + TREE_TYPE (*tp), sym); + } else if (integer_zerop (TREE_OPERAND (*tp, 1))) { if (!useless_type_conversion_p (TREE_TYPE (*tp), @@ -1888,10 +1896,14 @@ non_rewritable_mem_ref_base (tree ref) && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) { tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0); - if (TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE + if ((TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE + || TREE_CODE (TREE_TYPE (decl)) == COMPLEX_TYPE) && useless_type_conversion_p (TREE_TYPE (base), TREE_TYPE (TREE_TYPE (decl))) && double_int_fits_in_uhwi_p (mem_ref_offset (base)) + && double_int_ucmp + (tree_to_double_int (TYPE_SIZE_UNIT (TREE_TYPE (decl))), + mem_ref_offset (base)) == 1 && multiple_of_p (sizetype, TREE_OPERAND (base, 1), TYPE_SIZE_UNIT (TREE_TYPE (base)))) return NULL_TREE; |