This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/46847] Missed optimization for variant of Duff's device
- From: "jjk at acm dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 8 Dec 2010 12:10:05 +0000
- Subject: [Bug other/46847] Missed optimization for variant of Duff's device
- Auto-submitted: auto-generated
- References: <bug-46847-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46847
--- Comment #3 from Jens Kilian <jjk at acm dot org> 2010-12-08 12:10:02 UTC ---
(In reply to comment #2)
> GCC 4.5 doesn't move end computation inside the loop. What do you expect
> to be "good" code? I get at -O[23]:
[snip]
The code generated by 4.5 is what I would have expected.
Feel free to close this as "fixed in the latest version".
> Duffs device may be a fun thing from a C language perspective, but it
> is a bad thing in general because you defy most
> loop optimizations as it is a loop with multiple entries (which means
> the loop isn't recognized as a loop by GCC).
I usually wouldn't consider using it, I just noticed the problem while
trying to tune some heavily used parts of our code.
Thanks,
Jens.