[polly] r214488 - Change the semantics of is*Parallel

Johannes Doerfert jdoerfert at codeaurora.org
Fri Aug 1 01:14:28 PDT 2014


Author: jdoerfert
Date: Fri Aug  1 03:14:28 2014
New Revision: 214488

URL: http://llvm.org/viewvc/llvm-project?rev=214488&view=rev
Log:
Change the semantics of is*Parallel

  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.

Modified:
    polly/trunk/lib/CodeGen/IslAst.cpp
    polly/trunk/lib/CodeGen/IslCodeGeneration.cpp

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=214488&r1=214487&r2=214488&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Fri Aug  1 03:14:28 2014
@@ -112,13 +112,15 @@ static isl_printer *printLine(__isl_take
 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
 }
 
 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) {

Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneration.cpp?rev=214488&r1=214487&r2=214488&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Fri Aug  1 03:14:28 2014
@@ -314,7 +314,8 @@ void IslNodeBuilder::createForSequential
   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
 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);





More information about the llvm-commits mailing list