[PATCH] D100380: [Polly] In getBuild() use isl::noexception bindings

Saheed Olayemi Bolarinwa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 14 14:00:53 PDT 2021


refactormyself updated this revision to Diff 337545.
refactormyself added a reviewer: patacca.
refactormyself added a comment.

- use isl::manage() to initialize a isl::ast_build object
- use isl::ast_build() since it's equivalent to  isl::ast_build(nullptr)
- use auto


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100380/new/

https://reviews.llvm.org/D100380

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


Index: polly/lib/CodeGen/IslNodeBuilder.cpp
===================================================================
--- polly/lib/CodeGen/IslNodeBuilder.cpp
+++ polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -853,9 +853,9 @@
   isl_id_to_ast_expr *NewAccesses =
       isl_id_to_ast_expr_alloc(Stmt->getParent()->getIslCtx().get(), 0);
 
-  auto *Build = IslAstInfo::getBuild(Node);
-  assert(Build && "Could not obtain isl_ast_build from user node");
-  Stmt->setAstBuild(isl::manage_copy(Build));
+  auto Build = IslAstInfo::getBuild(isl::manage_copy(Node));
+  assert(!Build.is_null() && "Could not obtain isl_ast_build from user node");
+  Stmt->setAstBuild(Build);
 
   for (auto *MA : *Stmt) {
     if (!MA->hasNewAccessRelation()) {
@@ -876,7 +876,7 @@
     assert(MA->isAffine() &&
            "Only affine memory accesses can be code generated");
 
-    auto Schedule = isl_ast_build_get_schedule(Build);
+    auto Schedule = isl_ast_build_get_schedule(Build.get());
 
 #ifndef NDEBUG
     if (MA->isRead()) {
@@ -911,7 +911,7 @@
       continue;
     }
 
-    auto AccessExpr = isl_ast_build_access_from_pw_multi_aff(Build, PWAccRel);
+    auto AccessExpr = isl_ast_build_access_from_pw_multi_aff(Build.get(), PWAccRel);
     NewAccesses =
         isl_id_to_ast_expr_set(NewAccesses, MA->getId().release(), AccessExpr);
   }
Index: polly/lib/CodeGen/IslAst.cpp
===================================================================
--- polly/lib/CodeGen/IslAst.cpp
+++ polly/lib/CodeGen/IslAst.cpp
@@ -654,9 +654,11 @@
   return Payload ? &Payload->BrokenReductions : nullptr;
 }
 
-isl_ast_build *IslAstInfo::getBuild(__isl_keep isl_ast_node *Node) {
-  IslAstUserPayload *Payload = getNodePayload(isl::manage_copy(Node));
-  return Payload ? Payload->Build : nullptr;
+isl::ast_build IslAstInfo::getBuild(const isl::ast_node &Node) {
+  IslAstUserPayload *Payload = getNodePayload(Node);
+  auto Build = Payload ? isl::ast_build(isl::manage(Payload->Build))
+                       : isl::ast_build();
+  return Build;
 }
 
 static std::unique_ptr<IslAstInfo> runIslAst(
@@ -719,7 +721,7 @@
     else
       P = isl_printer_print_str(P, "/* write */  ");
 
-    isl::ast_build Build = isl::manage_copy(IslAstInfo::getBuild(Node));
+    isl::ast_build Build = IslAstInfo::getBuild(isl::manage_copy(Node));
     if (MemAcc->isAffine()) {
       isl_pw_multi_aff *PwmaPtr =
           MemAcc->applyScheduleToAccessRelation(Build.get_schedule()).release();
Index: polly/include/polly/CodeGen/IslAst.h
===================================================================
--- polly/include/polly/CodeGen/IslAst.h
+++ polly/include/polly/CodeGen/IslAst.h
@@ -166,7 +166,7 @@
   static MemoryAccessSet *getBrokenReductions(const isl::ast_node &Node);
 
   /// Get the nodes build context or a nullptr if not available.
-  static __isl_give isl_ast_build *getBuild(__isl_keep isl_ast_node *Node);
+  static isl::ast_build getBuild(const isl::ast_node &Node);
 
   ///}
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100380.337545.patch
Type: text/x-patch
Size: 2962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210414/ac7cfca4/attachment.bin>


More information about the llvm-commits mailing list