This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[FORTRAN PATCH]: Implement dependency analysis for array constructors


The following is another improvement to the gfortran front-end's
dependency analysis routines.  Currently dependency.c doesn't know that
constant array constructors, such /( 1, 2, 3 /), aren't affected by
assignments to variables.  This then pessimizes code such as
"x(:) = cshift((/ 1, 2, 3, 4, 5/), 2)" or "reshape(x,(/2,2/))" where our
paranoia causes us to use temporary destination arrays to avoid the
imagined dependencies.

The simple/obvious fix is to actually implement the missing dependency
analysis for EXPR_ARRAY in gfc_check_dependency, by looping over the
values of the array constructor.

The following patch has been tested on x86_64-unknown-linux-gnu with a
full "make bootstrap", including gfortran, and regression tested with a
top-level "make -k check" with no new failures.

Ok for mainline?


2007-01-31  Roger Sayle  <roger@eyesopen.com>

        * dependency.c (gfc_check_dependency) <EXPR_ARRAY>: Implement
        dependency checking for array constructors.

        * gfortran.dg/dependency_20.f90: New test case.


Roger
--

Attachment: patchf2.txt
Description: Text document

Attachment: dependency_20.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]