[polly] r310221 - [ScopInfo] Translate Scop::getContext to isl++ [NFC]

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 6 12:52:38 PDT 2017


Author: grosser
Date: Sun Aug  6 12:52:38 2017
New Revision: 310221

URL: http://llvm.org/viewvc/llvm-project?rev=310221&view=rev
Log:
[ScopInfo] Translate Scop::getContext to isl++ [NFC]

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/CodeGen/BlockGenerators.cpp
    polly/trunk/lib/CodeGen/CodeGeneration.cpp
    polly/trunk/lib/CodeGen/IslAst.cpp
    polly/trunk/lib/CodeGen/IslNodeBuilder.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=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Sun Aug  6 12:52:38 2017
@@ -2505,7 +2505,7 @@ public:
   /// Get the constraint on parameter of this Scop.
   ///
   /// @return The constraint on parameter of this Scop.
-  __isl_give isl_set *getContext() const;
+  isl::set getContext() const;
 
   /// Return space of isl context parameters.
   ///

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sun Aug  6 12:52:38 2017
@@ -1025,7 +1025,7 @@ MemoryAccess::MemoryAccess(ScopStmt *Stm
 }
 
 void MemoryAccess::realignParams() {
-  isl::set Ctx = isl::manage(Statement->getParent()->getContext());
+  isl::set Ctx = Statement->getParent()->getContext();
   InvalidDomain = InvalidDomain.gist_params(Ctx);
   AccessRelation = AccessRelation.gist_params(Ctx);
 }
@@ -1179,7 +1179,7 @@ void MemoryAccess::setNewAccessRelation(
     // Check whether there is an access for every statement instance.
     isl::set StmtDomain = getStatement()->getDomain();
     StmtDomain = StmtDomain.intersect_params(
-        isl::manage(getStatement()->getParent()->getContext()));
+        getStatement()->getParent()->getContext());
     isl::set NewDomain = NewAccess.domain();
     assert(StmtDomain.is_subset(NewDomain) &&
            "Partial READ accesses not supported");
@@ -1312,7 +1312,7 @@ void ScopStmt::realignParams() {
   for (MemoryAccess *MA : *this)
     MA->realignParams();
 
-  isl::set Ctx = isl::manage(Parent.getContext());
+  isl::set Ctx = Parent.getContext();
   InvalidDomain = InvalidDomain.gist_params(Ctx);
   Domain = Domain.gist_params(Ctx);
 }
@@ -2423,7 +2423,7 @@ void Scop::realignParams() {
   for (ScopStmt &Stmt : *this)
     Stmt.realignParams();
   // Simplify the schedule according to the context too.
-  Schedule = isl_schedule_gist_domain_params(Schedule, getContext());
+  Schedule = isl_schedule_gist_domain_params(Schedule, getContext().release());
 }
 
 static __isl_give isl_set *
@@ -2441,7 +2441,7 @@ simplifyAssumptionContext(__isl_take isl
         isl_set_gist_params(AssumptionContext, DomainParameters);
   }
 
-  AssumptionContext = isl_set_gist_params(AssumptionContext, S.getContext());
+  AssumptionContext = isl_set_gist_params(AssumptionContext, S.getContext().release());
   return AssumptionContext;
 }
 
@@ -3938,7 +3938,7 @@ void Scop::addInvariantLoads(ScopStmt &S
     } else {
       MACtx = isl_set_copy(DomainCtx);
       MACtx = isl_set_subtract(MACtx, isl_set_union(MAInvalidCtx, NHCtx));
-      MACtx = isl_set_gist_params(MACtx, getContext());
+      MACtx = isl_set_gist_params(MACtx, getContext().release());
     }
 
     bool Consolidated = false;
@@ -4244,7 +4244,7 @@ const ScopArrayInfo *Scop::getScopArrayI
   return SAI;
 }
 
-std::string Scop::getContextStr() const { return stringFromIslObj(Context); }
+std::string Scop::getContextStr() const { return getContext().to_str(); }
 
 std::string Scop::getAssumedContextStr() const {
   assert(AssumedContext && "Assumed context not yet built");
@@ -4278,7 +4278,7 @@ std::pair<std::string, std::string> Scop
   return std::make_pair(EntryName, ExitName);
 }
 
-__isl_give isl_set *Scop::getContext() const { return isl_set_copy(Context); }
+isl::set Scop::getContext() const { return isl::manage(isl_set_copy(Context)); }
 __isl_give isl_space *Scop::getParamSpace() const {
   return isl_set_get_space(Context);
 }
@@ -4466,7 +4466,7 @@ bool Scop::trackAssumption(AssumptionKin
 void Scop::addAssumption(AssumptionKind Kind, __isl_take isl_set *Set,
                          DebugLoc Loc, AssumptionSign Sign, BasicBlock *BB) {
   // Simplify the assumptions/restrictions first.
-  Set = isl_set_gist_params(Set, getContext());
+  Set = isl_set_gist_params(Set, getContext().release());
 
   if (!trackAssumption(Kind, Set, Loc, Sign, BB)) {
     isl_set_free(Set);

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sun Aug  6 12:52:38 2017
@@ -609,7 +609,7 @@ void BlockGenerator::generateConditional
   // If the condition is a tautology, don't generate a condition around the
   // code.
   bool IsPartialWrite =
-      !StmtDom.intersect_params(give(Stmt.getParent()->getContext()))
+      !StmtDom.intersect_params(Stmt.getParent()->getContext())
            .is_subset(Subdomain);
   if (!IsPartialWrite) {
     GenThenFunc();

Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Sun Aug  6 12:52:38 2017
@@ -228,7 +228,7 @@ static bool CodeGen(Scop &S, IslAstInfo
 
     isl_ast_node_free(AstRoot);
   } else {
-    NodeBuilder.addParameters(S.getContext());
+    NodeBuilder.addParameters(S.getContext().release());
     Value *RTC = NodeBuilder.createRTC(AI.getRunCondition());
 
     Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Sun Aug  6 12:52:38 2017
@@ -426,7 +426,7 @@ void IslAst::init(const Dependences &D)
   AstBuildUserInfo BuildInfo;
 
   if (UseContext)
-    Build = isl_ast_build_from_context(S.getContext());
+    Build = isl_ast_build_from_context(S.getContext().release());
   else
     Build = isl_ast_build_from_context(isl_set_universe(S.getParamSpace()));
 

Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Sun Aug  6 12:52:38 2017
@@ -815,9 +815,9 @@ IslNodeBuilder::createNewAccesses(ScopSt
       auto SchedDom = isl_set_from_union_set(
           isl_union_map_domain(isl_union_map_copy(Schedule)));
       auto AccDom = isl_map_domain(MA->getAccessRelation().release());
-      Dom = isl_set_intersect_params(Dom, Stmt->getParent()->getContext());
+      Dom = isl_set_intersect_params(Dom, Stmt->getParent()->getContext().release());
       SchedDom =
-          isl_set_intersect_params(SchedDom, Stmt->getParent()->getContext());
+          isl_set_intersect_params(SchedDom, Stmt->getParent()->getContext().release());
       assert(isl_set_is_subset(SchedDom, AccDom) &&
              "Access relation not defined on full schedule domain");
       assert(isl_set_is_subset(Dom, AccDom) &&
@@ -1184,7 +1184,7 @@ Value *IslNodeBuilder::preloadInvariantL
                                             isl_set *Domain) {
 
   isl_set *AccessRange = isl_map_range(MA.getAddressFunction().release());
-  AccessRange = isl_set_gist_params(AccessRange, S.getContext());
+  AccessRange = isl_set_gist_params(AccessRange, S.getContext().release());
 
   if (!materializeParameters(AccessRange)) {
     isl_set_free(AccessRange);

Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Sun Aug  6 12:52:38 2017
@@ -762,7 +762,7 @@ void GPUNodeBuilder::finalize() {
 void GPUNodeBuilder::allocateDeviceArrays() {
   assert(!ManagedMemory && "Managed memory will directly send host pointers "
                            "to the kernel. There is no need for device arrays");
-  isl_ast_build *Build = isl_ast_build_from_context(S.getContext());
+  isl_ast_build *Build = isl_ast_build_from_context(S.getContext().release());
 
   for (int i = 0; i < Prog->n_array; ++i) {
     gpu_array_info *Array = &Prog->array[i];
@@ -1071,7 +1071,7 @@ static bool isPrefix(std::string String,
 
 Value *GPUNodeBuilder::getArraySize(gpu_array_info *Array) {
   isl::ast_build Build =
-      isl::ast_build::from_context(isl::manage(S.getContext()));
+      isl::ast_build::from_context(S.getContext());
   Value *ArraySize = ConstantInt::get(Builder.getInt64Ty(), Array->size);
 
   if (!gpu_array_is_scalar(Array)) {
@@ -1100,7 +1100,7 @@ Value *GPUNodeBuilder::getArrayOffset(gp
     return nullptr;
 
   isl::ast_build Build =
-      isl::ast_build::from_context(isl::manage(S.getContext()));
+      isl::ast_build::from_context(S.getContext());
 
   isl::set Min = isl::manage(isl_set_copy(Array->extent)).lexmin();
 
@@ -1517,8 +1517,7 @@ void GPUNodeBuilder::clearLoops(Function
 
 std::tuple<Value *, Value *> GPUNodeBuilder::getGridSizes(ppcg_kernel *Kernel) {
   std::vector<Value *> Sizes;
-  isl::ast_build Context =
-      isl::ast_build::from_context(isl::manage(S.getContext()));
+  isl::ast_build Context = isl::ast_build::from_context(S.getContext());
 
   isl::multi_pw_aff GridSizePwAffs =
       isl::manage(isl_multi_pw_aff_copy(Kernel->grid_size));
@@ -2631,10 +2630,10 @@ public:
     PPCGScop->start = 0;
     PPCGScop->end = 0;
 
-    PPCGScop->context = S->getContext();
+    PPCGScop->context = S->getContext().release();
     PPCGScop->domain = S->getDomains();
     // TODO: investigate this further. PPCG calls collect_call_domains.
-    PPCGScop->call = isl_union_set_from_set(S->getContext());
+    PPCGScop->call = isl_union_set_from_set(S->getContext().release());
     PPCGScop->tagged_reads = getTaggedReads();
     PPCGScop->reads = S->getReads().release();
     PPCGScop->live_in = nullptr;
@@ -2845,7 +2844,7 @@ public:
         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());
+        Bound = isl_pw_aff_gist(Bound, S->getContext().release());
         Bounds.push_back(Bound);
       }
     }
@@ -3375,7 +3374,7 @@ public:
     // TODO: Handle LICM
     auto SplitBlock = StartBlock->getSinglePredecessor();
     Builder.SetInsertPoint(SplitBlock->getTerminator());
-    NodeBuilder.addParameters(S->getContext());
+    NodeBuilder.addParameters(S->getContext().release());
 
     isl_ast_build *Build = isl_ast_build_alloc(S->getIslCtx());
     isl_ast_expr *Condition = IslAst::buildRunCondition(*S, Build);

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=310221&r1=310220&r2=310221&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Sun Aug  6 12:52:38 2017
@@ -273,7 +273,7 @@ void JSONImporter::printScop(raw_ostream
 typedef Dependences::StatementToIslMapTy StatementToIslMapTy;
 
 bool JSONImporter::importContext(Scop &S, Json::Value &JScop) {
-  isl_set *OldContext = S.getContext();
+  isl_set *OldContext = S.getContext().release();
 
   // Check if key 'context' is present.
   if (!JScop.isMember("context")) {
@@ -561,9 +561,9 @@ bool JSONImporter::importAccesses(Scop &
       }
 
       NewAccessDomain =
-          isl_set_intersect_params(NewAccessDomain, S.getContext());
+          isl_set_intersect_params(NewAccessDomain, S.getContext().release());
       CurrentAccessDomain =
-          isl_set_intersect_params(CurrentAccessDomain, S.getContext());
+          isl_set_intersect_params(CurrentAccessDomain, S.getContext().release());
 
       if (MA->isRead() &&
           isl_set_is_subset(CurrentAccessDomain, NewAccessDomain) ==




More information about the llvm-commits mailing list