https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94828
Bug ID: 94828 Summary: Failure to merge merge-able loops Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- void f(int *__restrict a, int *__restrict b, size_t sz) { for (int i = 0; i < sz; ++i) a[i] += b[i]; for (int i = 0; i < sz; ++i) a[i] += b[i]; } These two loops could be merged into a single one doing two additions per iteration. ICC does this transformation, GCC does not. Also, I'd like to note that from the GCC output, only the first loop is vectorized, and not the second one. See https://godbolt.org/z/DfGpSi