aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-analyze.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vect-analyze.c')
-rw-r--r--gcc/tree-vect-analyze.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c
index fd26c90687e..4c36b029bad 100644
--- a/gcc/tree-vect-analyze.c
+++ b/gcc/tree-vect-analyze.c
@@ -1310,8 +1310,7 @@ vect_analyze_pointer_ref_access (tree memref, tree stmt, bool is_read,
return NULL;
}
- reftype = TREE_TYPE (init);
- if (!POINTER_TYPE_P (reftype))
+ if (!POINTER_TYPE_P (TREE_TYPE (init)))
{
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS,
LOOP_LOC (loop_vinfo)))
@@ -1321,6 +1320,14 @@ vect_analyze_pointer_ref_access (tree memref, tree stmt, bool is_read,
*ptr_step = fold_convert (ssizetype, step);
innertype = TREE_TYPE (reftype);
+
+ if (!COMPLETE_TYPE_P (innertype))
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS,
+ LOOP_LOC (loop_vinfo)))
+ fprintf (vect_dump, "not vectorized: pointer to incomplete type.");
+ return NULL;
+ }
/* Check that STEP is a multiple of type size. */
if (!integer_zerop (size_binop (TRUNC_MOD_EXPR, *ptr_step,
fold_convert (ssizetype, TYPE_SIZE_UNIT (innertype)))))
@@ -1654,10 +1661,11 @@ vect_object_analysis (tree memref, tree stmt, bool is_read,
fprintf (vect_dump, "not vectorized: ptr is loop invariant.");
return NULL_TREE;
}
- /* Since there exists DR for MEMREF, we are analyzing the base of
- handled component, which not necessary has evolution in the
- loop. */
- address_to_analyze = TREE_OPERAND (base, 0);
+ /* Since there exists DR for MEMREF, we are analyzing the init of
+ the access function, which not necessary has evolution in the
+ loop. */
+ address_to_analyze = initial_condition_in_loop_num (access_fn,
+ loop->num);
}
/* 3.3 set data-reference structure for MEMREF. */