[polly] 50e3449 - [Polly] Refabricating IsOutermostParallel() from Integer Set Libarary(ISL) to take the C++ wrapper

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 2 23:49:45 PST 2021


Author: Prateek Pardeshi
Date: 2021-03-03T01:49:37-06:00
New Revision: 50e34497ac8d2a74ef644519df033e16876d0c25

URL: https://github.com/llvm/llvm-project/commit/50e34497ac8d2a74ef644519df033e16876d0c25
DIFF: https://github.com/llvm/llvm-project/commit/50e34497ac8d2a74ef644519df033e16876d0c25.diff

LOG: [Polly] Refabricating IsOutermostParallel() from Integer Set Libarary(ISL) to take the C++ wrapper

Polly use algorithms from the Integer Set Library (isl), which is a library written in C and which is incompatible with the rest of the LLVM  as it is written in C++.

Changes made:
* Refabricating IsOutermostParallel() to take C++ bindings instead of reference-counting in C isl lib.
* Addition of manage_copy() to be used as reference for C objects instead of IsOutermostParallel()

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D97751

Added: 
    

Modified: 
    polly/include/polly/CodeGen/IslAst.h
    polly/lib/CodeGen/IslAst.cpp

Removed: 
    


################################################################################
diff  --git a/polly/include/polly/CodeGen/IslAst.h b/polly/include/polly/CodeGen/IslAst.h
index 9bc981edae5f..c6f8778da96c 100644
--- a/polly/include/polly/CodeGen/IslAst.h
+++ b/polly/include/polly/CodeGen/IslAst.h
@@ -145,7 +145,7 @@ class IslAstInfo {
   static bool isParallel(__isl_keep isl_ast_node *Node);
 
   /// Is this loop an outermost parallel loop?
-  static bool isOutermostParallel(__isl_keep isl_ast_node *Node);
+  static bool isOutermostParallel(const isl::ast_node &Node);
 
   /// Is this loop an innermost parallel loop?
   static bool isInnermostParallel(const isl::ast_node &Node);

diff  --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp
index 1b079a35fd40..fe8818222efc 100644
--- a/polly/lib/CodeGen/IslAst.cpp
+++ b/polly/lib/CodeGen/IslAst.cpp
@@ -186,7 +186,7 @@ static isl_printer *cbPrintFor(__isl_take isl_printer *Printer,
 
   if (IslAstInfo::isExecutedInParallel(Node))
     Printer = printLine(Printer, OmpPragmaStr);
-  else if (IslAstInfo::isOutermostParallel(Node))
+  else if (IslAstInfo::isOutermostParallel(isl::manage_copy(Node)))
     Printer = printLine(Printer, KnownParallelStr + BrokenReductionsStr);
 
   isl_pw_aff_free(DD);
@@ -483,7 +483,7 @@ static void walkAstForStatistics(__isl_keep isl_ast_node *Ast) {
             NumParallel++;
           if (IslAstInfo::isInnermostParallel(isl::manage_copy(Node)))
             NumInnermostParallel++;
-          if (IslAstInfo::isOutermostParallel(Node))
+          if (IslAstInfo::isOutermostParallel(isl::manage_copy(Node)))
             NumOutermostParallel++;
           if (IslAstInfo::isReductionParallel(Node))
             NumReductionParallel++;
@@ -602,7 +602,7 @@ bool IslAstInfo::isInnermost(__isl_keep isl_ast_node *Node) {
 
 bool IslAstInfo::isParallel(__isl_keep isl_ast_node *Node) {
   return IslAstInfo::isInnermostParallel(isl::manage_copy(Node)) ||
-         IslAstInfo::isOutermostParallel(Node);
+         IslAstInfo::isOutermostParallel(isl::manage_copy(Node));
 }
 
 bool IslAstInfo::isInnermostParallel(const isl::ast_node &Node) {
@@ -610,8 +610,8 @@ bool IslAstInfo::isInnermostParallel(const isl::ast_node &Node) {
   return Payload && Payload->IsInnermostParallel;
 }
 
-bool IslAstInfo::isOutermostParallel(__isl_keep isl_ast_node *Node) {
-  IslAstUserPayload *Payload = getNodePayload(isl::manage_copy(Node));
+bool IslAstInfo::isOutermostParallel(const isl::ast_node &Node) {
+  IslAstUserPayload *Payload = getNodePayload(Node);
   return Payload && Payload->IsOutermostParallel;
 }
 
@@ -636,7 +636,8 @@ bool IslAstInfo::isExecutedInParallel(__isl_keep isl_ast_node *Node) {
   if (!PollyParallelForce && isInnermost(Node))
     return false;
 
-  return isOutermostParallel(Node) && !isReductionParallel(Node);
+  return isOutermostParallel(isl::manage_copy(Node)) &&
+         !isReductionParallel(Node);
 }
 
 __isl_give isl_union_map *


        


More information about the llvm-commits mailing list