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  <ebotca...@adacore.com>

        * passes.c (init_optimization_passes): Run first EH cleanup pass early.


-- 
Eric Botcazou
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

Reply via email to