[PATCH] D102129: [polly] In IslNodeBuilder::addParameters() use isl::noexception bindings [NFC]

Saheed Bolarinwa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 9 03:51:26 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.

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/D102129

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


Index: polly/lib/CodeGen/IslNodeBuilder.cpp
===================================================================
--- polly/lib/CodeGen/IslNodeBuilder.cpp
+++ polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -1538,7 +1538,7 @@
   return true;
 }
 
-void IslNodeBuilder::addParameters(__isl_take isl_set *Context) {
+void IslNodeBuilder::addParameters(isl::set Context) {
   // Materialize values for the parameters of the SCoP.
   materializeParameters();
 
@@ -1563,8 +1563,6 @@
     materializeNonScopLoopInductionVariable(L);
     L = L->getParentLoop();
   }
-
-  isl_set_free(Context);
 }
 
 Value *IslNodeBuilder::generateSCEV(const SCEV *Expr) {
Index: polly/lib/CodeGen/CodeGeneration.cpp
===================================================================
--- polly/lib/CodeGen/CodeGeneration.cpp
+++ polly/lib/CodeGen/CodeGeneration.cpp
@@ -267,7 +267,7 @@
     DT.changeImmediateDominator(MergeBlock, ExitingBB);
     DT.eraseNode(ExitingBlock);
   } else {
-    NodeBuilder.addParameters(S.getContext().release());
+    NodeBuilder.addParameters(isl::manage(S.getContext().release()));
     Value *RTC = NodeBuilder.createRTC(AI.getRunCondition().release());
 
     Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);
Index: polly/include/polly/CodeGen/IslNodeBuilder.h
===================================================================
--- polly/include/polly/CodeGen/IslNodeBuilder.h
+++ polly/include/polly/CodeGen/IslNodeBuilder.h
@@ -76,7 +76,7 @@
 
   virtual ~IslNodeBuilder() = default;
 
-  void addParameters(__isl_take isl_set *Context);
+  void addParameters(isl::set Context);
 
   /// Create Values which hold the sizes of the outermost dimension of all
   /// Fortran arrays in the current scop.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102129.343905.patch
Type: text/x-patch
Size: 1724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210509/6e807e00/attachment.bin>


More information about the llvm-commits mailing list