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] |
The following simple patch tweaks the way that we expand conditional FORALL statements in gfortran, to improve the case where the conditional expression (mask) is a compile-time constant, such as .true. or .false. Although unlikely to occur commonly in real code, these are obvious optimizations that are easily implemented before more complex dependency-based transformations. I'm wondering what the gfortran maintainers think about implementing these sort of source-to-source transformations earlier, perhaps during parsing or a simplification pass? It'd would simplify translation if "where (.true.) a(:) = b(:)" were previously lowered to "a(:) = b(:)" or if "elsewhere (.false.)" were eliminated, etc... I'm not sure where best it would be appropriate to canonicalize "forall (..., .true.)" into "forall (...)", but prior to this patch we'd generate significantly different code for each. The following code 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-02-07 Roger Sayle <roger@eyesopen.com> * trans-stmt.c (gfc_trans_forall_1): Optimize the cases where the mask expression is a compile-time constant (".true." or ".false."). * gfortran.dg/forall_8.f90: New test case. * gfortran.dg/forall_9.f90: Likewise. Roger --
Attachment:
patchf.txt
Description: Text document
Attachment:
forall_8.f90
Description: Binary data
Attachment:
forall_9.f90
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |