diff options
| author | Tobias Grosser <tobias@grosser.es> | 2016-09-11 13:30:12 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2016-09-11 13:30:12 +0000 |
| commit | 02293ed75563c314d15553f82e252eb15dd13038 (patch) | |
| tree | e376155a22c961730f909db3b46294a0011988dc /polly/lib/CodeGen/PPCGCodeGeneration.cpp | |
| parent | e73ef85c6f0924d97b56061e4d0208f1940408ce (diff) | |
| download | bcm5719-llvm-02293ed75563c314d15553f82e252eb15dd13038.tar.gz bcm5719-llvm-02293ed75563c314d15553f82e252eb15dd13038.zip | |
GPGPU: Do not fail in case of arrays never accessed
If these arrays have never been accessed we failed to derive an upper bound
of the accesses and consequently a size for the outermost dimension. We
now explicitly check for empty access sets and then just use zero as size
for the outermost dimension.
llvm-svn: 281165
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
| -rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index eac819d930b..66ffa730acc 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -1784,17 +1784,27 @@ public: /// @param Array The polly array from which to take the information. void setArrayBounds(gpu_array_info &PPCGArray, ScopArrayInfo *Array) { if (PPCGArray.n_index > 0) { - isl_set *Dom = isl_set_copy(PPCGArray.extent); - Dom = isl_set_project_out(Dom, isl_dim_set, 1, PPCGArray.n_index - 1); - isl_pw_aff *Bound = isl_set_dim_max(isl_set_copy(Dom), 0); - isl_set_free(Dom); - Dom = isl_pw_aff_domain(isl_pw_aff_copy(Bound)); - isl_local_space *LS = isl_local_space_from_space(isl_set_get_space(Dom)); - isl_aff *One = isl_aff_zero_on_domain(LS); - One = isl_aff_add_constant_si(One, 1); - Bound = isl_pw_aff_add(Bound, isl_pw_aff_alloc(Dom, One)); - Bound = isl_pw_aff_gist(Bound, S->getContext()); - PPCGArray.bound[0] = Bound; + if (isl_set_is_empty(PPCGArray.extent)) { + isl_set *Dom = isl_set_copy(PPCGArray.extent); + isl_local_space *LS = isl_local_space_from_space( + isl_space_params(isl_set_get_space(Dom))); + isl_set_free(Dom); + isl_aff *Zero = isl_aff_zero_on_domain(LS); + PPCGArray.bound[0] = isl_pw_aff_from_aff(Zero); + } else { + isl_set *Dom = isl_set_copy(PPCGArray.extent); + Dom = isl_set_project_out(Dom, isl_dim_set, 1, PPCGArray.n_index - 1); + isl_pw_aff *Bound = isl_set_dim_max(isl_set_copy(Dom), 0); + isl_set_free(Dom); + Dom = isl_pw_aff_domain(isl_pw_aff_copy(Bound)); + isl_local_space *LS = + isl_local_space_from_space(isl_set_get_space(Dom)); + isl_aff *One = isl_aff_zero_on_domain(LS); + One = isl_aff_add_constant_si(One, 1); + Bound = isl_pw_aff_add(Bound, isl_pw_aff_alloc(Dom, One)); + Bound = isl_pw_aff_gist(Bound, S->getContext()); + PPCGArray.bound[0] = Bound; + } } for (unsigned i = 1; i < PPCGArray.n_index; ++i) { |

