Sebastian Pop wrote: > Jeff Law wrote: > > OK to commit. Thanks for your patience. > > > > Can you follow-up with a change which throttles this optimization > > when -Os is in effect. You can check optimize_function_for_size_p > > (cfun) and simply avoid the backward traversal or you could allow it > > in that case if the amount of copying is suitably small. Your call. > > I think it does not make sense to duplicate paths at -Os: I disabled the FSM > jump-threading when optimizing for size like this. > > diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c > index 29b20c8..ce70311 100644 > --- a/gcc/tree-ssa-threadedge.c > +++ b/gcc/tree-ssa-threadedge.c > @@ -1335,8 +1335,9 @@ thread_through_normal_block (edge e, > return 1; > } > > if (!flag_expensive_optimizations > + || optimize_function_for_size_p (cfun) > || TREE_CODE (cond) != SSA_NAME > || e->dest->loop_father != e->src->loop_father > || loop_depth (e->dest->loop_father) == 0) > return 0; > > I will regstrap and commit the attached patch.
Bootstrapped and regression tested on x86_64-linux. Committed r218451. Sebastian