public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a))
@ 2010-12-26 15:05 tkoenig at gcc dot gnu.org
2010-12-26 21:32 ` [Bug fortran/47065] " tkoenig at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-26 15:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
Summary: Replace trim(a) by a(1:len_trim(a))
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: tkoenig@gcc.gnu.org
In many cases, it is possible to replace trim(a) by a(1:len_trim(a)).
This is a win because it saves trim from creating a temporary.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
@ 2010-12-26 21:32 ` tkoenig at gcc dot gnu.org
2010-12-26 21:34 ` tkoenig at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-26 21:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2010.12.26 21:31:55
AssignedTo|unassigned at gcc dot |tkoenig at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
2010-12-26 21:32 ` [Bug fortran/47065] " tkoenig at gcc dot gnu.org
@ 2010-12-26 21:34 ` tkoenig at gcc dot gnu.org
2010-12-31 11:32 ` tkoenig at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-26 21:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-26 21:34:14 UTC ---
Created attachment 22852
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22852
Partial patch
This appears to work for the cases where there is no substring reference.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
2010-12-26 21:32 ` [Bug fortran/47065] " tkoenig at gcc dot gnu.org
2010-12-26 21:34 ` tkoenig at gcc dot gnu.org
@ 2010-12-31 11:32 ` tkoenig at gcc dot gnu.org
2010-12-31 11:38 ` tkoenig at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-31 11:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-31 11:32:20 UTC ---
Author: tkoenig
Date: Fri Dec 31 11:32:16 2010
New Revision: 168367
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168367
Log:
2010-12-31 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/47065
* frontend-passes.c (count_arglist): Static variable to
count the nesting of argument lists.
(optimize_code): Set count_arglist to 1 if within a call
statement, to 0 otherwise.
(optimize_trim): New function.
(optimize_expr): Adjust count_arglist. Call optimize_trim.
2010-12-31 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/47065
* gfortran.dg/trim_optimize_3.f90: New test.
* gfortran.dg/trim_optimize_4.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/trim_optimize_3.f90
trunk/gcc/testsuite/gfortran.dg/trim_optimize_4.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
` (2 preceding siblings ...)
2010-12-31 11:32 ` tkoenig at gcc dot gnu.org
@ 2010-12-31 11:38 ` tkoenig at gcc dot gnu.org
2011-01-18 21:08 ` burnus at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-31 11:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-31 11:38:03 UTC ---
The most common cases are handled now.
Still to do:
- Handle substring references, for example trim(a(3:5)). Here, we have
to watch out for trim(a(function(x):5)), not to evaluate the function
twice.
- Right now, the optimization is not applied in argument
lists. This can be relaxed for PURE functions and subroutines,
or if dependency analysis shows that it cannot hurt. The latter point
is probably not worth it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
` (3 preceding siblings ...)
2010-12-31 11:38 ` tkoenig at gcc dot gnu.org
@ 2011-01-18 21:08 ` burnus at gcc dot gnu.org
2011-01-18 23:39 ` tkoenig at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-18 21:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-18 21:03:06 UTC ---
(In reply to comment #3)
> This can be relaxed for PURE functions and subroutines,
And for implicitly pure procedures (attr.implicit_pure).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
` (4 preceding siblings ...)
2011-01-18 21:08 ` burnus at gcc dot gnu.org
@ 2011-01-18 23:39 ` tkoenig at gcc dot gnu.org
2011-03-27 19:13 ` tkoenig at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-01-18 23:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-01-18 23:21:06 UTC ---
Created attachment 23024
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23024
patch handling references
This patch would work, but for PR 47348.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
` (5 preceding siblings ...)
2011-01-18 23:39 ` tkoenig at gcc dot gnu.org
@ 2011-03-27 19:13 ` tkoenig at gcc dot gnu.org
2011-11-09 10:23 ` fxcoudert at gcc dot gnu.org
2013-03-17 15:26 ` tkoenig at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-03-27 19:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-03-27 17:40:29 UTC ---
Author: tkoenig
Date: Sun Mar 27 17:40:26 2011
New Revision: 171575
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171575
Log:
2011-03-27 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/47065
* frontend-passes (optimize_trim): Also follow references, except
when they are substring references or array references.
2011-03-27 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/47065
* gfortran.dg/trim_optimize_5.f90: New test.
* gfortran.dg/trim_optimize_6.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/trim_optimize_5.f90
trunk/gcc/testsuite/gfortran.dg/trim_optimize_6.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
` (6 preceding siblings ...)
2011-03-27 19:13 ` tkoenig at gcc dot gnu.org
@ 2011-11-09 10:23 ` fxcoudert at gcc dot gnu.org
2013-03-17 15:26 ` tkoenig at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-11-09 10:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
--- Comment #7 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-11-09 10:09:15 UTC ---
Thomas, I think this is mostly fixed, isn't it? If so, we could close it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/47065] Replace trim(a) by a(1:len_trim(a))
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
` (7 preceding siblings ...)
2011-11-09 10:23 ` fxcoudert at gcc dot gnu.org
@ 2013-03-17 15:26 ` tkoenig at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-03-17 15:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47065
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-03-17 15:26:18 UTC ---
I think this is fixed as far as it is useful.
Marking as closed.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-03-17 15:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-26 15:05 [Bug fortran/47065] New: Replace trim(a) by a(1:len_trim(a)) tkoenig at gcc dot gnu.org
2010-12-26 21:32 ` [Bug fortran/47065] " tkoenig at gcc dot gnu.org
2010-12-26 21:34 ` tkoenig at gcc dot gnu.org
2010-12-31 11:32 ` tkoenig at gcc dot gnu.org
2010-12-31 11:38 ` tkoenig at gcc dot gnu.org
2011-01-18 21:08 ` burnus at gcc dot gnu.org
2011-01-18 23:39 ` tkoenig at gcc dot gnu.org
2011-03-27 19:13 ` tkoenig at gcc dot gnu.org
2011-11-09 10:23 ` fxcoudert at gcc dot gnu.org
2013-03-17 15:26 ` tkoenig 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).