On Mon, 16 Sep 2013, Jakub Jelinek wrote:

> Hi!
> 
> This patch fixes two issues I found on the pr58392.c testcase:
> 1) we weren't copying decl attributes, so e.g. inside #pragma omp parallel
> "omp simd array" temporary arrays lost their attribute and weren't
> adjusted because of that
> 2) DR_ALIGNED_TO wasn't reset after resetting DR_OFFSET on simd lane access
> DRs, which resulted in the vectorizer trying to peel for alignment on those.
> Those are always automatic vars that can be just aligned more.
> 
> Ok?
> 
> 2013-09-16  Jakub Jelinek  <ja...@redhat.com>
> 
>       * omp-low.c (copy_var_decl): Copy DECL_ATTRIBUTES.
>       * tree-vect-data-refs.c (vect_analyze_data_refs): For
>       simd_lane_access drs, update also DR_ALIGNED_TO.
> 
> --- gcc/omp-low.c.jj  2013-09-16 10:08:43.000000000 +0200
> +++ gcc/omp-low.c     2013-09-16 15:25:31.683903448 +0200
> @@ -888,6 +888,7 @@ copy_var_decl (tree var, tree name, tree
>    TREE_NO_WARNING (copy) = TREE_NO_WARNING (var);
>    TREE_USED (copy) = 1;
>    DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
> +  DECL_ATTRIBUTES (copy) = DECL_ATTRIBUTES (var);
>  
>    return copy;
>  }

Ok.

> --- gcc/tree-vect-data-refs.c.jj      2013-09-13 16:48:28.000000000 +0200
> +++ gcc/tree-vect-data-refs.c 2013-09-16 14:47:56.500538758 +0200
> @@ -3039,6 +3039,9 @@ again:
>                                   {
>                                     DR_OFFSET (newdr) = ssize_int (0);
>                                     DR_STEP (newdr) = step;
> +                                   DR_ALIGNED_TO (newdr)
> +                                     = size_int (highest_pow2_factor
> +                                                     (DR_OFFSET (newdr)));

That looks odd - DR_OFFSET (newdr) is constant zero, so you can
as well immediately use BIGGEST_ALIGNMENT here (that's what
highest_pow2_factor does).

Ok with that change.

Thanks,
Richard.

>                                     dr = newdr;
>                                     simd_lane_access = true;
>                                   }
> 
>       Jakub
> 

Reply via email to