[PATCH] D102128: [polly] In IslNodeBuilder::createIf() use isl::noexception bindings [NFC]

Saheed Bolarinwa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 9 03:48:44 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/D102128

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
@@ -798,8 +798,8 @@
   createForSequential(isl::manage(For), Parallel);
 }
 
-void IslNodeBuilder::createIf(__isl_take isl_ast_node *If) {
-  isl_ast_expr *Cond = isl_ast_node_if_get_cond(If);
+void IslNodeBuilder::createIf(isl::ast_node If) {
+  isl_ast_expr *Cond = isl_ast_node_if_get_cond(If.get());
 
   Function *F = Builder.GetInsertBlock()->getParent();
   LLVMContext &Context = F->getContext();
@@ -833,17 +833,15 @@
   Builder.CreateBr(MergeBB);
   Builder.SetInsertPoint(&ThenBB->front());
 
-  create(isl_ast_node_if_get_then(If));
+  create(isl_ast_node_if_get_then(If.get()));
 
   Builder.SetInsertPoint(&ElseBB->front());
 
-  if (isl_ast_node_if_has_else(If))
-    create(isl_ast_node_if_get_else(If));
+  if (isl_ast_node_if_has_else(If.get()))
+    create(isl_ast_node_if_get_else(If.get()));
 
   Builder.SetInsertPoint(&MergeBB->front());
 
-  isl_ast_node_free(If);
-
   IfConditions++;
 }
 
@@ -1037,7 +1035,7 @@
     createFor(Node);
     return;
   case isl_ast_node_if:
-    createIf(Node);
+    createIf(isl::manage(Node));
     return;
   case isl_ast_node_user:
     createUser(Node);
Index: polly/include/polly/CodeGen/IslNodeBuilder.h
===================================================================
--- polly/include/polly/CodeGen/IslNodeBuilder.h
+++ polly/include/polly/CodeGen/IslNodeBuilder.h
@@ -380,7 +380,7 @@
                                  std::vector<LoopToScevMapT> &VLTS,
                                  std::vector<Value *> &IVS,
                                  __isl_take isl_id *IteratorID);
-  virtual void createIf(__isl_take isl_ast_node *If);
+  virtual void createIf(isl::ast_node If);
   void createUserVector(__isl_take isl_ast_node *User,
                         std::vector<Value *> &IVS,
                         __isl_take isl_id *IteratorID,


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


More information about the llvm-commits mailing list