https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111402
Bug ID: 111402 Summary: Loop distribution fail to optimize memmove for multiple consecutive moves within a loop Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com Target Milestone: --- cat test.c typedef long long v4di __attribute__((vector_size(32))); void foo (v4di* __restrict a, v4di *b, int n) { for (int i = 0; i != n; i++) a[i] = b[i]; } void foo1 (v4di* __restrict a, v4di *b, int n) { for (int i = 0; i != n; i+=2) { a[i] = b[i]; a[i+1] = b[i+1]; } } gcc -O2 -S test.c GCC can optimize loop in foo to memmove, but not for loop in foo1. This is from PR111354