[PATCH] D17241: [Refactor] Move isl_ctx into Scop.

Hongbin Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 13 07:43:26 PST 2016


etherzhhb updated this revision to Diff 47911.
etherzhhb added a comment.
Herald added a subscriber: sanjoy.

Update diff


Repository:
  rL LLVM

http://reviews.llvm.org/D17241

Files:
  include/polly/ScopInfo.h
  lib/Analysis/ScopInfo.cpp

Index: lib/Analysis/ScopInfo.cpp
===================================================================
--- lib/Analysis/ScopInfo.cpp
+++ lib/Analysis/ScopInfo.cpp
@@ -112,7 +112,6 @@
     cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::cat(PollyCategory));
 
 //===----------------------------------------------------------------------===//
-
 // Create a sequence of two schedules. Either argument may be null and is
 // interpreted as the empty schedule. Can also return null if both schedules are
 // empty.
@@ -2731,13 +2730,13 @@
   return MaxLD - MinLD + 1;
 }
 
-Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, isl_ctx *Context,
-           unsigned MaxLoopDepth)
+Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, unsigned MaxLoopDepth)
     : SE(&ScalarEvolution), R(R), IsOptimized(false),
       HasSingleExitEdge(R.getExitingBlock()), HasErrorBlock(false),
-      MaxLoopDepth(MaxLoopDepth), IslCtx(Context), Context(nullptr),
+      MaxLoopDepth(MaxLoopDepth), IslCtx(isl_ctx_alloc()), Context(nullptr),
       Affinator(this), AssumedContext(nullptr), BoundaryContext(nullptr),
       Schedule(nullptr) {
+  isl_options_set_on_error(IslCtx, ISL_ON_ERROR_ABORT);
   buildContext();
 }
 
@@ -2798,6 +2797,8 @@
 
   for (const auto &IAClass : InvariantEquivClasses)
     isl_set_free(std::get<2>(IAClass));
+
+  isl_ctx_free(IslCtx);
 }
 
 void Scop::updateAccessDimensionality() {
@@ -4126,7 +4127,7 @@
 
 void ScopInfo::buildScop(Region &R, AssumptionCache &AC) {
   unsigned MaxLoopDepth = getMaxLoopDepthInRegion(R, *LI, *SD);
-  scop.reset(new Scop(R, *SE, ctx, MaxLoopDepth));
+  scop.reset(new Scop(R, *SE, MaxLoopDepth));
 
   buildStmts(R, R);
   buildAccessFunctions(R, R);
@@ -4156,15 +4157,9 @@
 void ScopInfo::clear() { scop.reset(); }
 
 //===----------------------------------------------------------------------===//
-ScopInfo::ScopInfo() : RegionPass(ID) {
-  ctx = isl_ctx_alloc();
-  isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
-}
+ScopInfo::ScopInfo() : RegionPass(ID) {}
 
-ScopInfo::~ScopInfo() {
-  clear();
-  isl_ctx_free(ctx);
-}
+ScopInfo::~ScopInfo() { clear(); }
 
 void ScopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<LoopInfoWrapperPass>();
Index: include/polly/ScopInfo.h
===================================================================
--- include/polly/ScopInfo.h
+++ include/polly/ScopInfo.h
@@ -1371,7 +1371,7 @@
   InvariantEquivClassesTy InvariantEquivClasses;
 
   /// @brief Scop constructor; invoked from ScopInfo::buildScop.
-  Scop(Region &R, ScalarEvolution &SE, isl_ctx *ctx, unsigned MaxLoopDepth);
+  Scop(Region &R, ScalarEvolution &SE, unsigned MaxLoopDepth);
 
   /// @brief Get or create the access function set in a BasicBlock
   AccFuncSetType &getOrCreateAccessFunctions(const BasicBlock *BB) {
@@ -2010,7 +2010,6 @@
 
   // The Scop
   std::unique_ptr<Scop> scop;
-  isl_ctx *ctx;
 
   // Clear the context.
   void clear();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17241.47911.patch
Type: text/x-patch
Size: 2938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160213/efb2e918/attachment.bin>


More information about the llvm-commits mailing list