On Mon, Jun 6, 2016 at 6:00 PM, Bin Cheng <bin.ch...@arm.com> wrote:
> Hi,
> GCC now generates duplicated alias check in vectorizer when versioning loops. 
>  In current implementation, DR_OFFSET and DR_INIT are added together too 
> early when creating structure dr_with_seg_len.  This has two disadvantages: 
> A) structure dr_with_seg_len_pair_t is only canonicalized against 
> DR_BASE_ADDRESS in function vect_prune_runtime_alias_test_list, while it 
> should be against DR_OFFSET too; B) When function 
> vect_prune_runtime_alias_test_list tries to merge aias checks with 
> consecutive memory references, it can only handle DRs with constant DR_OFFSET 
> + DR_INIT, as in below code:
>           /* We consider the case that DR_B1 and DR_B2 are same memrefs,
>              and DR_A1 and DR_A2 are two consecutive memrefs.  */
>           //... ...
>           if (!operand_equal_p (DR_BASE_ADDRESS (dr_a1->dr),
>                                 DR_BASE_ADDRESS (dr_a2->dr),
>                                 0)
>               || !tree_fits_shwi_p (dr_a1->offset)
>               || !tree_fits_shwi_p (dr_a2->offset))
>             continue;
>
> Both disadvantages result in duplicated/unnecessary alias checks, as well as 
> bloated condition basic block of loop versioning.
> This patch fixes the issue.  Bootstrap and test on x86_64 and AArch64.  Is it 
> OK?
> Test gfortran.dg/vect/vect-8.f90 failed now.  It scans for "vectorized 20 
> loops" but with this patch there are more than 20 loops vectorized.  The 
> additional loop wasn't vectorized because # of alias checks exceeded 
> parameter bound "vect-max-version-for-alias-checks" w/o this patch.
>
> There are other issues in vectorizer alias checking, I will tackle them in 
> follow up patches.

Ok.

Thanks,
Richard.

> Thanks,
> bin
>
> 2016-06-03  Bin Cheng  <bin.ch...@arm.com>
>
>         * tree-vectorizer.h (struct dr_with_seg_len): Remove class
>         member OFFSET.
>         * tree-vect-data-refs.c (operator ==): Handle DR_OFFSET directly,
>         rather than OFFSET.
>         (comp_dr_with_seg_len_pair, comp_dr_with_seg_len_pair): Ditto.
>         (vect_create_cond_for_alias_checks): Ditto.
>         (vect_prune_runtime_alias_test_list): Also canonicalize pairs
>         against DR_OFFSET.  Handle DR_OFFSET directly when prune alias
>         checks.
>
> gcc/testsuite/ChangeLog
> 2016-06-03  Bin Cheng  <bin.ch...@arm.com>
>
>         * gcc.dg/vect/vect-alias-check-1.c: New test.

Reply via email to