Patchwork [RFC] Move ehcleanup pass to before early SRA

login
register
mail settings
Submitter Eric Botcazou
Date Sept. 23, 2012, 8:46 a.m.
Message ID <1489654.ccaA29ro9n@polaris>
Download mbox | patch
Permalink /patch/186186/
State New
Headers show

Comments

Eric Botcazou - Sept. 23, 2012, 8:46 a.m.
Hi,

we have run into optimization regressions in Ada caused by the interaction 
between the new 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.

Therefore the attached patch moves 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.


2012-09-23  Eric Botcazou  <ebotcazou@adacore.com>

	* passes.c (init_optimization_passes): Run first EH cleanup pass early.
Richard Guenther - Sept. 24, 2012, 10:52 a.m.
On Sun, Sep 23, 2012 at 10:46 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> we have run into optimization regressions in Ada caused by the interaction
> between the new 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.
>
> Therefore the attached patch moves 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.

Hmm.  I think cleanup EH is scheduled late to help early inlining.  Do you
have a testcase where I can quickly look at the issue you describe?

Thanks,
Richard.

>
> 2012-09-23  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * passes.c (init_optimization_passes): Run first EH cleanup pass early.
>
>
> --
> Eric Botcazou

Patch

Index: passes.c
===================================================================
--- passes.c	(revision 191365)
+++ passes.c	(working copy)
@@ -1303,6 +1303,10 @@  init_optimization_passes (void)
 	  /* pass_build_ealias is a dummy pass that ensures that we
 	     execute TODO_rebuild_alias at this point.  */
 	  NEXT_PASS (pass_build_ealias);
+	  /* SRA refuses to scalarize objects that appear in a statement
+	     that can throw internally so we need to cleanup the EH tree
+	     early to remove handlers that contain only clobbers.  */
+	  NEXT_PASS (pass_cleanup_eh);
 	  NEXT_PASS (pass_sra_early);
 	  NEXT_PASS (pass_fre);
 	  NEXT_PASS (pass_copy_prop);
@@ -1311,7 +1315,6 @@  init_optimization_passes (void)
 	  NEXT_PASS (pass_early_ipa_sra);
 	  NEXT_PASS (pass_tail_recursion);
 	  NEXT_PASS (pass_convert_switch);
-          NEXT_PASS (pass_cleanup_eh);
           NEXT_PASS (pass_profile);
           NEXT_PASS (pass_local_pure_const);
 	  /* Split functions creates parts that are not run through