This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/47255] Missed CSE optimization with inline functions, and __attribute__((const))
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Jan 2011 11:10:34 +0000
- Subject: [Bug tree-optimization/47255] Missed CSE optimization with inline functions, and __attribute__((const))
- Auto-submitted: auto-generated
- References: <bug-47255-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47255
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.01.12 11:10:22
Component|c |tree-optimization
Ever Confirmed|0 |1
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-12 11:10:22 UTC ---
Sure, it is a missed optimization. It's even "easy" to fix when you accept
a general compile-time slowdown (just schedule some CSE passes before
inlining).
When you want to avoid the compile-time slowdown then it's not so easy
(it's a usual trade-off with the case where there is no CSE opportunity but
earlier inlining would result in better code).
You can force GCC to not inline the function with using
__attribute__((const,noinline)) (but it of course will then be not
inlined at all).