[PATCH] D102127: [polly] In IslNodeBuilder::createForParallel() use isl::noexception bindings [NFC]

Saheed Bolarinwa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 9 03:44:23 PDT 2021


refactormyself created this revision.
refactormyself added a reviewer: Meinersbur.
Herald added a reviewer: bollu.
refactormyself requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The C++ bindings in isl_noexception provide better pointer management.
This allows the use of convenient memory management tools in C++.

- Replace the isl C entities with isl_noexception bindings
- Refactor calls to this function

No functional changes were made.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102127

Files:
  polly/include/polly/CodeGen/IslNodeBuilder.h
  polly/lib/CodeGen/IslNodeBuilder.cpp


Index: polly/lib/CodeGen/IslNodeBuilder.cpp
===================================================================
--- polly/lib/CodeGen/IslNodeBuilder.cpp
+++ polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -632,7 +632,7 @@
     DT.eraseNode(BB);
 }
 
-void IslNodeBuilder::createForParallel(__isl_take isl_ast_node *For) {
+void IslNodeBuilder::createForParallel(isl::ast_node For) {
   isl_ast_node *Body;
   isl_ast_expr *Init, *Inc, *Iterator, *UB;
   isl_id *IteratorID;
@@ -649,12 +649,12 @@
   ParBB->setName("polly.parallel.for");
   Builder.SetInsertPoint(&ParBB->front());
 
-  Body = isl_ast_node_for_get_body(For);
-  Init = isl_ast_node_for_get_init(For);
-  Inc = isl_ast_node_for_get_inc(For);
-  Iterator = isl_ast_node_for_get_iterator(For);
+  Body = isl_ast_node_for_get_body(For.get());
+  Init = isl_ast_node_for_get_init(For.get());
+  Inc = isl_ast_node_for_get_inc(For.get());
+  Iterator = isl_ast_node_for_get_iterator(For.get());
   IteratorID = isl_ast_expr_get_id(Iterator);
-  UB = getUpperBound(isl::manage_copy(For), Predicate).release();
+  UB = getUpperBound(For, Predicate).release();
 
   ValueLB = ExprBuilder.create(Init);
   ValueUB = ExprBuilder.create(UB);
@@ -683,7 +683,7 @@
   SetVector<Value *> SubtreeValues;
   SetVector<const Loop *> Loops;
 
-  getReferencesInSubtree(isl::manage_copy(For), SubtreeValues, Loops);
+  getReferencesInSubtree(For, SubtreeValues, Loops);
 
   // Create for all loops we depend on values that contain the current loop
   // iteration. These values are necessary to generate code for SCEVs that
@@ -743,7 +743,6 @@
   for (const Loop *L : Loops)
     OutsideLoopIterations.erase(L);
 
-  isl_ast_node_free(For);
   isl_ast_expr_free(Iterator);
   isl_id_free(IteratorID);
 
@@ -790,7 +789,7 @@
   }
 
   if (IslAstInfo::isExecutedInParallel(isl::manage_copy(For))) {
-    createForParallel(For);
+    createForParallel(isl::manage(For));
     return;
   }
   bool Parallel = (IslAstInfo::isParallel(isl::manage_copy(For)) &&
Index: polly/include/polly/CodeGen/IslNodeBuilder.h
===================================================================
--- polly/include/polly/CodeGen/IslNodeBuilder.h
+++ polly/include/polly/CodeGen/IslNodeBuilder.h
@@ -322,7 +322,7 @@
   /// Create LLVM-IR that executes a for node thread parallel.
   ///
   /// @param For The FOR isl_ast_node for which code is generated.
-  void createForParallel(__isl_take isl_ast_node *For);
+  void createForParallel(isl::ast_node For);
 
   /// Create new access functions for modified memory accesses.
   ///


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102127.343903.patch
Type: text/x-patch
Size: 2546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210509/fb6e03eb/attachment.bin>


More information about the llvm-commits mailing list