diff options
author | Siddharth Bhat <siddu.druid@gmail.com> | 2017-05-19 15:07:45 +0000 |
---|---|---|
committer | Siddharth Bhat <siddu.druid@gmail.com> | 2017-05-19 15:07:45 +0000 |
commit | b7f68b8c9e2c499d04a9cc8d8cf4df783ae34bff (patch) | |
tree | dee824225e7f63b3efea13b1d36a2fc9d54bbc11 /polly/lib/CodeGen/PPCGCodeGeneration.cpp | |
parent | ce941c9c380d37a670e3cd3e283ae4070a52859f (diff) | |
download | bcm5719-llvm-b7f68b8c9e2c499d04a9cc8d8cf4df783ae34bff.tar.gz bcm5719-llvm-b7f68b8c9e2c499d04a9cc8d8cf4df783ae34bff.zip |
[Fortran Support] Materialize outermost dimension for Fortran array.
- We use the outermost dimension of arrays since we need this
information to generate GPU transfers.
- In general, if we do not know the outermost dimension of the array
(because the indexing expression is non-affine, for example) then we
simply cannot generate transfer code.
- However, for Fortran arrays, we can use the Fortran array
representation which stores the dimensions of all arrays.
- This patch uses the Fortran array representation to generate code that
computes the outermost dimension size.
Differential Revision: https://reviews.llvm.org/D32967
llvm-svn: 303429
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index 78b5c6644c2..f0ce94d0793 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -2163,9 +2163,17 @@ public: for (unsigned i = 1; i < NumDims; ++i) Extent = isl_set_lower_bound_si(Extent, isl_dim_set, i, 0); - for (unsigned i = 1; i < NumDims; ++i) { + for (unsigned i = 0; i < NumDims; ++i) { isl_pw_aff *PwAff = const_cast<isl_pw_aff *>(Array->getDimensionSizePw(i)); + + // isl_pw_aff can be NULL for zero dimension. Only in the case of a + // Fortran array will we have a legitimate dimension. + if (!PwAff) { + assert(i == 0 && "invalid dimension isl_pw_aff for nonzero dimension"); + continue; + } + isl_pw_aff *Val = isl_pw_aff_from_aff(isl_aff_var_on_domain( isl_local_space_from_space(Array->getSpace()), isl_dim_set, i)); PwAff = isl_pw_aff_add_dims(PwAff, isl_dim_in, |