[Bug tree-optimization/57723] Missed optimization: recursion around empty function

matz at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 26 13:44:00 GMT 2013


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.



More information about the Gcc-bugs mailing list