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); ///} }; 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 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/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); }