On Wed, Jan 15, 2014 at 10:24 AM, Eric Botcazou <ebotca...@adacore.com> wrote: > Hi, > > we have run into optimization regressions in Ada caused by the interaction > between the GIMPLE clobbers and SRA: on the one hand GIMPLE clobbers create > artificial EH handlers for aggregate variables, on the other hand SRA refuses > to scalarize objects that appear in a statement that can throw internally. > The result is that GIMPLE clobbers block the scalarization of variables that > used to be possible up to the 4.6 series. Testcase attached, compile p.adb on > x86-64 with -O2 -fdump-tree-ealias -fdump-tree-esra. > > This can be solved by moving the ehcleanup pass to before early SRA in > the pipeline. It has a small but measurable positive effect on some of our > benchmarks (with a 4.7-based compiler). Tested on x86-64/Linux. > > Thoughts?
What you want is tree-eh.c:optimize_clobbers, right? Can't we do this optimization during EH refactoring / lowering as well? Also why does SRA refuse to scalarize here? It will end up scalarizing during regular opts as <L1>: result = decls_support.get_private (100); result$i_12 = MEM[(struct decls_support__t_private *)&result]; where it can do the scalarization just fine if it inserts on all non-EH successor edges (so not doing the scalarization only if there is more than one non-EH successor edge would make sense). The current placement of EH cleanup is to make it catch all opportunities before early inlining sees the function as callee. And I guess both FRE and DCE will expose quite some EH cleanup opportunities especially with non-call-exceptions. Richard. > > 2014-01-15 Eric Botcazou <ebotca...@adacore.com> > > * passes.def (pass_early_local_passes): Run first EH cleanup pass > early. > > > -- > Eric Botcazou