This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/57723] Missed optimization: recursion around empty function
- From: "matz at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 26 Jun 2013 13:44:34 +0000
- Subject: [Bug tree-optimization/57723] Missed optimization: recursion around empty function
- Auto-submitted: auto-generated
- References: <bug-57723-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57723
Michael Matz <matz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matz at gcc dot gnu.org
--- Comment #6 from Michael Matz <matz at gcc dot gnu.org> ---
The loop in loop() isn't removed because it's potentially infinite, and GCC
doesn't remove infinite loops by default. Add -funsafe-loop-optimizations
to do that (loop() will then become an empty function).
The recursion isn't removed because all calls to non-const non-pure functions
are deemed necessary. dead code removal could be made to handle this with
some trickery. We'd need to not mark recursive calls as inherently necessary
at first, but only later if we mark anything in the function except the return
statement necessary.