[polly] 1ab2753 - [Polly] Refactoring IsInnermostParallel() in ISL to take the C++ wrapper object. NFC

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 16:41:52 PST 2021


Author: Kevin Zhou
Date: 2021-02-26T18:41:44-06:00
New Revision: 1ab2753d4c2fcb4221a9171b11d513cb759842ac

URL: https://github.com/llvm/llvm-project/commit/1ab2753d4c2fcb4221a9171b11d513cb759842ac
DIFF: https://github.com/llvm/llvm-project/commit/1ab2753d4c2fcb4221a9171b11d513cb759842ac.diff

LOG: [Polly] Refactoring IsInnermostParallel() in ISL to take the C++ wrapper object. NFC

Currently, the IslAst library is a C library that would be incompatible with the rest of the LLVM because LLVM is written in C++.
I took one function, IsInnermostParallel(), and refactored it so that it would take the C++ wrapper object instead of using reference counters with the C ISL library. As well, all the references that use IsInnermostParallel() will use manage_copy() since they are still expecting the C object.

Reviewed By: Meinersbur

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

Added: 
    

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

Removed: 
    


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

diff  --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp
index c70c839cd010..1b079a35fd40 100644
--- a/polly/lib/CodeGen/IslAst.cpp
+++ b/polly/lib/CodeGen/IslAst.cpp
@@ -181,7 +181,7 @@ static isl_printer *cbPrintFor(__isl_take isl_printer *Printer,
   if (DD)
     Printer = printLine(Printer, DepDisPragmaStr, DD);
 
-  if (IslAstInfo::isInnermostParallel(Node))
+  if (IslAstInfo::isInnermostParallel(isl::manage_copy(Node)))
     Printer = printLine(Printer, SimdPragmaStr + BrokenReductionsStr);
 
   if (IslAstInfo::isExecutedInParallel(Node))
@@ -481,7 +481,7 @@ static void walkAstForStatistics(__isl_keep isl_ast_node *Ast) {
           NumForLoops++;
           if (IslAstInfo::isParallel(Node))
             NumParallel++;
-          if (IslAstInfo::isInnermostParallel(Node))
+          if (IslAstInfo::isInnermostParallel(isl::manage_copy(Node)))
             NumInnermostParallel++;
           if (IslAstInfo::isOutermostParallel(Node))
             NumOutermostParallel++;
@@ -601,12 +601,12 @@ bool IslAstInfo::isInnermost(__isl_keep isl_ast_node *Node) {
 }
 
 bool IslAstInfo::isParallel(__isl_keep isl_ast_node *Node) {
-  return IslAstInfo::isInnermostParallel(Node) ||
+  return IslAstInfo::isInnermostParallel(isl::manage_copy(Node)) ||
          IslAstInfo::isOutermostParallel(Node);
 }
 
-bool IslAstInfo::isInnermostParallel(__isl_keep isl_ast_node *Node) {
-  IslAstUserPayload *Payload = getNodePayload(isl::manage_copy(Node));
+bool IslAstInfo::isInnermostParallel(const isl::ast_node &Node) {
+  IslAstUserPayload *Payload = getNodePayload(Node);
   return Payload && Payload->IsInnermostParallel;
 }
 

diff  --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp
index 688618e23be0..ba13969c3427 100644
--- a/polly/lib/CodeGen/IslNodeBuilder.cpp
+++ b/polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -762,7 +762,7 @@ static bool hasPartialAccesses(__isl_take isl_ast_node *Node) {
 void IslNodeBuilder::createFor(__isl_take isl_ast_node *For) {
   bool Vector = PollyVectorizerChoice == VECTORIZER_POLLY;
 
-  if (Vector && IslAstInfo::isInnermostParallel(For) &&
+  if (Vector && IslAstInfo::isInnermostParallel(isl::manage_copy(For)) &&
       !IslAstInfo::isReductionParallel(For)) {
     int VectorWidth = getNumberOfIterations(isl::manage_copy(For));
     if (1 < VectorWidth && VectorWidth <= 16 && !hasPartialAccesses(For)) {


        


More information about the llvm-commits mailing list