summaryrefslogtreecommitdiff
path: root/polly/lib/CodeGen/PPCGCodeGeneration.cpp
diff options
context:
space:
mode:
authorRiccardo Mori <patacca@autistici.org>2021-11-05 11:14:39 +0100
committerRiccardo Mori <patacca@autistici.org>2021-11-05 11:15:22 +0100
commit44596fe6a95e711f91d4eaf4e0e042b14521f7d7 (patch)
tree40508a2330d3cdb698bb88477da3dbe16f70c6af /polly/lib/CodeGen/PPCGCodeGeneration.cpp
parentfed2889f075dc4d484c68fe6c3295e986535bcfd (diff)
[Polly][Isl] Use the function unsignedFromIslSize to manage a isl::size object. NFCI
This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in lib/External/isl/include/isl/isl-noxceptions.h and the official isl C++ interface. In the official interface the type `isl::size` cannot be casted to an unsigned without previously having checked if it contains a valid value with the function `isl::size::is_error()`. For this reason two helping functions have been added: - `IslAssert`: assert that no errors are present in debug builds and just disables the mandatory error check in non-debug builds - `unisgnedFromIslSIze`: cast the `isl::size` object to `unsigned` Changes made: - Add the functions `IslAssert` and `unsignedFromIslSize` - Add the utility function `rangeIslSize()` - Retype `MaxDisjunctsInDomain` from `int` to `unsigned` - Retype `RunTimeChecksMaxAccessDisjuncts` from `int` to `unsigned` - Retype `MaxDimensionsInAccessRange` from `int` to `unsigned` - Replaced some usages of `isl_size` to `unsigned` since we aim not to use `isl_size` anymore - `isl-noexceptions.h` has been generated by https://github.com/patacca/isl/commit/e704f73c88f0b4d88e62e447bdb732cf5914094b No functional change intended. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D113101
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index 3c56dee49c16..a10a5312b60d 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -22,6 +22,7 @@
#include "polly/Options.h"
#include "polly/ScopDetection.h"
#include "polly/ScopInfo.h"
+#include "polly/Support/ISLTools.h"
#include "polly/Support/SCEVValidator.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/Analysis/TargetTransformInfo.h"
@@ -1151,7 +1152,7 @@ Value *GPUNodeBuilder::getArrayOffset(gpu_array_info *Array) {
isl::set ZeroSet = isl::set::universe(Min.get_space());
- for (long i = 0, n = Min.tuple_dim().release(); i < n; i++)
+ for (unsigned i : rangeIslSize(0, Min.tuple_dim()))
ZeroSet = ZeroSet.fix_si(isl::dim::set, i, 0);
if (Min.is_subset(ZeroSet)) {
@@ -1160,7 +1161,7 @@ Value *GPUNodeBuilder::getArrayOffset(gpu_array_info *Array) {
isl::ast_expr Result = isl::ast_expr::from_val(isl::val(Min.ctx(), 0));
- for (long i = 0, n = Min.tuple_dim().release(); i < n; i++) {
+ for (unsigned i : rangeIslSize(0, Min.tuple_dim())) {
if (i > 0) {
isl::pw_aff Bound_I =
isl::manage(isl_multi_pw_aff_get_pw_aff(Array->bound, i - 1));
@@ -2885,8 +2886,10 @@ public:
isl::pw_aff Val = isl::aff::var_on_domain(LS, isl::dim::set, 0);
isl::pw_aff OuterMin = AccessSet.dim_min(0);
isl::pw_aff OuterMax = AccessSet.dim_max(0);
- OuterMin = OuterMin.add_dims(isl::dim::in, Val.dim(isl::dim::in).release());
- OuterMax = OuterMax.add_dims(isl::dim::in, Val.dim(isl::dim::in).release());
+ OuterMin = OuterMin.add_dims(isl::dim::in,
+ unsignedFromIslSize(Val.dim(isl::dim::in)));
+ OuterMax = OuterMax.add_dims(isl::dim::in,
+ unsignedFromIslSize(Val.dim(isl::dim::in)));
OuterMin = OuterMin.set_tuple_id(isl::dim::in, Array->getBasePtrId());
OuterMax = OuterMax.set_tuple_id(isl::dim::in, Array->getBasePtrId());
@@ -2910,7 +2913,8 @@ public:
isl::pw_aff Val = isl::aff::var_on_domain(
isl::local_space(Array->getSpace()), isl::dim::set, i);
- PwAff = PwAff.add_dims(isl::dim::in, Val.dim(isl::dim::in).release());
+ PwAff = PwAff.add_dims(isl::dim::in,
+ unsignedFromIslSize(Val.dim(isl::dim::in)));
PwAff = PwAff.set_tuple_id(isl::dim::in, Val.get_tuple_id(isl::dim::in));
isl::set Set = PwAff.gt_set(Val);
Extent = Set.intersect(Extent);