[ScopInfo] Move Scop::getPwAffOnly to isl++ [NFC]
authorTobias Grosser <tobias@grosser.es>
Sun, 6 Aug 2017 21:42:38 +0000 (21:42 +0000)
committerTobias Grosser <tobias@grosser.es>
Sun, 6 Aug 2017 21:42:38 +0000 (21:42 +0000)
llvm-svn: 310231

polly/include/polly/ScopInfo.h
polly/lib/Analysis/DependenceInfo.cpp
polly/lib/Analysis/ScopInfo.cpp
polly/lib/CodeGen/IslAst.cpp
polly/lib/CodeGen/IslNodeBuilder.cpp
polly/lib/CodeGen/PPCGCodeGeneration.cpp
polly/lib/Support/SCEVAffinator.cpp
polly/lib/Transform/DeadCodeElimination.cpp
polly/lib/Transform/FlattenSchedule.cpp
polly/lib/Transform/ScheduleOptimizer.cpp
polly/lib/Transform/ZoneAlgo.cpp

index ef13384..7bdf6d3 100644 (file)
@@ -2872,17 +2872,17 @@ public:
   ///
   /// This function is like @see Scop::getPwAff() but strips away the invalid
   /// domain part associated with the piecewise affine function.
-  __isl_give isl_pw_aff *getPwAffOnly(const SCEV *E, BasicBlock *BB = nullptr);
+  isl::pw_aff getPwAffOnly(const SCEV *E, BasicBlock *BB = nullptr);
 
   /// Return the domain of @p Stmt.
   ///
   /// @param Stmt The statement for which the conditions should be returned.
-  __isl_give isl_set *getDomainConditions(const ScopStmt *Stmt) const;
+  isl::set getDomainConditions(const ScopStmt *Stmt) const;
 
   /// Return the domain of @p BB.
   ///
   /// @param BB The block for which the conditions should be returned.
-  __isl_give isl_set *getDomainConditions(BasicBlock *BB) const;
+  isl::set getDomainConditions(BasicBlock *BB) const;
 
   /// Get a union set containing the iteration domains of all statements.
   isl::union_set getDomains() const;
@@ -2906,10 +2906,10 @@ public:
   ///
   /// @return The schedule of all the statements in the SCoP, if the schedule of
   /// the Scop does not contain extension nodes, and nullptr, otherwise.
-  __isl_give isl_union_map *getSchedule() const;
+  isl::union_map getSchedule() const;
 
   /// Get a schedule tree describing the schedule of all statements.
-  __isl_give isl_schedule *getScheduleTree() const;
+  isl::schedule getScheduleTree() const;
 
   /// Update the current schedule
   ///
index b1b97a9..1b09e4f 100644 (file)
@@ -420,7 +420,7 @@ void Dependences::calculateDependences(Scop &S) {
         dbgs() << "ReductionTagMap: " << ReductionTagMap << '\n';
         dbgs() << "TaggedStmtDomain: " << TaggedStmtDomain << '\n';);
 
-  Schedule = S.getScheduleTree();
+  Schedule = S.getScheduleTree().release();
 
   if (!HasReductions) {
     isl_union_map_free(ReductionTagMap);
index b5fda02..c3c676f 100644 (file)
@@ -382,7 +382,7 @@ bool ScopArrayInfo::updateSizes(ArrayRef<const SCEV *> NewSizes,
       DimensionSizesPw.push_back(nullptr);
       continue;
     }
-    isl::pw_aff Size = isl::manage(S.getPwAffOnly(Expr));
+    isl::pw_aff Size = S.getPwAffOnly(Expr);
     DimensionSizesPw.push_back(Size);
   }
   return true;
@@ -1228,7 +1228,7 @@ isl::map ScopStmt::getSchedule() const {
     return isl::manage(isl_map_from_aff(isl_aff_zero_on_domain(
         isl_local_space_from_space(getDomainSpace().release()))));
   }
-  auto *Schedule = getParent()->getSchedule();
+  auto *Schedule = getParent()->getSchedule().release();
   if (!Schedule) {
     isl_set_free(Domain);
     return nullptr;
@@ -1688,7 +1688,7 @@ buildConditionSets(Scop &S, BasicBlock *BB, TerminatorInst *TI, Loop *L,
 void ScopStmt::buildDomain() {
   isl::id Id = isl::id::alloc(getIslCtx(), getBaseName(), this);
 
-  Domain = isl::manage(getParent()->getDomainConditions(this));
+  Domain = getParent()->getDomainConditions(this);
   Domain = Domain.set_tuple_id(Id);
 }
 
@@ -2681,14 +2681,14 @@ static inline __isl_give isl_set *addDomainDimId(__isl_take isl_set *Domain,
   return isl_set_set_dim_id(Domain, isl_dim_set, Dim, DimId);
 }
 
-__isl_give isl_set *Scop::getDomainConditions(const ScopStmt *Stmt) const {
+isl::set Scop::getDomainConditions(const ScopStmt *Stmt) const {
   return getDomainConditions(Stmt->getEntryBlock());
 }
 
-__isl_give isl_set *Scop::getDomainConditions(BasicBlock *BB) const {
+isl::set Scop::getDomainConditions(BasicBlock *BB) const {
   auto DIt = DomainMap.find(BB);
   if (DIt != DomainMap.end())
-    return DIt->getSecond().copy();
+    return DIt->getSecond();
 
   auto &RI = *R.getRegionInfo();
   auto *BBR = RI.getRegionFor(BB);
@@ -3096,7 +3096,7 @@ isl::set Scop::getPredecessorDomainConstraints(BasicBlock *BB, isl::set Domain,
       PropagatedRegions.insert(PredR);
     }
 
-    auto *PredBBDom = getDomainConditions(PredBB);
+    auto *PredBBDom = getDomainConditions(PredBB).release();
     Loop *PredBBLoop = getFirstNonBoxedLoopFor(PredBB, LI, getBoxedLoops());
 
     PredBBDom = adjustDomainDimensions(*this, PredBBDom, PredBBLoop, BBLoop);
@@ -4499,7 +4499,7 @@ void Scop::addRecordedAssumptions() {
     }
 
     // If the domain was deleted the assumptions are void.
-    isl_set *Dom = getDomainConditions(AS.BB);
+    isl_set *Dom = getDomainConditions(AS.BB).release();
     if (!Dom) {
       isl_set_free(AS.Set);
       continue;
@@ -4676,10 +4676,10 @@ isl::union_set Scop::getDomains() const {
   return isl::manage(Domain);
 }
 
-__isl_give isl_pw_aff *Scop::getPwAffOnly(const SCEV *E, BasicBlock *BB) {
+isl::pw_aff Scop::getPwAffOnly(const SCEV *E, BasicBlock *BB) {
   PWACtx PWAC = getPwAff(E, BB);
   isl_set_free(PWAC.second);
-  return PWAC.first;
+  return isl::manage(PWAC.first);
 }
 
 isl::union_map
@@ -4736,20 +4736,20 @@ bool Scop::containsExtensionNode(__isl_keep isl_schedule *Schedule) {
                                                      nullptr) == isl_stat_error;
 }
 
-__isl_give isl_union_map *Scop::getSchedule() const {
-  auto *Tree = getScheduleTree();
+isl::union_map Scop::getSchedule() const {
+  auto *Tree = getScheduleTree().release();
   if (containsExtensionNode(Tree)) {
     isl_schedule_free(Tree);
     return nullptr;
   }
   auto *S = isl_schedule_get_map(Tree);
   isl_schedule_free(Tree);
-  return S;
+  return isl::manage(S);
 }
 
-__isl_give isl_schedule *Scop::getScheduleTree() const {
-  return isl_schedule_intersect_domain(isl_schedule_copy(Schedule),
-                                       getDomains().release());
+isl::schedule Scop::getScheduleTree() const {
+  return isl::manage(isl_schedule_intersect_domain(isl_schedule_copy(Schedule),
+                                                   getDomains().release()));
 }
 
 void Scop::setSchedule(__isl_take isl_union_map *NewSchedule) {
index e515ac4..fd2581f 100644 (file)
@@ -412,7 +412,7 @@ void IslAst::init(const Dependences &D) {
   // We can not perform the dependence analysis and, consequently,
   // the parallel code generation in case the schedule tree contains
   // extension nodes.
-  auto *ScheduleTree = S.getScheduleTree();
+  auto *ScheduleTree = S.getScheduleTree().release();
   PerformParallelTest =
       PerformParallelTest && !S.containsExtensionNode(ScheduleTree);
   isl_schedule_free(ScheduleTree);
@@ -453,7 +453,7 @@ void IslAst::init(const Dependences &D) {
 
   RunCondition = buildRunCondition(S, Build);
 
-  Root = isl_ast_build_node_from_schedule(Build, S.getScheduleTree());
+  Root = isl_ast_build_node_from_schedule(Build, S.getScheduleTree().release());
 
   isl_ast_build_free(Build);
 }
@@ -654,7 +654,7 @@ void IslAstInfo::print(raw_ostream &OS) {
   P = isl_ast_node_print(RootNode, P, Options);
   AstStr = isl_printer_get_str(P);
 
-  auto *Schedule = S.getScheduleTree();
+  auto *Schedule = S.getScheduleTree().release();
 
   DEBUG({
     dbgs() << S.getContextStr() << "\n";
index a35d033..849caf4 100644 (file)
@@ -1010,7 +1010,7 @@ bool IslNodeBuilder::materializeValue(isl_id *Id) {
           } else if (S.getStmtFor(Inst)) {
             IsDead = false;
           } else {
-            auto *Domain = S.getDomainConditions(Inst->getParent());
+            auto *Domain = S.getDomainConditions(Inst->getParent()).release();
             IsDead = isl_set_is_empty(Domain);
             isl_set_free(Domain);
           }
index 3da159e..637106a 100644 (file)
@@ -2653,7 +2653,7 @@ public:
     PPCGScop->dep_order = nullptr;
     PPCGScop->tagged_dep_order = nullptr;
 
-    PPCGScop->schedule = S->getScheduleTree();
+    PPCGScop->schedule = S->getScheduleTree().release();
     // If we have something non-trivial to kill, add it to the schedule
     if (KillsInfo.KillsSchedule.get())
       PPCGScop->schedule = isl_schedule_sequence(
index 30939f9..c8811e6 100644 (file)
@@ -134,7 +134,7 @@ __isl_give PWACtx SCEVAffinator::getPwAff(const SCEV *Expr, BasicBlock *BB) {
   this->BB = BB;
 
   if (BB) {
-    auto *DC = S->getDomainConditions(BB);
+    auto *DC = S->getDomainConditions(BB).release();
     NumIterators = isl_set_n_dim(DC);
     isl_set_free(DC);
   } else
index a23a606..8ca7e0a 100644 (file)
@@ -94,7 +94,7 @@ char DeadCodeElim::ID = 0;
 // this means may-writes are in the current situation always live, there is
 // no point in trying to remove them from the live-out set.
 isl::union_set DeadCodeElim::getLiveOut(Scop &S) {
-  isl::union_map Schedule = isl::manage(S.getSchedule());
+  isl::union_map Schedule = S.getSchedule();
   isl::union_map MustWrites = S.getMustWrites();
   isl::union_map WriteIterations = MustWrites.reverse();
   isl::union_map WriteTimes = WriteIterations.apply_range(Schedule);
index bae0226..daea1d5 100644 (file)
@@ -60,7 +60,7 @@ public:
     IslCtx = S.getSharedIslCtx();
 
     DEBUG(dbgs() << "Going to flatten old schedule:\n");
-    OldSchedule = give(S.getSchedule());
+    OldSchedule = S.getSchedule();
     DEBUG(printSchedule(dbgs(), OldSchedule, 2));
 
     auto Domains = S.getDomains();
@@ -87,7 +87,7 @@ public:
     OS << "}\n\n";
 
     OS << "Schedule after flattening {\n";
-    printSchedule(OS, give(S.getSchedule()), 4);
+    printSchedule(OS, S.getSchedule(), 4);
     OS << "}\n";
   }
 
index fd3e92d..26b2234 100644 (file)
@@ -1294,7 +1294,7 @@ bool ScheduleTreeOptimizer::isProfitableSchedule(Scop &S,
   if (S.containsExtensionNode(NewSchedule.get()))
     return true;
   auto NewScheduleMap = NewSchedule.get_map();
-  auto OldSchedule = isl::manage(S.getSchedule());
+  auto OldSchedule = S.getSchedule();
   assert(OldSchedule && "Only IslScheduleOptimizer can insert extension nodes "
                         "that make Scop::getSchedule() return nullptr.");
   bool changed = !OldSchedule.is_equal(NewScheduleMap);
index 2dbe504..63ac92f 100644 (file)
@@ -251,7 +251,7 @@ static std::string printInstruction(Instruction *Instr,
 
 ZoneAlgorithm::ZoneAlgorithm(const char *PassName, Scop *S, LoopInfo *LI)
     : PassName(PassName), IslCtx(S->getSharedIslCtx()), S(S), LI(LI),
-      Schedule(give(S->getSchedule())) {
+      Schedule(S->getSchedule()) {
   auto Domains = S->getDomains();
 
   Schedule =