This is the mail archive of the gcc-bugs@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]

[Bug fortran/53591] New: Front-end optimize empty string assignments


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.


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