[patch] PR33301 fix (vectorizer ICE)

Dorit Nuzman DORIT@il.ibm.com
Tue Sep 4 19:27:00 GMT 2007


This testcase: gfortran.dg/g77/990115-1.f
ICEs when compiled with vectorization enabled because of the following
wrong  assumption in
tree-vect-analyze.c:vect_determine_vectorization_factor:
"
/* We set the vectype according to the type of the result (lhs).
   For stmts whose result-type is different than the type of the
   arguments (e.g. demotion, promotion), vectype will be reset
   appropriately (later).  Note that we have to visit the smallest
   datatype in this function, because that determines the VF.
   If the smallest datatype in the loop is present only as the
   rhs of a promotion operation - we'd miss it here.
   However, in such a case, that a variable of this datatype
   does not appear in the lhs anywhere in the loop, it shouldn't
   affect the vectorization factor.   */
"

however we can have a situation in which the smallest data-type in the
loop never appears in the lhs: in the above testcase we have an invariant
stmt that is not taken out of the loop before vectorization:
  D.1363_9 = (real8) s2_8(D);
(s2_8 is invariant, and so is not defined in the loop, thus doesn't appear
in the lhs of any stmt in the loop).

(Indeed when compiling also with --param lim-expensive=1, the invariant
stmt is
taken out of the loop and the testcase passes).

To fix that we now also look at the type of the rhs in relevant cases.

Bootstrapped with vectorization enabled on i386-linux, and bootstrapped on
powerpc64-linux. Passed the vectorizer testcases on both platforms.
Will commit once full regression testing completes.

dorit

ChangeLog:

      * tree-vect-analyze.c (vect_determine_vectorization_factor): Look
      at the type of the rhs when relevant.

Patch:

(See attached file: testsuitefix)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsuitefix
Type: application/octet-stream
Size: 2878 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070904/6dad0c31/attachment.obj>


More information about the Gcc-patches mailing list