[polly] r308892 - Move ScopArrayInfo::getFromAccessFunction and getFromId to isl++
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 09:22:27 PDT 2017
Author: grosser
Date: Mon Jul 24 09:22:27 2017
New Revision: 308892
URL: http://llvm.org/viewvc/llvm-project?rev=308892&view=rev
Log:
Move ScopArrayInfo::getFromAccessFunction and getFromId to isl++
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/IslExprBuilder.cpp
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
polly/trunk/lib/Exchange/JSONExporter.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=308892&r1=308891&r2=308892&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Mon Jul 24 09:22:27 2017
@@ -375,11 +375,10 @@ public:
void print(raw_ostream &OS, bool SizeAsPwAff = false) const;
/// Access the ScopArrayInfo associated with an access function.
- static const ScopArrayInfo *
- getFromAccessFunction(__isl_keep isl_pw_multi_aff *PMA);
+ static const ScopArrayInfo *getFromAccessFunction(isl::pw_multi_aff PMA);
/// Access the ScopArrayInfo associated with an isl Id.
- static const ScopArrayInfo *getFromId(__isl_take isl_id *Id);
+ static const ScopArrayInfo *getFromId(isl::id Id);
/// Get the space of this array access.
isl::space getSpace() const;
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=308892&r1=308891&r2=308892&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Jul 24 09:22:27 2017
@@ -437,16 +437,15 @@ void ScopArrayInfo::print(raw_ostream &O
}
const ScopArrayInfo *
-ScopArrayInfo::getFromAccessFunction(__isl_keep isl_pw_multi_aff *PMA) {
- isl_id *Id = isl_pw_multi_aff_get_tuple_id(PMA, isl_dim_out);
- assert(Id && "Output dimension didn't have an ID");
+ScopArrayInfo::getFromAccessFunction(isl::pw_multi_aff PMA) {
+ isl::id Id = PMA.get_tuple_id(isl::dim::out);
+ assert(!Id.is_null() && "Output dimension didn't have an ID");
return getFromId(Id);
}
-const ScopArrayInfo *ScopArrayInfo::getFromId(__isl_take isl_id *Id) {
- void *User = isl_id_get_user(Id);
+const ScopArrayInfo *ScopArrayInfo::getFromId(isl::id Id) {
+ void *User = Id.get_user();
const ScopArrayInfo *SAI = static_cast<ScopArrayInfo *>(User);
- isl_id_free(Id);
return SAI;
}
@@ -1017,7 +1016,7 @@ MemoryAccess::MemoryAccess(ScopStmt *Stm
Statement(Stmt), InvalidDomain(nullptr), AccessInstruction(nullptr),
IsAffine(true), AccessRelation(nullptr),
NewAccessRelation(isl::manage(AccRel)), FAD(nullptr) {
- auto *ArrayInfoId = NewAccessRelation.get_tuple_id(isl::dim::out).release();
+ isl::id ArrayInfoId = NewAccessRelation.get_tuple_id(isl::dim::out);
auto *SAI = ScopArrayInfo::getFromId(ArrayInfoId);
Sizes.push_back(nullptr);
for (unsigned i = 1; i < SAI->getNumberOfDimensions(); i++)
@@ -4719,6 +4718,16 @@ Scop::getAccessesOfType(std::function<bo
Accesses = isl_union_map_add_map(Accesses, AccessDomain);
}
}
+
+ return isl_union_map_coalesce(Accesses);
+
+ for (auto X : this->getInvariantAccesses())
+ for (auto A : X.InvariantAccesses) {
+ if (!Predicate(*A))
+ continue;
+ Accesses =
+ isl_union_map_add_map(Accesses, A->getAccessRelation().release());
+ }
return isl_union_map_coalesce(Accesses);
}
Modified: polly/trunk/lib/CodeGen/IslExprBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslExprBuilder.cpp?rev=308892&r1=308891&r2=308892&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslExprBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslExprBuilder.cpp Mon Jul 24 09:22:27 2017
@@ -233,7 +233,7 @@ Value *IslExprBuilder::createAccessAddre
SAI = (*IDToSAI)[BaseId];
if (!SAI)
- SAI = ScopArrayInfo::getFromId(BaseId);
+ SAI = ScopArrayInfo::getFromId(isl::manage(BaseId));
else
isl_id_free(BaseId);
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=308892&r1=308891&r2=308892&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Mon Jul 24 09:22:27 2017
@@ -1512,7 +1512,7 @@ GPUNodeBuilder::createLaunchParameters(p
continue;
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
- const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(Id);
+ const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl::manage(Id));
ArgSizes[Index] = SAI->getElemSizeInBytes();
@@ -1785,7 +1785,7 @@ GPUNodeBuilder::createKernelFunctionDecl
if (gpu_array_is_read_only_scalar(&Prog->array[i])) {
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
- const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(Id);
+ const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl::manage(Id));
Args.push_back(SAI->getElementType());
MemoryType.push_back(
ConstantAsMetadata::get(ConstantInt::get(Builder.getInt32Ty(), 0)));
@@ -1865,7 +1865,8 @@ GPUNodeBuilder::createKernelFunctionDecl
Arg->setName(Kernel->array[i].array->name);
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
- const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl_id_copy(Id));
+ const ScopArrayInfo *SAI =
+ ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id)));
Type *EleTy = SAI->getElementType();
Value *Val = &*Arg;
SmallVector<const SCEV *, 4> Sizes;
@@ -1996,7 +1997,8 @@ void GPUNodeBuilder::prepareKernelArgume
continue;
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
- const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl_id_copy(Id));
+ const ScopArrayInfo *SAI =
+ ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id)));
isl_id_free(Id);
if (SAI->getNumberOfDimensions() > 0) {
@@ -2029,7 +2031,8 @@ void GPUNodeBuilder::finalizeKernelArgum
continue;
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
- const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl_id_copy(Id));
+ const ScopArrayInfo *SAI =
+ ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id)));
isl_id_free(Id);
if (SAI->getNumberOfDimensions() > 0) {
@@ -2068,7 +2071,7 @@ void GPUNodeBuilder::createKernelVariabl
for (int i = 0; i < Kernel->n_var; ++i) {
struct ppcg_kernel_var &Var = Kernel->var[i];
isl_id *Id = isl_space_get_tuple_id(Var.array->space, isl_dim_set);
- Type *EleTy = ScopArrayInfo::getFromId(Id)->getElementType();
+ Type *EleTy = ScopArrayInfo::getFromId(isl::manage(Id))->getElementType();
Type *ArrayTy = EleTy;
SmallVector<const SCEV *, 4> Sizes;
Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=308892&r1=308891&r2=308892&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Mon Jul 24 09:22:27 2017
@@ -480,7 +480,7 @@ bool JSONImporter::importAccesses(Scop &
NewOutId = isl_map_get_tuple_id(NewAccessMap, isl_dim_out);
auto *SAI = S.getArrayInfoByName(isl_id_get_name(NewOutId));
isl_id *OutId = isl_map_get_tuple_id(CurrentAccessMap, isl_dim_out);
- auto *OutSAI = ScopArrayInfo::getFromId(OutId);
+ auto *OutSAI = ScopArrayInfo::getFromId(isl::manage(OutId));
if (!SAI || SAI->getElementType() != OutSAI->getElementType()) {
errs() << "JScop file contains access function with undeclared "
"ScopArrayInfo\n";
More information about the llvm-commits
mailing list