------- Comment #13 from ubizjak at gmail dot com 2008-02-06 14:11 ------- I think that following difference is the key:
In case vectorizer is able to vecotrize, we enter vectorizer pass with: <bb 3>: # ivtmp.17_1 = PHI <ivtmp.17_2(4), 26(2)> # i_18 = PHI <i_10(4), 0(2)> # s_17 = PHI <s_9(4), X_3(D)(2)> D.2002_7 = a[i_18]; D.2003_8 = i_18 + D.2002_7; s_9 = D.2003_8 + s_17; i_10 = i_18 + 1; ivtmp.17_2 = ivtmp.17_1 - 1; if (ivtmp.17_2 != 0) goto <bb 4>; else goto <bb 5>; and in case vectorizer is not able to vectorize (your case): <bb 3>: # ivtmp.17_1 = PHI <ivtmp.17_2(4), 26(2)> # s_18 = PHI <s_9(4), X_3(D)(2)> # i_17 = PHI <i_10(4), 0(2)> D.2020_7 = a[i_17]; D.2021_8 = s_18 + i_17; s_9 = D.2021_8 + D.2020_7; i_10 = i_17 + 1; ivtmp.17_2 = ivtmp.17_1 - 1; if (ivtmp.17_2 != 0) goto <bb 4>; else goto <bb 5>; In success case, we have: vect-iv-9.c:15: note: detected reduction:D.2003_8 + s_17 vect-iv-9.c:15: note: Detected reduction. in your case, vectorizer chokes with: vect-iv-9.c:15: note: reduction: unknown pattern.D.2021_8 + D.2020_7 I don't know, why there is a difference between my and your tree dump... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35085