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] |
Hi, The assert on which the testcase in this PR ICEs is plain wrong - I don't know what I was thinking when I put it there in the first place. The patch below simply removes the assert. Here's the long explanation why: The situation in question is a loop with induction and with multiple-data-sizes. More specifically - vectorizing an induction using a vector-size VS that cannot fit VF elements (VF = vectorization factor). This can happen, for example, if the induction is of type int, and there is another operation in the loop of type char, for which the VF=16; We need to generate 4 vector operations in order to compute 16 integer results when we vectorize the induction (i.e. ncopies = 4). This is the code that is generated: vector int vi; loop: [1] vi_0 = phi < {0,1,2,3}, vi_1 > ... [2] vi_2 = vi_0 + {4,4,4,4} [3] vi_3 = vi_2 + {4,4,4,4} [4] vi_4 = vi_3 + {4,4,4,4} ... [5] vi_1 = vi_0 + {16,16,16,16} When we vectorize a stmt that uses the induction variable - we call 'vect_get_vec_def_for_operand' to create the above def-use cycle that computes the vector induction, and it returns the first vector induction def (vi_0). For the rest of the copies, we call 'vect_get_vec_def_for_stmt_copy' (to get vi_2, vi_3, and vi_4). The ICE occurs in 'vect_get_vec_def_for_stmt_copy' where we (wrongly) assert that the previous vector-stmt is a phi-node. This is only true for the first "copy" - i.e. stmt [2]. It is not true for the rest of the copies (stmts [3],[4]). What bothered me is how come none of the induction testcases caught this. Turns out the testcase that was supposed to test this functionality - vect-iv-8.c - was accidentally missing the loop-update - so instead of an induction, we have an invariant variablbe... Also, the offending assert is always true for the first copy-stmt (and only for it), so when ncopies = 2 (which is the case in vect-iv-8.c) we don't ICE (cause in that case we have only one copy stmt)... Bootsrapped on powerpc-linux and i386-linux. Tested on the vectorizer testcases on these platforms. OK for mainline? thanks, dorit :ADDPATCH vectorizer (non-algorithmic): * tree-vect-trasnform.c (vect_get_vec_def_for_stmt_copy): Remove wrong assert. * gcc.dg/vect/vect-iv-8.c: Fix to include an induction. Xfail. * gcc.dg/vect/vect-iv-8a.c: New (same as above, but signed). * gcc.dg/vect/pr30795.c: New. (See attached file: feb18.pr30795.txt)
Attachment:
feb18.pr30795.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |