On Wed, 11 Sep 2019 at 11:50, Wilco Dijkstra <wilco.dijks...@arm.com> wrote: > > While code hoisting generally improves codesize, it can affect performance > negatively. Benchmarking shows it doesn't help SPEC and negatively affects > embedded benchmarks, so only enable code hoisting with -Os on Arm. > > Bootstrap OK, OK for commit? Hi Wilco, My only concern with the patch is that the issue isn't specific to code-hoisting. For this particular case (reproducible with pr77445-2.c), disabling jump threading doesn't cause the register spill with hoisting enabled. Likewise disabling forwprop3 and forwprop4 prevents the spill. The last time I tried, setting setting max-jump-thread-duplication-stmts to 20 and fsm-scale-path-stmts to 3, not only removed the spill but also resulted in 9 more hoistings, but regressed some other test on jump threading. So I was wondering whether we should look into fine-tuning relevant params, instead of disabling code hoisting entirely (we will end up regressing some test cases either way) ?
Thanks, Prathamesh > > ChangeLog: > 2019-09-11 Wilco Dijkstra <wdijk...@arm.com> > > > PR tree-optimization/80155 > * common/config/arm/arm-common.c (arm_option_optimization_table): > Enable -fcode-hoisting with -Os. > > -- > diff --git a/gcc/common/config/arm/arm-common.c > b/gcc/common/config/arm/arm-common.c > index > 41a920f6dc96833e778faa8dbcc19beac483734c..b0d5fb300bf01acc1fb6f4631635f8a1bfe6441c > 100644 > --- a/gcc/common/config/arm/arm-common.c > +++ b/gcc/common/config/arm/arm-common.c > @@ -39,6 +39,8 @@ static const struct default_options > arm_option_optimization_table[] = > /* Enable section anchors by default at -O1 or higher. */ > { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 }, > { OPT_LEVELS_1_PLUS, OPT_fsched_pressure, NULL, 1 }, > + /* Enable code hoisting only with -Os. */ > + { OPT_LEVELS_SIZE, OPT_fcode_hoisting, NULL, 1 }, > { OPT_LEVELS_NONE, 0, NULL, 0 } > }; > >