public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/30409] New: [fortran] missed optimization with pure function arguments @ 2007-01-08 21:31 kargl at gcc dot gnu dot org 2007-01-08 21:32 ` [Bug fortran/30409] " kargl at gcc dot gnu dot org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: kargl at gcc dot gnu dot org @ 2007-01-08 21:31 UTC (permalink / raw) To: gcc-bugs The attached code demonstrates a missed optimization opportunity that can have a severe impact on code. Here are the timings for the 2 loops on 2 GHz pentium4-m processor. laptop:kargl[208] gfc4x -o z -O2 a.f90 laptop:kargl[209] ./z time 1: 5.0741002E-02 time 2: 31.28215 For a pure function the arguments are not changed during execution. Thus, in the second loop, the 1/y can be hoisted out of the nested loops. Currently, gfortran allocates/deallocates a temp array with every iteration on the outer loop, and it does the 1/y array operation on every iteration. -- Summary: [fortran] missed optimization with pure function arguments Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kargl at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30409 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/30409] [fortran] missed optimization with pure function arguments 2007-01-08 21:31 [Bug fortran/30409] New: [fortran] missed optimization with pure function arguments kargl at gcc dot gnu dot org @ 2007-01-08 21:32 ` kargl at gcc dot gnu dot org 2007-01-08 21:36 ` kargl at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: kargl at gcc dot gnu dot org @ 2007-01-08 21:32 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from kargl at gcc dot gnu dot org 2007-01-08 21:32 ------- Created an attachment (id=12871) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12871&action=view) missed optimization -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30409 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/30409] [fortran] missed optimization with pure function arguments 2007-01-08 21:31 [Bug fortran/30409] New: [fortran] missed optimization with pure function arguments kargl at gcc dot gnu dot org 2007-01-08 21:32 ` [Bug fortran/30409] " kargl at gcc dot gnu dot org @ 2007-01-08 21:36 ` kargl at gcc dot gnu dot org 2007-01-09 11:11 ` rguenth at gcc dot gnu dot org 2007-01-09 16:08 ` kargl at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: kargl at gcc dot gnu dot org @ 2007-01-08 21:36 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from kargl at gcc dot gnu dot org 2007-01-08 21:36 ------- Sorry about the long URL, but the code comes from this comp.lang.fortran thread. http://groups-beta.google.com/group/comp.lang.fortran/browse_thread/thread/9f9bf1c116dc4b69/712366ef4318e84d#712366ef4318e84d -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30409 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/30409] [fortran] missed optimization with pure function arguments 2007-01-08 21:31 [Bug fortran/30409] New: [fortran] missed optimization with pure function arguments kargl at gcc dot gnu dot org 2007-01-08 21:32 ` [Bug fortran/30409] " kargl at gcc dot gnu dot org 2007-01-08 21:36 ` kargl at gcc dot gnu dot org @ 2007-01-09 11:11 ` rguenth at gcc dot gnu dot org 2007-01-09 16:08 ` kargl at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu dot org @ 2007-01-09 11:11 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from rguenth at gcc dot gnu dot org 2007-01-09 11:11 ------- In the middle-end this somewhat is related to PR26387. Of course this is a place where frontend optimization is probably easier to do. Confirmed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- BugsThisDependsOn| |26387 Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2007-01-09 11:11:16 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30409 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/30409] [fortran] missed optimization with pure function arguments 2007-01-08 21:31 [Bug fortran/30409] New: [fortran] missed optimization with pure function arguments kargl at gcc dot gnu dot org ` (2 preceding siblings ...) 2007-01-09 11:11 ` rguenth at gcc dot gnu dot org @ 2007-01-09 16:08 ` kargl at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: kargl at gcc dot gnu dot org @ 2007-01-09 16:08 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from kargl at gcc dot gnu dot org 2007-01-09 16:08 ------- Note, above the first FORALL statement one needs to add the following 2 lines of code xmin = 0. xmax = 1. As a side note, both Pathscale and Intel in the c.l.f thread have acknowledged that their compilers also miss this optimization. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30409 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-01-09 16:08 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-01-08 21:31 [Bug fortran/30409] New: [fortran] missed optimization with pure function arguments kargl at gcc dot gnu dot org 2007-01-08 21:32 ` [Bug fortran/30409] " kargl at gcc dot gnu dot org 2007-01-08 21:36 ` kargl at gcc dot gnu dot org 2007-01-09 11:11 ` rguenth at gcc dot gnu dot org 2007-01-09 16:08 ` kargl at gcc dot gnu dot 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).