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

Saheed Bolarinwa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 02:37:06 PDT 2021


refactormyself updated this revision to Diff 339535.

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));
+  isl::ast_build 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,8 @@
       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
@@ -641,9 +641,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);
+  isl::ast_build Build =
+      Payload ? isl::manage_copy(Payload->Build) : isl::ast_build();
+  return Build;
 }
 
 static std::unique_ptr<IslAstInfo> runIslAst(
@@ -706,7 +708,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
@@ -164,7 +164,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.339535.patch
Type: text/x-patch
Size: 2965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/16e04f96/attachment.bin>


More information about the llvm-commits mailing list