public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52861] New: (missed optimisation) missed transformation to memset with -O3
@ 2012-04-04  9:25 arnaud02 at users dot sourceforge.net
  2012-04-04 16:35 ` [Bug middle-end/52861] " burnus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: arnaud02 at users dot sourceforge.net @ 2012-04-04  9:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52861

             Bug #: 52861
           Summary: (missed optimisation) missed transformation to memset
                    with -O3
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arnaud02@users.sourceforge.net


This is a minor missed-optimisation noticed as follow up to PR52835.
This is not a regression.

>cat qq1.f
      SUBROUTINE QQ2( ISU, ZSPM, RSV, MS )
      INTEGER :: ISU(MS)
      CHARACTER(8) :: ZSPM(MS)
      REAL :: RSV(MS)

      DO IS=1,MS
         ISU(IS)=0
         ZSPM(IS)=' '
         RSV(IS) =0.0
      ENDDO
      END subroutine qq2
>cat qq2.f
      SUBROUTINE QQ2( ISU, ZSPM, RSV, MS )
      INTEGER :: ISU(MS)
      CHARACTER(8) :: ZSPM(MS)
      REAL :: RSV(MS)

      DO IS=1,MS
         ISU(IS)=0
         RSV(IS) =0.0
      ENDDO
      DO IS=1,MS
         ZSPM(IS)=' '
      ENDDO
      END subroutine qq2
>gfortran470 -O3 -c qq1.f ; gfortran470 -O3 -c qq2.f
>nm qq1.o qq2.o

qq1.o:
0000000000000000 T qq2_

qq2.o:
                 U memset
0000000000000000 T qq2_

The compiler has not be able to transform the assignments to ISU and RSV as
calls to memset when the loop contains an assignment to a CHARACTER variable.
This suggests that the dependency generator can be improved or that the Fortran
front-end could pass a better representation to the middle-end.

Additionally, it should be possible to transform 
      DO IS=1,MS
         ZSPM(IS)=' '
      ENDDO
as a call to memset. gcc 4.7.0 cannot:

>cat qq3.f
      SUBROUTINE QQ2( ZSPM, MS )
      CHARACTER(8) :: ZSPM(MS)
      DO IS=1,MS
         ZSPM(IS)=' '
      ENDDO
      END subroutine qq2
>/usr/local/gcc/gfortran470 -O3 -c qq3.f
>nm qq3
qq3.f  qq3.o
>nm qq3.o
0000000000000000 T qq2_


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-07 15:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  9:25 [Bug fortran/52861] New: (missed optimisation) missed transformation to memset with -O3 arnaud02 at users dot sourceforge.net
2012-04-04 16:35 ` [Bug middle-end/52861] " burnus at gcc dot gnu.org
2012-06-06 11:10 ` [Bug fortran/52861] " rguenth at gcc dot gnu.org
2012-06-06 18:08 ` tkoenig at gcc dot gnu.org
2012-06-07 11:12 ` tkoenig at gcc dot gnu.org
2012-06-07 11:13 ` tkoenig at gcc dot gnu.org
2012-06-07 14:34 ` tkoenig at gcc dot gnu.org
2012-06-07 15:25 ` burnus at gcc dot gnu.org
2012-06-07 15:29 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).