[polly] r309871 - Move setNewAccessRelation to isl++

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 12:27:25 PDT 2017


Author: grosser
Date: Wed Aug  2 12:27:25 2017
New Revision: 309871

URL: http://llvm.org/viewvc/llvm-project?rev=309871&view=rev
Log:
Move setNewAccessRelation to isl++

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Exchange/JSONExporter.cpp
    polly/trunk/lib/Transform/DeLICM.cpp
    polly/trunk/lib/Transform/ScheduleOptimizer.cpp
    polly/trunk/lib/Transform/Simplify.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=309871&r1=309870&r2=309871&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Wed Aug  2 12:27:25 2017
@@ -1068,7 +1068,7 @@ public:
   void setAccessRelation(isl::map AccessRelation);
 
   /// Set the updated access relation read from JSCOP file.
-  void setNewAccessRelation(__isl_take isl_map *NewAccessRelation);
+  void setNewAccessRelation(isl::map NewAccessRelation);
 
   /// Return whether the MemoryyAccess is a partial access. That is, the access
   /// is not executed in some instances of the parent statement's domain.

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=309871&r1=309870&r2=309871&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Aug  2 12:27:25 2017
@@ -1166,37 +1166,34 @@ void MemoryAccess::setAccessRelation(isl
   AccessRelation = NewAccess;
 }
 
-void MemoryAccess::setNewAccessRelation(__isl_take isl_map *NewAccess) {
+void MemoryAccess::setNewAccessRelation(isl::map NewAccess) {
   assert(NewAccess);
 
 #ifndef NDEBUG
   // Check domain space compatibility.
-  auto *NewSpace = isl_map_get_space(NewAccess);
-  auto *NewDomainSpace = isl_space_domain(isl_space_copy(NewSpace));
-  auto *OriginalDomainSpace = getStatement()->getDomainSpace();
-  assert(isl_space_has_equal_tuples(OriginalDomainSpace, NewDomainSpace));
-  isl_space_free(NewDomainSpace);
-  isl_space_free(OriginalDomainSpace);
+  isl::space NewSpace = NewAccess.get_space();
+  isl::space NewDomainSpace = NewSpace.domain();
+  isl::space OriginalDomainSpace =
+      isl::manage(getStatement()->getDomainSpace());
+  assert(OriginalDomainSpace.has_equal_tuples(NewDomainSpace));
 
   // Reads must be executed unconditionally. Writes might be executed in a
   // subdomain only.
   if (isRead()) {
     // Check whether there is an access for every statement instance.
-    auto *StmtDomain = getStatement()->getDomain();
-    StmtDomain = isl_set_intersect_params(
-        StmtDomain, getStatement()->getParent()->getContext());
-    auto *NewDomain = isl_map_domain(isl_map_copy(NewAccess));
-    assert(isl_set_is_subset(StmtDomain, NewDomain) &&
+    isl::set StmtDomain = isl::manage(getStatement()->getDomain());
+    StmtDomain = StmtDomain.intersect_params(
+        isl::manage(getStatement()->getParent()->getContext()));
+    isl::set NewDomain = NewAccess.domain();
+    assert(StmtDomain.is_subset(NewDomain) &&
            "Partial READ accesses not supported");
-    isl_set_free(NewDomain);
-    isl_set_free(StmtDomain);
   }
 
-  auto *NewAccessSpace = isl_space_range(NewSpace);
-  assert(isl_space_has_tuple_id(NewAccessSpace, isl_dim_set) &&
+  isl::space NewAccessSpace = NewAccess.get_space();
+  assert(NewAccessSpace.has_tuple_id(isl::dim::set) &&
          "Must specify the array that is accessed");
-  auto *NewArrayId = isl_space_get_tuple_id(NewAccessSpace, isl_dim_set);
-  auto *SAI = static_cast<ScopArrayInfo *>(isl_id_get_user(NewArrayId));
+  isl::id NewArrayId = NewAccessSpace.get_tuple_id(isl::dim::set);
+  auto *SAI = static_cast<ScopArrayInfo *>(NewArrayId.get_user());
   assert(SAI && "Must set a ScopArrayInfo");
 
   if (SAI->isArrayKind() && SAI->getBasePtrOriginSAI()) {
@@ -1211,14 +1208,12 @@ void MemoryAccess::setNewAccessRelation(
   // Check whether access dimensions correspond to number of dimensions of the
   // accesses array.
   auto Dims = SAI->getNumberOfDimensions();
-  assert(isl_space_dim(NewAccessSpace, isl_dim_set) == Dims &&
+  assert(NewAccessSpace.dim(isl::dim::set) == Dims &&
          "Access dims must match array dims");
-  isl_space_free(NewAccessSpace);
-  isl_id_free(NewArrayId);
 #endif
 
-  NewAccess = isl_map_gist_domain(NewAccess, getStatement()->getDomain());
-  NewAccessRelation = isl::manage(NewAccess);
+  NewAccess = NewAccess.gist_domain(isl::manage(getStatement()->getDomain()));
+  NewAccessRelation = NewAccess;
 }
 
 bool MemoryAccess::isLatestPartialAccess() const {

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=309871&r1=309870&r2=309871&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Wed Aug  2 12:27:25 2017
@@ -582,7 +582,7 @@ bool JSONImporter::importAccesses(Scop &
         // Statistics.
         ++NewAccessMapFound;
         NewAccessStrings.push_back(Accesses.asCString());
-        MA->setNewAccessRelation(NewAccessMap);
+        MA->setNewAccessRelation(isl::manage(NewAccessMap));
       } else {
         isl_map_free(NewAccessMap);
       }

Modified: polly/trunk/lib/Transform/DeLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeLICM.cpp?rev=309871&r1=309870&r2=309871&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeLICM.cpp (original)
+++ polly/trunk/lib/Transform/DeLICM.cpp Wed Aug  2 12:27:25 2017
@@ -1600,11 +1600,11 @@ private:
       simplify(NewAccRel);
 
       assert(isl_union_map_n_map(NewAccRel.keep()) == 1);
-      MA->setNewAccessRelation(isl_map_from_union_map(NewAccRel.take()));
+      MA->setNewAccessRelation(isl::map::from_union_map(NewAccRel));
     }
 
     auto *WA = S->getValueDef(SAI);
-    WA->setNewAccessRelation(DefTarget.copy());
+    WA->setNewAccessRelation(DefTarget);
     applyLifetime(Proposed);
 
     MappedValueScalars++;
@@ -1796,12 +1796,12 @@ private:
       simplify(NewAccRel);
 
       assert(isl_union_map_n_map(NewAccRel.keep()) == 1);
-      MA->setNewAccessRelation(isl_map_from_union_map(NewAccRel.take()));
+      MA->setNewAccessRelation(isl::map::from_union_map(NewAccRel));
     }
 
     // Redirect the PHI read.
     auto *PHIRead = S->getPHIRead(SAI);
-    PHIRead->setNewAccessRelation(ReadTarget.copy());
+    PHIRead->setNewAccessRelation(ReadTarget);
     applyLifetime(Proposed);
 
     MappedPHIScalars++;

Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=309871&r1=309870&r2=309871&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Wed Aug  2 12:27:25 2017
@@ -1053,7 +1053,7 @@ optimizeDataLayoutMatrMulPattern(isl::sc
       {FirstDimSize, SecondDimSize, ThirdDimSize});
   AccRel = AccRel.set_tuple_id(isl::dim::out, SAI->getBasePtrId());
   auto OldAcc = MMI.B->getLatestAccessRelation();
-  MMI.B->setNewAccessRelation(AccRel.release());
+  MMI.B->setNewAccessRelation(AccRel);
   auto ExtMap = MapOldIndVar.project_out(isl::dim::out, 2,
                                          MapOldIndVar.dim(isl::dim::out) - 2);
   ExtMap = ExtMap.reverse();
@@ -1083,7 +1083,7 @@ optimizeDataLayoutMatrMulPattern(isl::sc
       {FirstDimSize, SecondDimSize, ThirdDimSize});
   AccRel = AccRel.set_tuple_id(isl::dim::out, SAI->getBasePtrId());
   OldAcc = MMI.A->getLatestAccessRelation();
-  MMI.A->setNewAccessRelation(AccRel.release());
+  MMI.A->setNewAccessRelation(AccRel);
   ExtMap = MapOldIndVar.project_out(isl::dim::out, 3,
                                     MapOldIndVar.dim(isl::dim::out) - 3);
   ExtMap = ExtMap.reverse();

Modified: polly/trunk/lib/Transform/Simplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Simplify.cpp?rev=309871&r1=309870&r2=309871&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Simplify.cpp (original)
+++ polly/trunk/lib/Transform/Simplify.cpp Wed Aug  2 12:27:25 2017
@@ -345,7 +345,7 @@ private:
 
             // Carry out the coalescing.
             Stmt.removeSingleMemoryAccess(MA);
-            OtherMA->setNewAccessRelation(NewAccRel.copy());
+            OtherMA->setNewAccessRelation(NewAccRel);
 
             // We removed MA, OtherMA takes its role.
             MA = OtherMA;




More information about the llvm-commits mailing list