This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/53591] New: Front-end optimize empty string assignments
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 06 Jun 2012 13:30:12 +0000
- Subject: [Bug fortran/53591] New: Front-end optimize empty string assignments
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53591
Bug #: 53591
Summary: Front-end optimize empty string assignments
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: tkoenig@gcc.gnu.org
Based on PR 52861.
I think it would be useful to front-end optimize (frontend-passes.c's
optimize_assignment, utilizing empty_string()):
character(len=5) :: str
str = ' '
[That will create a memmove/memcpy followed by a memset.]
to either
str = '' (RHS length = 0)
[This will use a memset]
or to
str = ' ' (RHS length = LHS length)
[That will use an assignment]
Currently, the middle-end likes a direct assignment better than a memset, but
everything which avoids memmove/memcpy is good.
Cf. also trans-expr.c's gfc_trans_string_copy.