------- Comment #6 from irar at il dot ibm dot com 2007-10-21 12:52 ------- The solution can be just not check if the vectorization is worthwhile during the transformation. The decision whether to vectorize or not should be made during the analysis anyway. The vectorization factor can get smaller only in case that there is only SLP-kind of vectorization in the loop, and the VF is the unrolling factor needed to operate on full vectors. So the profitability of this loop vectorization doesn't change.
Index: tree-vect-transform.c =================================================================== --- tree-vect-transform.c (revision 129404) +++ tree-vect-transform.c (working copy) @@ -3865,18 +3865,21 @@ vectorizable_operation (tree stmt, block { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "op not supported by target."); + /* Check only during analysis. */ if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD - || LOOP_VINFO_VECT_FACTOR (loop_vinfo) - < vect_min_worthwhile_factor (code)) + || (LOOP_VINFO_VECT_FACTOR (loop_vinfo) + < vect_min_worthwhile_factor (code) + && !vec_stmt)) return false; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "proceeding using word mode."); } - /* Worthwhile without SIMD support? */ + /* Worthwhile without SIMD support? Check only during analysis. */ if (!VECTOR_MODE_P (TYPE_MODE (vectype)) && LOOP_VINFO_VECT_FACTOR (loop_vinfo) - < vect_min_worthwhile_factor (code)) + < vect_min_worthwhile_factor (code) + && !vec_stmt) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "not worthwhile without SIMD support."); Tested on vectorizer testsuite on x86-64-linux. Ira -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33804