diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2021-11-16 16:09:51 +0100 |
---|---|---|
committer | Kwok Cheung Yeung <kcy@codesourcery.com> | 2023-05-12 19:13:48 +0100 |
commit | b547ec0621593cd893f80292908806d1e5e8c4ad (patch) | |
tree | b1f2002115e8bc64114db8777411e2367b99fb32 /gcc/graphite.cc | |
parent | 96681deaaec8223b0688e9c26b0dd075415380a6 (diff) | |
download | gcc-b547ec0621593cd893f80292908806d1e5e8c4ad.zip gcc-b547ec0621593cd893f80292908806d1e5e8c4ad.tar.gz gcc-b547ec0621593cd893f80292908806d1e5e8c4ad.tar.bz2 |
Fortran: delinearize multi-dimensional array accesses
The Fortran front end presently linearizes accesses to
multi-dimensional arrays by combining the indices for the various
dimensions into a series of explicit multiplies and adds with
refactoring to allow CSE of invariant parts of the computation.
Unfortunately this representation interferes with Graphite-based loop
optimizations. It is difficult to recover the original
multi-dimensional form of the access by the time loop optimizations
run because parts of it have already been optimized away or into a
form that is not easily recognizable, so it seems better to have the
Fortran front end produce delinearized accesses to begin with, a set
of nested ARRAY_REFs similar to the existing behavior of the C and C++
front ends. This is a long-standing problem that has previously been
discussed e.g. in PR 14741 and PR61000.
This patch is an initial implementation for explicit array accesses
only; it doesn't handle the accesses generated during scalarization of
whole-array or array-section operations, which follow a different code
path.
gcc/
* expr.cc (get_inner_reference): Handle NOP_EXPR like
VIEW_CONVERT_EXPR.
gcc/fortran/
* lang.opt (-param=delinearize=): New.
* trans-array.cc (get_class_array_vptr): New, split from...
(build_array_ref): ...here.
(get_array_lbound, get_array_ubound): New, split from...
(gfc_conv_array_ref): ...here. Additional code refactoring
plus support for delinearization of the array access.
gcc/testsuite/
* gfortran.dg/assumed_type_2.f90: Adjust patterns.
* gfortran.dg/goacc/kernels-loop-inner.f95: Likewise.
* gfortran.dg/graphite/block-3.f90: Remove xfails.
* gfortran.dg/graphite/block-4.f90: Likewise.
* gfortran.dg/inline_matmul_24.f90: Adjust patterns.
* gfortran.dg/no_arg_check_2.f90: Likewise.
* gfortran.dg/pr32921.f: Likewise.
* gfortran.dg/reassoc_4.f: Disable delinearization for this test.
Co-Authored-By: Tobias Burnus <tobias@codesourcery.com>
Diffstat (limited to 'gcc/graphite.cc')
0 files changed, 0 insertions, 0 deletions