Change the semantics of is*Parallel
authorJohannes Doerfert <jdoerfert@codeaurora.org>
Fri, 1 Aug 2014 08:14:28 +0000 (08:14 +0000)
committerJohannes Doerfert <jdoerfert@codeaurora.org>
Fri, 1 Aug 2014 08:14:28 +0000 (08:14 +0000)
  The functions isParallel, isInnermostParallel and IsOutermostParallel in
  IslAstInfo will now return true even in the presence of broken reductions.
  To compensate for this change the negated result of isReductionParallel can
  be used.

llvm-svn: 214488

polly/lib/CodeGen/IslAst.cpp
polly/lib/CodeGen/IslCodeGeneration.cpp

index bd65aca..b9da447 100644 (file)
@@ -112,13 +112,15 @@ static isl_printer *printLine(__isl_take isl_printer *Printer,
 static isl_printer *cbPrintFor(__isl_take isl_printer *Printer,
                                __isl_take isl_ast_print_options *Options,
                                __isl_keep isl_ast_node *Node, void *) {
-  if (IslAstInfo::isInnermostParallel(Node))
+  if (IslAstInfo::isInnermostParallel(Node) &&
+      !IslAstInfo::isReductionParallel(Node))
     Printer = printLine(Printer, "#pragma simd");
 
   if (IslAstInfo::isInnermost(Node) && IslAstInfo::isReductionParallel(Node))
     Printer = printLine(Printer, "#pragma simd reduction");
 
-  if (IslAstInfo::isOutermostParallel(Node))
+  if (IslAstInfo::isOutermostParallel(Node) &&
+      !IslAstInfo::isReductionParallel(Node))
     Printer = printLine(Printer, "#pragma omp parallel for");
 
   if (!IslAstInfo::isInnermost(Node) && IslAstInfo::isReductionParallel(Node))
@@ -344,22 +346,18 @@ bool IslAstInfo::isInnermost(__isl_keep isl_ast_node *Node) {
 }
 
 bool IslAstInfo::isParallel(__isl_keep isl_ast_node *Node) {
-  IslAstUserPayload *Payload = getNodePayload(Node);
-  return Payload &&
-         (Payload->IsInnermostParallel || Payload->IsOutermostParallel) &&
-         !Payload->IsReductionParallel;
+  return IslAstInfo::isInnermostParallel(Node) ||
+         IslAstInfo::isOutermostParallel(Node);
 }
 
 bool IslAstInfo::isInnermostParallel(__isl_keep isl_ast_node *Node) {
   IslAstUserPayload *Payload = getNodePayload(Node);
-  return Payload && Payload->IsInnermostParallel &&
-         !Payload->IsReductionParallel;
+  return Payload && Payload->IsInnermostParallel;
 }
 
 bool IslAstInfo::isOutermostParallel(__isl_keep isl_ast_node *Node) {
   IslAstUserPayload *Payload = getNodePayload(Node);
-  return Payload && Payload->IsOutermostParallel &&
-         !Payload->IsReductionParallel;
+  return Payload && Payload->IsOutermostParallel;
 }
 
 bool IslAstInfo::isReductionParallel(__isl_keep isl_ast_node *Node) {
index 641b787..90b7321 100644 (file)
@@ -314,7 +314,8 @@ void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For) {
   CmpInst::Predicate Predicate;
   bool Parallel;
 
-  Parallel = IslAstInfo::isInnermostParallel(For);
+  Parallel = IslAstInfo::isInnermostParallel(For) &&
+             !IslAstInfo::isReductionParallel(For);
 
   Body = isl_ast_node_for_get_body(For);
 
@@ -366,7 +367,8 @@ void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For) {
 void IslNodeBuilder::createFor(__isl_take isl_ast_node *For) {
   bool Vector = PollyVectorizerChoice != VECTORIZER_NONE;
 
-  if (Vector && IslAstInfo::isInnermostParallel(For)) {
+  if (Vector && IslAstInfo::isInnermostParallel(For) &&
+      !IslAstInfo::isReductionParallel(For)) {
     int VectorWidth = getNumberOfIterations(For);
     if (1 < VectorWidth && VectorWidth <= 16) {
       createForVector(For, VectorWidth);