https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113779
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-02-06
Ever confirmed|0 |1
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's already visible with a simple
void f(const long* src, long* dst)
{
*dst++ = *src++;
*dst = *src;
}
where we expand to RTL from
_1 = *src_3(D);
*dst_4(D) = _1;
_2 = MEM[(const long int *)src_3(D) + 4B];
MEM[(long int *)dst_4(D) + 4B] = _2;
there's nothing on GIMPLE that would split the add and RTLs auto-inc-dec
pass doesn't do anything either. We'd need a form of "strength-reduction"
or maybe targets prefering auto-inc/dec should not legitimize constant
offsets before reload ...
Note with one more copy you then see
_1 = *src_4(D);
*dst_5(D) = _1;
_2 = MEM[(const long int *)src_4(D) + 4B];
MEM[(long int *)dst_5(D) + 4B] = _2;
_3 = MEM[(const long int *)src_4(D) + 8B];
MEM[(long int *)dst_5(D) + 8B] = _3;
and naiively splitting gives you
src_6 = src_4(D) + 4;
src_7 = src_4(D) + 8;
that said, it's really sth for RTL since it's going to be highly target
dependent which form is more efficient. The auto-inc pass is well
structured, so it should be possible to extend it.