This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Avoid versioning loop with unaligned step
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, Joern Wolfgang Rennecke <gnu at amylaar dot uk>, GCC Patches <gcc-patches at gcc dot gnu dot org>, rdsandiford at googlemail dot com
- Date: Fri, 21 Dec 2018 00:46:41 +0100
- Subject: Re: RFA: Avoid versioning loop with unaligned step
- References: <5C1B9C8E.70108@amylaar.uk> <CAFiYyc3hyzN_YTQ7WsU-8zysYv84Er=GJmfE9trOj_M1SHiMrQ@mail.gmail.com> <875zvo6kx4.fsf@googlemail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 20, 2018 at 07:46:31PM +0000, Richard Sandiford wrote:
> > vect_compute_data_ref_alignment uses DR_TARGET_ALIGNMENT
> > and DR_STEP_ALIGNMENT () % dr_target-alignment == 0 as check.
> >
> > I think it's preferable to use the same or similar values for the desired
> > alignment.
>
> Yeah, I agree testing for a multiple is better than maybe_lt,
> and that we should be using DR_TARGET_ALIGNMENT rather than
> TYPE_ALIGN_UNIT.
>
> (TYPE_ALIGN_UNIT is the ABI alignment, which might be higher or lower
> than the alignment the vectoriser is aiming for. And I think the
> reasons for bailing out apply whenever the vectoriser can't reach
> the alignment it's aiming for, even if the alignment isn't needed
> for correctness.)
r267314 seems to have broken build:
../../gcc/tree-vect-data-refs.c: In function ‘opt_result vect_enhance_data_refs_alignment(loop_vec_info)’:
../../gcc/tree-vectorizer.h:1255:40: error: ‘struct data_reference’ has no member named ‘target_alignment’
#define DR_TARGET_ALIGNMENT(DR) ((DR)->target_alignment)
^
../../gcc/tree-vect-data-refs.c:2171:11: note: in expansion of macro ‘DR_TARGET_ALIGNMENT’
DR_TARGET_ALIGNMENT (dr)))
^~~~~~~~~~~~~~~~~~~
The following patch makes it build again, will commit as obvious if it
passes bootstrap/regtest:
2018-12-21 Jakub Jelinek <jakub@redhat.com>
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Use
DR_TARGET_ALIGNMENT on dr_info rather than dr.
--- gcc/tree-vect-data-refs.c.jj 2018-12-21 00:40:50.000000000 +0100
+++ gcc/tree-vect-data-refs.c 2018-12-21 00:43:35.786222062 +0100
@@ -2168,7 +2168,7 @@ vect_enhance_data_refs_alignment (loop_v
done by doing some iterations of the non-vectorized loop. */
if (!multiple_p (LOOP_VINFO_VECT_FACTOR (loop_vinfo)
* DR_STEP_ALIGNMENT (dr),
- DR_TARGET_ALIGNMENT (dr)))
+ DR_TARGET_ALIGNMENT (dr_info)))
{
do_versioning = false;
break;
Jakub