diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-07-03 13:36:13 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-07-03 13:36:13 +0000 |
commit | 3f5e8a7690d91daba3d8988318895fe51b7749ec (patch) | |
tree | 72acbcd4a626f9138dea9686c90e6c41182d293b /gcc/tree-vectorizer.h | |
parent | 63d03dcecdafe34715282a5155cfc2162375feca (diff) | |
download | gcc-3f5e8a7690d91daba3d8988318895fe51b7749ec.zip gcc-3f5e8a7690d91daba3d8988318895fe51b7749ec.tar.gz gcc-3f5e8a7690d91daba3d8988318895fe51b7749ec.tar.bz2 |
Use innermost_loop_behavior for outer loop vectorisation
This patch replaces the individual stmt_vinfo dr_* fields with
an innermost_loop_behavior, so that the changes in later patches
get picked up automatically. It also adds a helper function for
getting the behavior of a data reference wrt the vectorised loop.
2017-07-03 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* tree-vectorizer.h (_stmt_vec_info): Replace individual dr_*
fields with dr_wrt_vec_loop.
(STMT_VINFO_DR_BASE_ADDRESS, STMT_VINFO_DR_INIT, STMT_VINFO_DR_OFFSET)
(STMT_VINFO_DR_STEP, STMT_VINFO_DR_ALIGNED_TO): Update accordingly.
(STMT_VINFO_DR_WRT_VEC_LOOP): New macro.
(vect_dr_behavior): New function.
(vect_create_addr_base_for_vector_ref): Remove loop parameter.
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Use
vect_dr_behavior. Use a step_preserves_misalignment_p boolean to
track whether the step preserves the misalignment.
(vect_create_addr_base_for_vector_ref): Remove loop parameter.
Use vect_dr_behavior.
(vect_setup_realignment): Update call accordingly.
(vect_create_data_ref_ptr): Likewise. Use vect_dr_behavior.
* tree-vect-loop-manip.c (vect_gen_prolog_loop_niters): Update
call to vect_create_addr_base_for_vector_ref.
(vect_create_cond_for_align_checks): Likewise.
* tree-vect-patterns.c (vect_recog_bool_pattern): Copy
STMT_VINFO_DR_WRT_VEC_LOOP as a block.
(vect_recog_mask_conversion_pattern): Likewise.
* tree-vect-stmts.c (compare_step_with_zero): Use vect_dr_behavior.
(new_stmt_vec_info): Remove redundant zeroing.
From-SVN: r249911
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index c4a84e8..4a1e302 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -554,11 +554,7 @@ typedef struct _stmt_vec_info { /* Information about the data-ref relative to this loop nest (the loop that is being considered for vectorization). */ - tree dr_base_address; - tree dr_init; - tree dr_offset; - tree dr_step; - tree dr_aligned_to; + innermost_loop_behavior dr_wrt_vec_loop; /* For loop PHI nodes, the base and evolution part of it. This makes sure this information is still available in vect_update_ivs_after_vectorizer @@ -708,11 +704,12 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo) #define STMT_VINFO_VEC_REDUCTION_TYPE(S) (S)->v_reduc_type #define STMT_VINFO_VEC_CONST_COND_REDUC_CODE(S) (S)->const_cond_reduc_code -#define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_base_address -#define STMT_VINFO_DR_INIT(S) (S)->dr_init -#define STMT_VINFO_DR_OFFSET(S) (S)->dr_offset -#define STMT_VINFO_DR_STEP(S) (S)->dr_step -#define STMT_VINFO_DR_ALIGNED_TO(S) (S)->dr_aligned_to +#define STMT_VINFO_DR_WRT_VEC_LOOP(S) (S)->dr_wrt_vec_loop +#define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_wrt_vec_loop.base_address +#define STMT_VINFO_DR_INIT(S) (S)->dr_wrt_vec_loop.init +#define STMT_VINFO_DR_OFFSET(S) (S)->dr_wrt_vec_loop.offset +#define STMT_VINFO_DR_STEP(S) (S)->dr_wrt_vec_loop.step +#define STMT_VINFO_DR_ALIGNED_TO(S) (S)->dr_wrt_vec_loop.aligned_to #define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p #define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt @@ -1014,6 +1011,22 @@ known_alignment_for_access_p (struct data_reference *data_ref_info) return (DR_MISALIGNMENT (data_ref_info) != DR_MISALIGNMENT_UNKNOWN); } +/* Return the behavior of DR with respect to the vectorization context + (which for outer loop vectorization might not be the behavior recorded + in DR itself). */ + +static inline innermost_loop_behavior * +vect_dr_behavior (data_reference *dr) +{ + gimple *stmt = DR_STMT (dr); + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); + if (loop_vinfo == NULL + || !nested_in_vect_loop_p (LOOP_VINFO_LOOP (loop_vinfo), stmt)) + return &DR_INNERMOST (dr); + else + return &STMT_VINFO_DR_WRT_VEC_LOOP (stmt_info); +} /* Return true if the vect cost model is unlimited. */ static inline bool @@ -1144,8 +1157,7 @@ extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *); extern tree vect_get_new_ssa_name (tree, enum vect_var_kind, const char * = NULL); extern tree vect_create_addr_base_for_vector_ref (gimple *, gimple_seq *, - tree, struct loop *, - tree = NULL_TREE); + tree, tree = NULL_TREE); /* In tree-vect-loop.c. */ /* FORNOW: Used in tree-parloops.c. */ |