aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-09-13 16:27:41 +0200
committerRichard Biener <rguenther@suse.de>2021-09-15 12:35:54 +0200
commitfeebc22ba934f154aad6d8cad6cce0adf1d4610e (patch)
tree30d80a51f6522cdb02d9aa0e3ff5cc1d54813076 /gcc/tree-vectorizer.h
parente4d3643361df1145b34265c398e901498548c6e6 (diff)
downloadgcc-feebc22ba934f154aad6d8cad6cce0adf1d4610e.zip
gcc-feebc22ba934f154aad6d8cad6cce0adf1d4610e.tar.gz
gcc-feebc22ba934f154aad6d8cad6cce0adf1d4610e.tar.bz2
Maintain (mis-)alignment info in the first element of a group
This changes us to maintain and compute (mis-)alignment info for the first element of a group only rather than for each DR when doing interleaving and for the earliest, first, or first in the SLP node (or any pair or all three of those) when SLP vectorizing. For this to work out the easiest way I have changed the accessors DR_MISALIGNMENT and DR_TARGET_ALIGNMENT to do the indirection to the first element rather than adjusting all callers. 2021-09-13 Richard Biener <rguenther@suse.de> * tree-vectorizer.h (dr_misalignment): Move out of line. (dr_target_alignment): New. (DR_TARGET_ALIGNMENT): Wrap dr_target_alignment. (set_dr_target_alignment): New. (SET_DR_TARGET_ALIGNMENT): Wrap set_dr_target_alignment. * tree-vect-data-refs.c (dr_misalignment): Compute and return the group members misalignment. (vect_compute_data_ref_alignment): Use SET_DR_TARGET_ALIGNMENT. (vect_analyze_data_refs_alignment): Compute alignment only for the first element of a DR group. (vect_slp_analyze_node_alignment): Likewise.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 7453d2a..c4c5678 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1606,13 +1606,7 @@ set_dr_misalignment (dr_vec_info *dr_info, int val)
dr_info->misalignment = val;
}
-inline int
-dr_misalignment (dr_vec_info *dr_info)
-{
- int misalign = dr_info->misalignment;
- gcc_assert (misalign != DR_MISALIGNMENT_UNINITIALIZED);
- return misalign;
-}
+extern int dr_misalignment (dr_vec_info *dr_info);
/* Reflects actual alignment of first access in the vectorized loop,
taking into account peeling/versioning if applied. */
@@ -1620,7 +1614,21 @@ dr_misalignment (dr_vec_info *dr_info)
#define SET_DR_MISALIGNMENT(DR, VAL) set_dr_misalignment (DR, VAL)
/* Only defined once DR_MISALIGNMENT is defined. */
-#define DR_TARGET_ALIGNMENT(DR) ((DR)->target_alignment)
+static inline const poly_uint64
+dr_target_alignment (dr_vec_info *dr_info)
+{
+ if (STMT_VINFO_GROUPED_ACCESS (dr_info->stmt))
+ dr_info = STMT_VINFO_DR_INFO (DR_GROUP_FIRST_ELEMENT (dr_info->stmt));
+ return dr_info->target_alignment;
+}
+#define DR_TARGET_ALIGNMENT(DR) dr_target_alignment (DR)
+
+static inline void
+set_dr_target_alignment (dr_vec_info *dr_info, poly_uint64 val)
+{
+ dr_info->target_alignment = val;
+}
+#define SET_DR_TARGET_ALIGNMENT(DR, VAL) set_dr_target_alignment (DR, VAL)
/* Return true if data access DR_INFO is aligned to its target alignment
(which may be less than a full vector). */