[patch, scev] Fix PR tree-optimization/36630

Daniel Berlin dberlin@dberlin.org
Thu Jul 17 12:33:00 GMT 2008


On Thu, Jul 17, 2008 at 4:25 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
> Hi,
>
> The test in PR36630 ICEs, since evolution_part_in_loop_num returns NULL for
> the access function (short int) {(short unsigned int) i_44, +, 1}_1).
> Adding STRIP_NOPS before chrec's analysis solves the problem.

How did the access function get a cast in front of it in the first place?

My admittedly possibly out of date recollection is that casts can only
occur inside the chrec.

>
> (The access function is for vectorizer created calculation of peeling
> needed for misaligned access, and, therefore, the failure occurs during the
> transformation phase of the vectorizer (for the code created by the
> vectorizer).

Sure sure, but the real question is "it is valid to have a chrec with
a cast in front of it".

If so, then *all* the functions that extract data from chrecs need to
be modified approriately to handle it, not just the one you've
modified below.

>We assume that all the checks were done during the analysis
> phase, and don't expect anything to go wrong during the transformation.
> This is why the vectorizer can't simply give up the vectorization of this
> loop at this stage.)
>
> Bootstrapped and tested on x86_linx. O.K. for 4.3 branch and mainline?
>
> Thanks,
> Ira
>
> ChangeLog:
>
>      PR tree-optimization/36630
>      * tree-chrec.c (chrec_component_in_loop_num): Run STRIP_NOPS on
> CHREC.
>
>
>      PR tree-optimization/36630
>      * gcc.dg/vect/pr36630.c: New test.
>
>
> Index: tree-chrec.c
> ===================================================================
> --- tree-chrec.c        (revision 137271)
> +++ tree-chrec.c        (working copy)
> @@ -696,6 +696,8 @@ chrec_component_in_loop_num (tree chrec,
>   tree component;
>   struct loop *loop = get_loop (loop_num), *chloop;
>
> +  STRIP_NOPS (chrec);
> +
>   if (automatically_generated_chrec_p (chrec))
>     return chrec;
>
> Index: testsuite/gcc.dg/vect/pr36630.c
> ===================================================================
> --- testsuite/gcc.dg/vect/pr36630.c     (revision 0)
> +++ testsuite/gcc.dg/vect/pr36630.c     (revision 0)
> @@ -0,0 +1,19 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target vect_int } */
> +
> +void
> +foo (unsigned char *x, short y)
> +{
> +  short i;
> +
> +  i = 2;
> +  while (i < y)
> +    {
> +      x[i - 1] = x[i];
> +      i = i + 1;
> +    }
> +}
> +}
> +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  } } */
> +/* { dg-final { cleanup-tree-dump "vect" } } */
> +
>
>



More information about the Gcc-patches mailing list