aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.h
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-04 10:40:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-04 10:40:35 +0000
commit9adee3052156ae36271be28e3ad47dd975c26f42 (patch)
tree6f0ef701d303fb3c40566aa3bcbea2eea6ba1a52 /gcc/tree-data-ref.h
parentdfbddbeb1ca912c9f9f806d8cff55a6ac2887d89 (diff)
downloadgcc-9adee3052156ae36271be28e3ad47dd975c26f42.zip
gcc-9adee3052156ae36271be28e3ad47dd975c26f42.tar.gz
gcc-9adee3052156ae36271be28e3ad47dd975c26f42.tar.bz2
Use base inequality for some vector alias checks
This patch checks whether two data references x and y cannot partially overlap and so are independent whenever &x != &y. We can then use this in the vectoriser to optimise alias checks. gcc/ 2016-08-04 Richard Sandiford <richard.sandiford@linaro.org> * hash-traits.h (pair_hash): New struct. * tree-data-ref.h (data_dependence_relation): Add object_a and object_b fields. (DDR_OBJECT_A, DDR_OBJECT_B): New macros. * tree-data-ref.c (initialize_data_dependence_relation): Initialize DDR_OBJECT_A and DDR_OBJECT_B. * tree-vectorizer.h (vec_object_pair): New type. (_loop_vec_info): Add a check_unequal_addrs field. (LOOP_VINFO_CHECK_UNEQUAL_ADDRS): New macro. (LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Return true if there is an entry in check_unequal_addrs. Check comp_alias_ddrs instead of may_alias_ddrs. * tree-vect-loop.c (destroy_loop_vec_info): Release LOOP_VINFO_CHECK_UNEQUAL_ADDRS. (vect_analyze_loop_2): Likewise, when restarting. (vect_estimate_min_profitable_iters): Estimate the cost of LOOP_VINFO_CHECK_UNEQUAL_ADDRS. * tree-vect-data-refs.c: Include tree-hash-traits.h. (vect_prune_runtime_alias_test_list): Try to handle conflicts using LOOP_VINFO_CHECK_UNEQUAL_ADDRS, if the data dependence allows. Count such tests in the final summary. * tree-vect-loop-manip.c (chain_cond_expr): New function. (vect_create_cond_for_align_checks): Use it. (vect_create_cond_for_unequal_addrs): New function. (vect_loop_versioning): Call it. gcc/testsuite/ * gcc.dg/vect/vect-alias-check-6.c: New test. From-SVN: r250868
Diffstat (limited to 'gcc/tree-data-ref.h')
-rw-r--r--gcc/tree-data-ref.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index ef02df7..0f22d9d 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -309,6 +309,13 @@ struct data_dependence_relation
but the analyzer cannot be more specific. */
tree are_dependent;
+ /* If nonnull, COULD_BE_INDEPENDENT_P is true and the accesses are
+ independent when the runtime addresses of OBJECT_A and OBJECT_B
+ are different. The addresses of both objects are invariant in the
+ loop nest. */
+ tree object_a;
+ tree object_b;
+
/* For each subscript in the dependence test, there is an element in
this array. This is the attribute that labels the edge A->B of
the data_dependence_relation. */
@@ -372,6 +379,8 @@ typedef struct data_dependence_relation *ddr_p;
#define DDR_B(DDR) (DDR)->b
#define DDR_AFFINE_P(DDR) (DDR)->affine_p
#define DDR_ARE_DEPENDENT(DDR) (DDR)->are_dependent
+#define DDR_OBJECT_A(DDR) (DDR)->object_a
+#define DDR_OBJECT_B(DDR) (DDR)->object_b
#define DDR_SUBSCRIPTS(DDR) (DDR)->subscripts
#define DDR_SUBSCRIPT(DDR, I) DDR_SUBSCRIPTS (DDR)[I]
#define DDR_NUM_SUBSCRIPTS(DDR) DDR_SUBSCRIPTS (DDR).length ()