This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Optimize 'a ' as single char string too


On Tue, Jul 13, 2010 at 11:07:15PM -0700, Steve Kargl wrote:
> On Tue, Jul 13, 2010 at 10:33:46PM +0200, Jakub Jelinek wrote:
> > 
> > 2010-07-13  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	* trans-expr.c (string_to_single_character): Also optimize
> > 	string literals containing a single char followed only by spaces.
> > 	(gfc_trans_string_copy): Remove redundant string_to_single_character
> > 	calls.
> > 
> 
> If you haven't committed your patch based on my OK,
> can you hold off a bit?  I have received a query about
> whether trailing whitespace in a string needs to be
> omitted by a TRIM call.

It is already committed.  If needed, this optimization could be guarded by
an extra flag passed to the function, I think both uses in
gfc_build_compare_string and the first use in gfc_trans_string_copy
definitely don't care about the trailing whitespace, the second case in
gfc_trans_string_copy shouldn't hit that (you can't assign into a string
literal).  In gfc_conv_scalar_char_value I'm not 100% sure (but we certainly
should have testcases in the testsuite covering that if there are issues)...

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]