aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-stmts.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-10-16 11:19:37 +0000
committerJakub Jelinek <jakub@redhat.com>2012-10-16 11:19:37 +0000
commit838b71d9b20619b26062de4110b415b78dd95cab (patch)
treeddeae4a074044091ad624bc53856955eaf820414 /gcc/tree-vect-stmts.c
parent2a13d4c023874ad4cd36ee4dfb8d3c1b7763ed4b (diff)
PR tree-optimization/54889
* tree-vect-stmts.c (vectorizable_load): Add VIEW_CONVERT_EXPR if ARRAY_REF newref doesn't have compatible type with vectype element type, use vectype element type for MEM_REF. * gfortran.dg/pr54889.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@192493 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r--gcc/tree-vect-stmts.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index e1b7b7a0e7b..70bcebbe99b 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -4743,12 +4743,18 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
tree newref, newoff;
gimple incr;
if (TREE_CODE (ref) == ARRAY_REF)
- newref = build4 (ARRAY_REF, TREE_TYPE (ref),
- unshare_expr (TREE_OPERAND (ref, 0)),
- running_off,
- NULL_TREE, NULL_TREE);
+ {
+ newref = build4 (ARRAY_REF, TREE_TYPE (ref),
+ unshare_expr (TREE_OPERAND (ref, 0)),
+ running_off,
+ NULL_TREE, NULL_TREE);
+ if (!useless_type_conversion_p (TREE_TYPE (vectype),
+ TREE_TYPE (newref)))
+ newref = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (vectype),
+ newref);
+ }
else
- newref = build2 (MEM_REF, TREE_TYPE (ref),
+ newref = build2 (MEM_REF, TREE_TYPE (vectype),
running_off,
TREE_OPERAND (ref, 1));