http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60276
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #6) > But you can clearly see that this isn't valid vectorization because of the > read-after-write dependence of out[x]. Well, only after unrolling which happens here - then the introduced dependence (we CSE the in-source one) becomes explicit: tem0 = lp[target] - ((hp[target] + hp[target - 1] + 2) >> 2); out[x] = tem0; out[x - 1] = hp[target - 1] + ((out[x - 2] + tem0) >> 1); tem2 = lp[target + 1] - ((hp[target + 1] + hp[target] + 2) >> 2); out[x + 2] = tem2; out[x + 1] = hp[target] + ((out[x] + tem2) >> 1); thus static bool vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, loop_vec_info loop_vinfo, int *max_vf) { ... if (dist > 0 && DDR_REVERSED_P (ddr)) { /* If DDR_REVERSED_P the order of the data-refs in DDR was reversed (to make distance vector positive), and the actual distance is negative. */ if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "dependence distance negative.\n"); continue; } becomes invalid once we unroll if the distance is less than the vectorization factor. Unless we apply the same CSE during vectorization transform.