> gcc/ChangeLog: > > 2017-05-26 Martin Liska <mli...@suse.cz> > > PR tree-optimization/79489 > * gimplify.c (maybe_add_early_return_predict_stmt): New > function. > (gimplify_return_expr): Call the function. > * predict.c (tree_estimate_probability_bb): Remove handling > of early return. > * predict.def: Update comment about early return predictor. > * gimple-predict.h (is_gimple_predict): New function. > * tree-inline.c (remap_gimple_stmt): Do not copy early return > predictors during inlining. > * predict.def: Change default value of early return to 66.
Thanks for working on this. Doing tail recursion early is quite useful. Can't we make the pass to skip predict statements in analysis similar was as debug statements are skipped? > diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c > index f3ec404ef09..3f3813cb062 100644 > --- a/gcc/tree-inline.c > +++ b/gcc/tree-inline.c > @@ -1629,6 +1629,13 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) > gimple_seq_add_stmt (&stmts, copy); > return stmts; > } > + if (is_gimple_predict (stmt)) > + { > + /* Do not copy early return predictor that does not make sense > + after inlining. */ > + if (gimple_predict_predictor (stmt) == PRED_TREE_EARLY_RETURN) > + return stmts; > + } I am also not quite sure about this one. The code was still structured in a way there was early return in the inlined function, so we may still assume that the heuristic works for it? Where did you found this case? Honza > > /* Create a new deep copy of the statement. */ > copy = gimple_copy (stmt); > -- > 2.13.0 >