[patch, fortran] PR 40628, optimize TRIM on assignment

Thomas Koenig tkoenig@netcologne.de
Fri Jun 18 23:41:00 GMT 2010


Hello world,

this patch fixes one part of PR 40628 by optimizing away an unneeded
TRIM on string assignment.

I have created a new file for this, optimize.c.  This is supposed to
contain optimizations with gfc_expr, before translations into TREEs.
Chances are this file will grow a bit later :-) right now it only
contains this single optimization.

At a later stage, it might be a good idea to add a -fdump-optimized-tree
to see what the optimization has done.

Regression-tested on x86_64-unknown-linux-gnu.

OK in principle for the idea?  OK for trunk?

	Thomas

2010-06-18  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* Make-lang.in:  Add fortran/optimize.o.
	* gfortran.h:  Add prototype for gfc_optimize_namespace.
	* trans-decl.c (gfc_generate_function_code):  If optimizing,
	call gfc_optimize_namespace.
	* optimize.c:  New file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: trim-patch-1.diff
Type: text/x-patch
Size: 1380 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/c36ea62c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trim_optimize_1.f90
Type: text/x-fortran
Size: 410 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/c36ea62c/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: optimize.c
Type: text/x-csrc
Size: 2480 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/c36ea62c/attachment-0002.bin>


More information about the Gcc-patches mailing list