This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] PR34591 fix (vectorizer ICE)


My fix for pr34445 (http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00784.html
) did not consider the case that a reduction is detected as part of some
idiom/pattern (e.g. dot product), in which case we vectorize a new
("pattern") stmt instead of directly vectorizing each of the original stmts
that constitute the pattern. As a result, the original reduction stmt is
marked as not live, which falls out of the check that guards us from asking
about the cost of stmts that don't have a STMT_VINFO_TYPE set. The field
STMT_VINFO_TYPE is not set for (1) stmts that are not relevant (not used in
the loop) and not live (not used out of the loop), or (2) non reduction
stmts that are not relevant but are live.
The original guard checked for "!relevant && !live", which missed case (2).
The previously "fixed" guard checked for "!relevant && !reduction", which
missed  case (1) if the stmt was a reduction.
In this patch the guard is fixed to check all of (1) + (2), and hopefully
doesn't miss anything.

Bootstrapped with vectorization enabled on powerpc64-linux.
Bootstrapped on i686-linux.
To be committed to mainline once full regression testing is complete.

dorit

        PR tree-optimization/34591
        * tree-vect-trasnform.c (vect_estimate_min_profitable_iters): Skip
        stmts (including reduction stmts) that are not live.

        PR tree-optimization/34591
        * gcc.dg/vect/pr34591.c: New test..


new testcase:

/* { dg-do compile } */

int av_resample(int filter_length, short *src, short *filter)
{
    int i;
    int val=0;
    for(i=0; i<filter_length; i++)
      val += src[ i ] * filter[i];
    return val;
}

/* { dg-final { cleanup-tree-dump "vect" } } */


(See attached file: pr34591fix.txt)

Attachment: pr34591fix.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]