https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118557
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2025-01-19 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Couple of missed optimizations which is causing the vectorizer to decide to over vectorize: ``` _15 = SR.26_4 + _21; if (SR.26_4 != _15) goto <bb 10>; [89.00%] else goto <bb 14>; [11.00%] ;; succ: 10 [89.0% ... ``` Should just be if (_21 != 0) Note I change copy to be: ```static inline void copy(span in, span out) { auto f = in.begin(); auto o = out.begin(); auto s = in.size(); for(size_t t = 0; t < s; t++) { *o++ = *f++; } } ``` It works.