From ed67f8baf6847712aab6437050341e00975e1221 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Fri, 1 Aug 2014 08:14:28 +0000 Subject: [PATCH] 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. llvm-svn: 214488 --- polly/lib/CodeGen/IslAst.cpp | 18 ++++++++---------- polly/lib/CodeGen/IslCodeGeneration.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp index bd65aca..b9da447 100644 --- a/polly/lib/CodeGen/IslAst.cpp +++ b/polly/lib/CodeGen/IslAst.cpp @@ -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) { diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index 641b787..90b7321 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -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); -- 2.7.4