r235904 - in /trunk/gcc: ChangeLog cfgcleanup.c

segher@gcc.gnu.org segher@gcc.gnu.org
Wed May 4 20:54:00 GMT 2016


Author: segher
Date: Wed May  4 20:54:47 2016
New Revision: 235904

URL: https://gcc.gnu.org/viewcvs?rev=235904&root=gcc&view=rev
Log:
cfgcleanup: Fold jumps and conditional branches with returns

This patch makes cfgcleanup optimize jumps to returns.  There are three
cases this handles:

-- A jump to a return; this is simplified to just that return.
-- A conditional branch to a return; simplified to a conditional return.
-- A conditional branch that falls through to a return.  This is simplified
   to a conditional return (with the condition inverted), falling through
   to a jump to the original destination.  That jump can then be optimized
   further, as usual.

This handles all cases the current function.c does, and a few it misses.


	* cfgcleanup.c (bb_is_just_return): New function.
	(try_optimize_cfg): Simplify jumps to return, branches to return,
	and branches around return.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgcleanup.c



More information about the Gcc-cvs mailing list