[PATCH] Optimize SELECT CASE for character length 1

Tobias Burnus tobias.burnus@physik.fu-berlin.de
Thu Jul 15 13:55:00 GMT 2010


On Thu, Jul 15, 2010 at 03:43:55PM +0200, Jakub Jelinek wrote:
> Here is an updated, so far untested, patch.  I've noticed that select_struct
> should be GTY(()) marked to avoid it being eaten by GC, the other statics
> are just fields of that struct, so they are accessible from select_struct by
> GC.
> 
> Ok for trunk if this passes bootstrap/regtest?

Yes. Thanks for the patch!

Tobias
 
> 2010-07-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* trans.h (gfc_string_to_single_character): New prototype.
> 	* trans-expr.c (string_to_single_character): Renamed to ...
> 	(gfc_string_to_single_character): ... this.  No longer static.
> 	(gfc_conv_scalar_char_value, gfc_build_compare_string,
> 	gfc_trans_string_copy): Adjust callers.
> 	* config-lang.in (gtfiles): Add fortran/trans-stmt.c.
> 	* trans-stmt.c: Include ggc.h and gt-fortran-trans-stmt.h.
> 	(select_struct): Move to toplevel, add GTY(()).
> 	(gfc_trans_character_select): Optimize SELECT CASE
> 	with character length 1.
> 
> 	* gfortran.dg/select_char_2.f90: New test.



More information about the Gcc-patches mailing list