[polly] r308801 - Move ScopArrayInfo to isl++
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 16:07:56 PDT 2017
Author: grosser
Date: Fri Jul 21 16:07:56 2017
New Revision: 308801
URL: http://llvm.org/viewvc/llvm-project?rev=308801&view=rev
Log:
Move ScopArrayInfo to isl++
This moves the full ScopArrayInfo class to isl++
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
polly/trunk/lib/Exchange/JSONExporter.cpp
polly/trunk/lib/Transform/ScheduleOptimizer.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=308801&r1=308800&r2=308801&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri Jul 21 16:07:56 2017
@@ -315,9 +315,9 @@ public:
// Scalars do not have array dimensions and the first dimension of
// a (possibly multi-dimensional) array also does not carry any size
// information, in case the array is not newly created.
- __isl_give isl_pw_aff *getDimensionSizePw(unsigned Dim) const {
+ isl::pw_aff getDimensionSizePw(unsigned Dim) const {
assert(Dim < getNumberOfDimensions() && "Invalid dimension");
- return isl_pw_aff_copy(DimensionSizesPw[Dim]);
+ return DimensionSizesPw[Dim];
}
/// Get the canonical element type of this array.
@@ -332,7 +332,7 @@ public:
std::string getName() const;
/// Return the isl id for the base pointer.
- __isl_give isl_id *getBasePtrId() const;
+ isl::id getBasePtrId() const;
/// Return what kind of memory this represents.
MemoryKind getKind() const { return Kind; }
@@ -382,7 +382,7 @@ public:
static const ScopArrayInfo *getFromId(__isl_take isl_id *Id);
/// Get the space of this array access.
- __isl_give isl_space *getSpace() const;
+ isl::space getSpace() const;
/// If the array is read only
bool isReadOnly();
@@ -421,7 +421,7 @@ private:
Type *ElementType;
/// The isl id for the base pointer.
- isl_id *Id;
+ isl::id Id;
/// True if the newly allocated array is on heap.
bool IsOnHeap;
@@ -430,7 +430,7 @@ private:
SmallVector<const SCEV *, 4> DimensionSizes;
/// The sizes of each dimension as isl_pw_aff.
- SmallVector<isl_pw_aff *, 4> DimensionSizesPw;
+ SmallVector<isl::pw_aff, 4> DimensionSizesPw;
/// The type of this scop array info object.
///
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=308801&r1=308800&r2=308801&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Jul 21 16:07:56 2017
@@ -22,6 +22,7 @@
#include "polly/Options.h"
#include "polly/ScopBuilder.h"
#include "polly/Support/GICHelper.h"
+#include "polly/Support/ISLOStream.h"
#include "polly/Support/SCEVValidator.h"
#include "polly/Support/ScopHelper.h"
#include "llvm/ADT/DepthFirstIterator.h"
@@ -268,7 +269,7 @@ ScopArrayInfo::ScopArrayInfo(Value *Base
: getIslCompatibleName("MemRef", BasePtr, S->getNextArrayIdx(),
Kind == MemoryKind::PHI ? "__phi" : "",
UseInstructionNames);
- Id = isl_id_alloc(Ctx, BasePtrName.c_str(), this);
+ Id = isl::id::alloc(Ctx, BasePtrName.c_str(), this);
updateSizes(Sizes);
@@ -282,16 +283,15 @@ ScopArrayInfo::ScopArrayInfo(Value *Base
const_cast<ScopArrayInfo *>(BasePtrOriginSAI)->addDerivedSAI(this);
}
-__isl_give isl_space *ScopArrayInfo::getSpace() const {
- auto *Space =
- isl_space_set_alloc(isl_id_get_ctx(Id), 0, getNumberOfDimensions());
- Space = isl_space_set_tuple_id(Space, isl_dim_set, isl_id_copy(Id));
+isl::space ScopArrayInfo::getSpace() const {
+ auto Space = isl::space(Id.get_ctx(), 0, getNumberOfDimensions());
+ Space = Space.set_tuple_id(isl::dim::set, Id);
return Space;
}
bool ScopArrayInfo::isReadOnly() {
isl::union_set WriteSet = give(S.getWrites()).range();
- isl::space Space = give(getSpace());
+ isl::space Space = getSpace();
WriteSet = WriteSet.extract_set(Space);
return bool(WriteSet.is_empty());
@@ -353,7 +353,7 @@ void ScopArrayInfo::applyAndSetFAD(Value
isl::pw_aff PwAff =
isl::aff::var_on_domain(isl::local_space(Space), isl::dim::param, 0);
- DimensionSizesPw[0] = PwAff.release();
+ DimensionSizesPw[0] = PwAff;
}
bool ScopArrayInfo::updateSizes(ArrayRef<const SCEV *> NewSizes,
@@ -377,35 +377,27 @@ bool ScopArrayInfo::updateSizes(ArrayRef
DimensionSizes.clear();
DimensionSizes.insert(DimensionSizes.begin(), NewSizes.begin(),
NewSizes.end());
- for (isl_pw_aff *Size : DimensionSizesPw)
- isl_pw_aff_free(Size);
DimensionSizesPw.clear();
for (const SCEV *Expr : DimensionSizes) {
if (!Expr) {
DimensionSizesPw.push_back(nullptr);
continue;
}
- isl_pw_aff *Size = S.getPwAffOnly(Expr);
+ isl::pw_aff Size = isl::manage(S.getPwAffOnly(Expr));
DimensionSizesPw.push_back(Size);
}
return true;
}
-ScopArrayInfo::~ScopArrayInfo() {
- isl_id_free(Id);
- for (isl_pw_aff *Size : DimensionSizesPw)
- isl_pw_aff_free(Size);
-}
+ScopArrayInfo::~ScopArrayInfo() {}
-std::string ScopArrayInfo::getName() const { return isl_id_get_name(Id); }
+std::string ScopArrayInfo::getName() const { return Id.get_name(); }
int ScopArrayInfo::getElemSizeInBytes() const {
return DL.getTypeAllocSize(ElementType);
}
-__isl_give isl_id *ScopArrayInfo::getBasePtrId() const {
- return isl_id_copy(Id);
-}
+isl::id ScopArrayInfo::getBasePtrId() const { return Id; }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void ScopArrayInfo::dump() const { print(errs()); }
@@ -427,9 +419,8 @@ void ScopArrayInfo::print(raw_ostream &O
OS << "[";
if (SizeAsPwAff) {
- auto *Size = getDimensionSizePw(u);
+ isl::pw_aff Size = getDimensionSizePw(u);
OS << " " << Size << " ";
- isl_pw_aff_free(Size);
} else {
OS << *getDimensionSize(u);
}
@@ -461,7 +452,7 @@ const ScopArrayInfo *ScopArrayInfo::getF
void MemoryAccess::wrapConstantDimensions() {
auto *SAI = getScopArrayInfo();
- isl::space ArraySpace = give(SAI->getSpace());
+ isl::space ArraySpace = SAI->getSpace();
isl::ctx Ctx = ArraySpace.get_ctx();
unsigned DimsArray = SAI->getNumberOfDimensions();
@@ -513,7 +504,7 @@ void MemoryAccess::wrapConstantDimension
void MemoryAccess::updateDimensionality() {
auto *SAI = getScopArrayInfo();
- isl::space ArraySpace = give(SAI->getSpace());
+ isl::space ArraySpace = SAI->getSpace();
isl::space AccessSpace = give(isl_map_get_space(AccessRelation)).range();
isl::ctx Ctx = ArraySpace.get_ctx();
@@ -765,7 +756,7 @@ void MemoryAccess::assumeNoOutOfBound()
isl::pw_aff Zero = isl::pw_aff(LS);
isl::set DimOutside = Var.lt_set(Zero);
- isl::pw_aff SizeE = give(SAI->getDimensionSizePw(i));
+ isl::pw_aff SizeE = SAI->getDimensionSizePw(i);
SizeE = SizeE.add_dims(isl::dim::in, Space.dim(isl::dim::set));
SizeE = SizeE.set_tuple_id(isl::dim::in, Space.get_tuple_id(isl::dim::set));
DimOutside = DimOutside.unite(SizeE.le_set(Var));
@@ -913,7 +904,7 @@ void MemoryAccess::foldAccessRelation()
NewAccessRelation = NewAccessRelation.apply_range(MapOne);
}
- isl::id BaseAddrId = give(getScopArrayInfo()->getBasePtrId());
+ isl::id BaseAddrId = getScopArrayInfo()->getBasePtrId();
isl::space Space = give(Statement->getDomainSpace());
NewAccessRelation = NewAccessRelation.set_tuple_id(
isl::dim::in, Space.get_tuple_id(isl::dim::set));
@@ -972,7 +963,7 @@ void MemoryAccess::buildAccessRelation(c
isl_set_free(StmtInvalidDomain);
isl_ctx *Ctx = isl_id_get_ctx(Id);
- isl_id *BaseAddrId = SAI->getBasePtrId();
+ isl_id *BaseAddrId = SAI->getBasePtrId().release();
if (getAccessInstruction() && isa<MemIntrinsic>(getAccessInstruction())) {
buildMemIntrinsicAccessRelation();
@@ -2418,7 +2409,7 @@ static isl_set *addFortranArrayOutermost
// outermost dimension size can be picked up from their runtime description.
// TODO: actually need to check if it has a FAD, but for now this works.
if (Array->getNumberOfDimensions() > 0) {
- isl_pw_aff *PwAff = Array->getDimensionSizePw(0);
+ isl_pw_aff *PwAff = Array->getDimensionSizePw(0).release();
if (!PwAff)
continue;
@@ -3591,7 +3582,7 @@ void Scop::foldSizeConstantsToRight() {
if (Array->getNumberOfDimensions() <= 1)
continue;
- isl_space *Space = Array->getSpace();
+ isl_space *Space = Array->getSpace().release();
Space = isl_space_align_params(Space, isl_union_set_get_space(Accessed));
@@ -3603,7 +3594,7 @@ void Scop::foldSizeConstantsToRight() {
isl_set *Elements = isl_union_set_extract_set(Accessed, Space);
isl_map *Transform =
- isl_map_universe(isl_space_map_from_set(Array->getSpace()));
+ isl_map_universe(isl_space_map_from_set(Array->getSpace().release()));
std::vector<int> Int;
@@ -4203,7 +4194,7 @@ static void replaceBasePtrArrays(Scop *S
if (Access->getLatestScopArrayInfo() != Old)
continue;
- isl_id *Id = New->getBasePtrId();
+ isl_id *Id = New->getBasePtrId().release();
isl_map *Map = Access->getAccessRelation();
Map = isl_map_set_tuple_id(Map, isl_dim_out, Id);
Access->setAccessRelation(Map);
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=308801&r1=308800&r2=308801&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Fri Jul 21 16:07:56 2017
@@ -1102,7 +1102,7 @@ bool IslNodeBuilder::materializeFortranA
if (!FAD)
continue;
- isl_pw_aff *ParametricPwAff = Array->getDimensionSizePw(0);
+ isl_pw_aff *ParametricPwAff = Array->getDimensionSizePw(0).release();
assert(ParametricPwAff && "parametric pw_aff corresponding "
"to outermost dimension does not "
"exist");
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=308801&r1=308800&r2=308801&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Fri Jul 21 16:07:56 2017
@@ -179,7 +179,7 @@ static MustKillsInfo computeMustKillsInf
for (ScopArrayInfo *SAI : S.arrays()) {
if (SAI->isPHIKind() ||
(SAI->isValueKind() && isScalarUsesContainedInScop(S, SAI)))
- KillMemIds.push_back(isl::manage(SAI->getBasePtrId()));
+ KillMemIds.push_back(isl::manage(SAI->getBasePtrId().release()));
}
Info.TaggedMustKills = isl::union_map::empty(isl::space(ParamSpace));
@@ -2423,7 +2423,7 @@ public:
}
for (auto &Array : S->arrays()) {
- auto Id = Array->getBasePtrId();
+ auto Id = Array->getBasePtrId().release();
Names = isl_id_to_ast_expr_set(Names, Id, isl_ast_expr_copy(Zero));
}
@@ -2574,19 +2574,20 @@ public:
if (isl_union_set_is_empty(AccessUSet)) {
isl_union_set_free(AccessUSet);
- return isl_set_empty(Array->getSpace());
+ return isl_set_empty(Array->getSpace().release());
}
if (Array->getNumberOfDimensions() == 0) {
isl_union_set_free(AccessUSet);
- return isl_set_universe(Array->getSpace());
+ return isl_set_universe(Array->getSpace().release());
}
isl_set *AccessSet =
- isl_union_set_extract_set(AccessUSet, Array->getSpace());
+ isl_union_set_extract_set(AccessUSet, Array->getSpace().release());
isl_union_set_free(AccessUSet);
- isl_local_space *LS = isl_local_space_from_space(Array->getSpace());
+ isl_local_space *LS =
+ isl_local_space_from_space(Array->getSpace().release());
isl_pw_aff *Val =
isl_pw_aff_from_aff(isl_aff_var_on_domain(LS, isl_dim_set, 0));
@@ -2597,12 +2598,12 @@ public:
isl_pw_aff_dim(Val, isl_dim_in));
OuterMax = isl_pw_aff_add_dims(OuterMax, isl_dim_in,
isl_pw_aff_dim(Val, isl_dim_in));
- OuterMin =
- isl_pw_aff_set_tuple_id(OuterMin, isl_dim_in, Array->getBasePtrId());
- OuterMax =
- isl_pw_aff_set_tuple_id(OuterMax, isl_dim_in, Array->getBasePtrId());
+ OuterMin = isl_pw_aff_set_tuple_id(OuterMin, isl_dim_in,
+ Array->getBasePtrId().release());
+ OuterMax = isl_pw_aff_set_tuple_id(OuterMax, isl_dim_in,
+ Array->getBasePtrId().release());
- isl_set *Extent = isl_set_universe(Array->getSpace());
+ isl_set *Extent = isl_set_universe(Array->getSpace().release());
Extent = isl_set_intersect(
Extent, isl_pw_aff_le_set(OuterMin, isl_pw_aff_copy(Val)));
@@ -2613,7 +2614,7 @@ public:
for (unsigned i = 0; i < NumDims; ++i) {
isl_pw_aff *PwAff =
- const_cast<isl_pw_aff *>(Array->getDimensionSizePw(i));
+ const_cast<isl_pw_aff *>(Array->getDimensionSizePw(i).release());
// isl_pw_aff can be NULL for zero dimension. Only in the case of a
// Fortran array will we have a legitimate dimension.
@@ -2623,7 +2624,8 @@ public:
}
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));
+ isl_local_space_from_space(Array->getSpace().release()), isl_dim_set,
+ i));
PwAff = isl_pw_aff_add_dims(PwAff, isl_dim_in,
isl_pw_aff_dim(Val, isl_dim_in));
PwAff = isl_pw_aff_set_tuple_id(PwAff, isl_dim_in,
@@ -2680,7 +2682,7 @@ public:
}
for (unsigned i = 1; i < PPCGArray.n_index; ++i) {
- isl_pw_aff *Bound = Array->getDimensionSizePw(i);
+ isl_pw_aff *Bound = Array->getDimensionSizePw(i).release();
auto LS = isl_pw_aff_get_domain_space(Bound);
auto Aff = isl_multi_aff_zero(LS);
Bound = isl_pw_aff_pullback_multi_aff(Bound, Aff);
@@ -2714,7 +2716,7 @@ public:
gpu_array_info &PPCGArray = PPCGProg->array[i];
- PPCGArray.space = Array->getSpace();
+ PPCGArray.space = Array->getSpace().release();
PPCGArray.type = strdup(TypeName.c_str());
PPCGArray.size = Array->getElementType()->getPrimitiveSizeInBits() / 8;
PPCGArray.name = strdup(Array->getName().c_str());
@@ -2749,7 +2751,7 @@ public:
isl_union_map *Maps = isl_union_map_empty(S->getParamSpace());
for (auto &Array : S->arrays()) {
- isl_space *Space = Array->getSpace();
+ isl_space *Space = Array->getSpace().release();
Space = isl_space_map_from_set(Space);
isl_map *Identity = isl_map_identity(Space);
Maps = isl_union_map_add_map(Maps, Identity);
Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=308801&r1=308800&r2=308801&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Fri Jul 21 16:07:56 2017
@@ -490,7 +490,7 @@ bool JSONImporter::importAccesses(Scop &
return false;
}
isl_id_free(NewOutId);
- NewOutId = SAI->getBasePtrId();
+ NewOutId = SAI->getBasePtrId().release();
} else {
NewOutId = isl_map_get_tuple_id(CurrentAccessMap, isl_dim_out);
}
Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=308801&r1=308800&r2=308801&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Fri Jul 21 16:07:56 2017
@@ -1131,7 +1131,8 @@ static __isl_give isl_schedule_node *opt
auto *SAI = Stmt->getParent()->createScopArrayInfo(
MMI.B->getElementType(), "Packed_B",
{FirstDimSize, SecondDimSize, ThirdDimSize});
- AccRel = isl_map_set_tuple_id(AccRel, isl_dim_out, SAI->getBasePtrId());
+ AccRel =
+ isl_map_set_tuple_id(AccRel, isl_dim_out, SAI->getBasePtrId().release());
auto *OldAcc = MMI.B->getLatestAccessRelation();
MMI.B->setNewAccessRelation(AccRel);
auto *ExtMap =
@@ -1160,7 +1161,8 @@ static __isl_give isl_schedule_node *opt
SAI = Stmt->getParent()->createScopArrayInfo(
MMI.A->getElementType(), "Packed_A",
{FirstDimSize, SecondDimSize, ThirdDimSize});
- AccRel = isl_map_set_tuple_id(AccRel, isl_dim_out, SAI->getBasePtrId());
+ AccRel =
+ isl_map_set_tuple_id(AccRel, isl_dim_out, SAI->getBasePtrId().release());
OldAcc = MMI.A->getLatestAccessRelation();
MMI.A->setNewAccessRelation(AccRel);
ExtMap = isl_map_project_out(MapOldIndVar, isl_dim_out, 3,
More information about the llvm-commits
mailing list