https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88398
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org Blocks| |53947 --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Well, the main issue is that the loop has two exits which is something the vectorizer doesn't support (with a hard check). Jakub explains why that is so. You could change the loop to sth like unsigned char *p = cur + pos; int len = 0; int diff_pos = __INT_MAX__; while (++len != max) if (p[len] != cur[len]) diff_pos = len < diff_pos ? len : diff_pos; return cur[diff_pos]; which then runs into a limitation recently reported (two dependent reductions not recognized). Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations