[Bug c/78408] C loop initial declarations generate wrong code
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 24 14:00:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78408
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #9)
> Note in the testcase a = (struct buf) {}, b = (struct buf) {} generates
> significantly more efficient code than a = b = (struct buf) {} - the former
> is 2x memset, the latter 1x memset + 1x memcpy.
> So, shall we for large aggregates gimplify those differently as an
> optimization?
I believe the gimplifier is not a good place to do optimization. You can
pattern-match
memset (&a, ..., N);
memcpy (&b, &a, N);
and transform it to two times memset.
More information about the Gcc-bugs
mailing list