On 2017.04.01 at 01:00 -0400, David Malcolm wrote: > The following patch implements a new function-body-elision > optimization, which can dramatically improve performance, > especially under certain benchmarks. > > gcc/ChangeLog: > * common.opt (felide-function-bodies): New option. > * gimplify.c (gimplify_body): Implement function-body > elision. > > diff --git a/gcc/common.opt b/gcc/common.opt > index 4021622..a32a56d 100644 > --- a/gcc/common.opt > +++ b/gcc/common.opt > @@ -1299,6 +1299,10 @@ fipa-sra > Common Report Var(flag_ipa_sra) Init(0) Optimization > Perform interprocedural reduction of aggregates. > > +felide-function-bodies > +Common Optimization Var(flag_elide_function_bodies) > +Perform function body elision optimization > + > feliminate-unused-debug-symbols > Common Report Var(flag_debug_only_used_symbols) > Perform unused symbol elimination in debug info. > diff --git a/gcc/gimplify.c b/gcc/gimplify.c > index fbf136f..4853953 100644 > --- a/gcc/gimplify.c > +++ b/gcc/gimplify.c > @@ -12390,6 +12390,9 @@ gimplify_body (tree fndecl, bool do_parms) > the body so that DECL_VALUE_EXPR gets processed correctly. */ > parm_stmts = do_parms ? gimplify_parameters () : NULL; > > + if (flag_elide_function_bodies) > + DECL_SAVED_TREE (fndecl) = NULL_TREE; > + > /* Gimplify the function's body. */ > seq = NULL; > gimplify_stmt (&DECL_SAVED_TREE (fndecl), &seq);
Haha, your option also has dramatic binary size saving effects. I would suggest to enable it unconditionally on every April Fools' Day. -- Markus