This is the mail archive of the
mailing list for the GCC project.
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 <email@example.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)...