diff options
author | Richard Biener <rguenther@suse.de> | 2016-05-24 07:55:56 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-05-24 07:55:56 +0000 |
commit | f17a223de829cb5fa0b32a9f12c22a4fa929506c (patch) | |
tree | 8563bc5695a3444a499e0c3f237354120053f294 /gcc/tree-ssa.c | |
parent | 64fc0cd9b2a83a4b0301d8d7890bf27880d8384e (diff) | |
download | gcc-f17a223de829cb5fa0b32a9f12c22a4fa929506c.zip gcc-f17a223de829cb5fa0b32a9f12c22a4fa929506c.tar.gz gcc-f17a223de829cb5fa0b32a9f12c22a4fa929506c.tar.bz2 |
re PR middle-end/70434 (adding an extraneous cast to vector type results in inferior code)
2016-05-24 Richard Biener <rguenther@suse.de>
PR middle-end/70434
PR c/69504
c-family/
* c-common.h (convert_vector_to_pointer_for_subscript): Rename to ...
(convert_vector_to_array_for_subscript): ... this.
* c-common.c (convert_vector_to_pointer_for_subscript): Use a
VIEW_CONVERT_EXPR to an array type. Rename to ...
(convert_vector_to_array_for_subscript): ... this.
cp/
* expr.c (mark_exp_read): Handle VIEW_CONVERT_EXPR.
* constexpr.c (cxx_eval_array_reference): Handle indexed
vectors.
* typeck.c (cp_build_array_ref): Adjust.
c/
* c-typeck.c (build_array_ref): Do not complain about indexing
non-lvalue vectors. Adjust for function name change.
* tree-ssa.c (non_rewritable_mem_ref_base): Make sure to mark
bases which are accessed with non-invariant indices.
* gimple-fold.c (maybe_canonicalize_mem_ref_addr): Re-write
constant index ARRAY_REFs of vectors into BIT_FIELD_REFs.
* c-c++-common/vector-subscript-4.c: New testcase.
* c-c++-common/vector-subscript-5.c: Likewise.
From-SVN: r236630
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index cf6e764..a53322d 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1222,14 +1222,19 @@ maybe_rewrite_mem_ref_base (tree *tp, bitmap suitable_for_renaming) static tree non_rewritable_mem_ref_base (tree ref) { - tree base = ref; + tree base; /* A plain decl does not need it set. */ if (DECL_P (ref)) return NULL_TREE; - while (handled_component_p (base)) - base = TREE_OPERAND (base, 0); + if (! (base = CONST_CAST_TREE (strip_invariant_refs (ref)))) + { + base = get_base_address (ref); + if (DECL_P (base)) + return base; + return NULL_TREE; + } /* But watch out for MEM_REFs we cannot lower to a VIEW_CONVERT_EXPR or a BIT_FIELD_REF. */ |