[polly] r303511 - [ScopInfo] Translate wrapConstantDimensions to isl C++ [NFC]
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sun May 21 13:23:23 PDT 2017
Author: grosser
Date: Sun May 21 15:23:23 2017
New Revision: 303511
URL: http://llvm.org/viewvc/llvm-project?rev=303511&view=rev
Log:
[ScopInfo] Translate wrapConstantDimensions to isl C++ [NFC]
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=303511&r1=303510&r2=303511&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sun May 21 15:23:23 2017
@@ -451,13 +451,13 @@ const ScopArrayInfo *ScopArrayInfo::getF
void MemoryAccess::wrapConstantDimensions() {
auto *SAI = getScopArrayInfo();
- auto *ArraySpace = SAI->getSpace();
- auto *Ctx = isl_space_get_ctx(ArraySpace);
+ isl::space ArraySpace = give(SAI->getSpace());
+ isl::ctx Ctx = ArraySpace.get_ctx();
unsigned DimsArray = SAI->getNumberOfDimensions();
- auto *DivModAff = isl_multi_aff_identity(isl_space_map_from_domain_and_range(
- isl_space_copy(ArraySpace), isl_space_copy(ArraySpace)));
- auto *LArraySpace = isl_local_space_from_space(ArraySpace);
+ isl::multi_aff DivModAff = isl::multi_aff::identity(
+ ArraySpace.map_from_domain_and_range(ArraySpace));
+ isl::local_space LArraySpace = isl::local_space(ArraySpace);
// Begin with last dimension, to iteratively carry into higher dimensions.
for (int i = DimsArray - 1; i > 0; i--) {
@@ -472,37 +472,33 @@ void MemoryAccess::wrapConstantDimension
if (DimSize->isZero())
continue;
- auto *DimSizeVal = isl_valFromAPInt(Ctx, DimSizeCst->getAPInt(), false);
- auto *Var = isl_aff_var_on_domain(isl_local_space_copy(LArraySpace),
- isl_dim_set, i);
- auto *PrevVar = isl_aff_var_on_domain(isl_local_space_copy(LArraySpace),
- isl_dim_set, i - 1);
+ isl::val DimSizeVal =
+ valFromAPInt(Ctx.get(), DimSizeCst->getAPInt(), false);
+ isl::aff Var = isl::aff::var_on_domain(LArraySpace, isl::dim::set, i);
+ isl::aff PrevVar =
+ isl::aff::var_on_domain(LArraySpace, isl::dim::set, i - 1);
// Compute: index % size
// Modulo must apply in the divide of the previous iteration, if any.
- auto *Modulo = isl_aff_copy(Var);
- Modulo = isl_aff_mod_val(Modulo, isl_val_copy(DimSizeVal));
- Modulo = isl_aff_pullback_multi_aff(Modulo, isl_multi_aff_copy(DivModAff));
+ isl::aff Modulo = Var.mod_val(DimSizeVal);
+ Modulo = Modulo.pullback(DivModAff);
// Compute: floor(index / size)
- auto *Divide = Var;
- Divide = isl_aff_div(
- Divide,
- isl_aff_val_on_domain(isl_local_space_copy(LArraySpace), DimSizeVal));
- Divide = isl_aff_floor(Divide);
- Divide = isl_aff_add(Divide, PrevVar);
- Divide = isl_aff_pullback_multi_aff(Divide, isl_multi_aff_copy(DivModAff));
+ isl::aff Divide = Var.div(isl::aff(LArraySpace, DimSizeVal));
+ Divide = Divide.floor();
+ Divide = Divide.add(PrevVar);
+ Divide = Divide.pullback(DivModAff);
// Apply Modulo and Divide.
- DivModAff = isl_multi_aff_set_aff(DivModAff, i, Modulo);
- DivModAff = isl_multi_aff_set_aff(DivModAff, i - 1, Divide);
+ DivModAff = DivModAff.set_aff(i, Modulo);
+ DivModAff = DivModAff.set_aff(i - 1, Divide);
}
// Apply all modulo/divides on the accesses.
- AccessRelation =
- isl_map_apply_range(AccessRelation, isl_map_from_multi_aff(DivModAff));
- AccessRelation = isl_map_detect_equalities(AccessRelation);
- isl_local_space_free(LArraySpace);
+ isl::map Relation = give(AccessRelation);
+ Relation = Relation.apply_range(isl::map::from_multi_aff(DivModAff));
+ Relation = Relation.detect_equalities();
+ AccessRelation = Relation.release();
}
void MemoryAccess::updateDimensionality() {
More information about the llvm-commits
mailing list