This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Question about comment in vect_prune_runtime_alias_test_list
- From: "Bin.Cheng" <amker dot cheng at gmail dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 18 May 2017 12:20:28 +0100
- Subject: Question about comment in vect_prune_runtime_alias_test_list
- Authentication-results: sourceware.org; auth=none
Hi,
In that function, we have below comments:
/* Basically, for each pair of dependent data refs store_ptr_0
and load_ptr_0, we create an expression:
((store_ptr_0 + store_segment_length_0) <= load_ptr_0)
|| (load_ptr_0 + load_segment_length_0) <= store_ptr_0))
for aliasing checks. However, in some cases we can decrease
the number of checks by combining two checks into one. For
example, suppose we have another pair of data refs store_ptr_0
and load_ptr_1, and if the following condition is satisfied:
load_ptr_0 < load_ptr_1 &&
load_ptr_1 - load_ptr_0 - load_segment_length_0 < store_segment_length_0
(this condition means, in each iteration of vectorized loop,
the accessed memory of store_ptr_0 cannot be between the memory
of load_ptr_0 and load_ptr_1.)
we then can use only the following expression to finish the
alising checks between store_ptr_0 & load_ptr_0 and
store_ptr_0 & load_ptr_1:
((store_ptr_0 + store_segment_length_0) <= load_ptr_0)
|| (load_ptr_1 + load_segment_length_1 <= store_ptr_0))
Note that we only consider that load_ptr_0 and load_ptr_1 have the
same basic address. */
I don't quite follow the example. If (load_ptr_0 < load_ptr_1) is
true, IIUC store_ptr_0 & load_ptr_0 and store_ptr_0 & load_ptr_1 can
be simplified to:
((store_ptr_0 + store_segment_length_0) <= load_ptr_0)
|| (load_ptr_1 + load_segment_length_1 <= store_ptr_0))
under conditions:
load_ptr_0 + load_segment_length_0 < load_ptr_1 + load_segment_length_1
But I can't get this from:
load_ptr_0 < load_ptr_1 &&
load_ptr_1 - load_ptr_0 - load_segment_length_0 < store_segment_length_0
Also it looks like the comment doesn't match code either. The code
merges checks for store_ptr_0 & load_ptr_0 and store_ptr_0 &
load_ptr_1, but the comment is more like mixed checks between the two
pairs.
Thanks,
bin