public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "arnaud02 at users dot sourceforge.net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/52861] New: (missed optimisation) missed transformation to memset with -O3 Date: Wed, 04 Apr 2012 09:25:00 -0000 [thread overview] Message-ID: <bug-52861-4@http.gcc.gnu.org/bugzilla/> (raw) 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_
next reply other threads:[~2012-04-04 9:25 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-04-04 9:25 arnaud02 at users dot sourceforge.net [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-52861-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).