Move negative stride bias out of dr_misalignment
authorRichard Biener <rguenther@suse.de>
Mon, 25 Oct 2021 11:39:07 +0000 (13:39 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 26 Oct 2021 10:29:48 +0000 (12:29 +0200)
commit94f28340513753ba94ab483e93ce1d096842a5ad
tree5003f5167c34608c17e64b23298438c50a57a2ed
parent54e4e1769e44b925c35c0ffc11723027ff855bd7
Move negative stride bias out of dr_misalignment

This moves applying of a bias for negative stride accesses out of
dr_misalignment in favor of a more general optional offset argument.
The negative bias is now computed by get_load_store_type and applied
accordingly to determine the alignment support scheme.  Likewise
the peeling/versioning code is adjusted albeit that still assumes
we'll end up with VMAT_CONTIGUOUS_DOWN or VMAT_CONTIGUOUS_REVERSE
but at least when not so (VMAT_STRIDED_SLP is one possibility) then
get_load_store_type will _not_ falsely report an aligned access but
instead an access with known misalignment.

This fixes PR96109.

2021-10-25  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96109
* tree-vectorizer.h (dr_misalignment): Add optional offset
parameter.
* tree-vect-data-refs.c (dr_misalignment): Likewise.  Remove
offset applied for negative stride accesses.
(vect_enhance_data_refs_alignment): Compute negative stride
access offset and pass it to dr_misalignment.
* tree-vect-stmts.c (get_negative_load_store_type): Pass
negative offset to dr_misalignment.
(get_group_load_store_type): Likewise.
(get_load_store_type): Likewise.
(vectorizable_store): Remove asserts about alignment.
(vectorizable_load): Likewise.
gcc/tree-vect-data-refs.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h