[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
GitOrigin-RevId: 1ab2753d4c2fcb4221a9171b11d513cb759842ac
diff --git a/include/polly/CodeGen/IslAst.h b/include/polly/CodeGen/IslAst.h
index f73e647..9bc981e 100644
--- a/include/polly/CodeGen/IslAst.h
+++ b/include/polly/CodeGen/IslAst.h
@@ -148,7 +148,7 @@
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/lib/CodeGen/IslAst.cpp b/lib/CodeGen/IslAst.cpp
index c70c839..1b079a3 100644
--- a/lib/CodeGen/IslAst.cpp
+++ b/lib/CodeGen/IslAst.cpp
@@ -181,7 +181,7 @@
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 @@
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::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/lib/CodeGen/IslNodeBuilder.cpp b/lib/CodeGen/IslNodeBuilder.cpp
index 688618e..ba13969 100644
--- a/lib/CodeGen/IslNodeBuilder.cpp
+++ b/lib/CodeGen/IslNodeBuilder.cpp
@@ -762,7 +762,7 @@
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)) {