Richard Guenther - Re: [PATCH] PR tree-optimization/30771 (original) (raw)

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

We have this comment in tree-vect-analyze.c, in vect_determine_vectorization_facor(): " /* 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. */ " The problem is, that some computations, e.g. - the recently added induction, are defined by a loop-header-phi-node, and we don't traverse phi nodes in this function, only stmts... so exactly what we warn about in the comment happens in the testcase that ICEs.

This patch adds a loop that does pretty much the same as the loop that traverses all stmts, only for phis - looking for the smallest type over all phis. In order to avoid considering irrelevant phis, we change vect_mark_stmts_to_be_vectorized() to also mark phis as relevant (when they are) - before we just skipped them cause we never vectorize phis.

Bootstrapped on powerpc-linux and i386-linux, tested on the vectorizer testcases on both platforms. Ok once passes complete make-check?