diff options
-rwxr-xr-x | polly/include/polly/Dependences.h | 11 | ||||
-rw-r--r-- | polly/lib/Analysis/Dependences.cpp | 12 | ||||
-rw-r--r-- | polly/lib/CodeGeneration.cpp | 23 |
3 files changed, 23 insertions, 23 deletions
diff --git a/polly/include/polly/Dependences.h b/polly/include/polly/Dependences.h index 66cdf96224c..212dccbb815 100755 --- a/polly/include/polly/Dependences.h +++ b/polly/include/polly/Dependences.h @@ -31,6 +31,7 @@ struct isl_union_map; struct isl_union_set; struct isl_map; struct isl_set; +struct clast_for; using namespace llvm; @@ -69,6 +70,16 @@ namespace polly { /// valid for the scattering domain subset given. bool isParallelDimension(isl_set *loopDomain, unsigned parallelDimension); + /// @brief Check if a loop is parallel + /// + /// Detect if a clast_for loop can be executed in parallel. + /// + /// @param f The clast for loop to check. + /// + /// @return bool Returns true if the incoming clast_for statement can + /// execute in parallel. + bool isParallelFor(const clast_for *f); + bool runOnScop(Scop &S); void printScop(raw_ostream &OS) const; virtual void releaseMemory(); diff --git a/polly/lib/Analysis/Dependences.cpp b/polly/lib/Analysis/Dependences.cpp index 8b3600226a2..b63d3b280d8 100644 --- a/polly/lib/Analysis/Dependences.cpp +++ b/polly/lib/Analysis/Dependences.cpp @@ -31,8 +31,9 @@ #include "llvm/Support/CommandLine.h" #include <isl/flow.h> -#include <isl/map.h> -#include <isl/constraint.h> +#define CLOOG_INT_GMP 1 +#include <cloog/cloog.h> +#include <cloog/isl/cloog.h> using namespace polly; using namespace llvm; @@ -351,6 +352,13 @@ bool Dependences::isParallelDimension(isl_set *loopDomain, && isl_union_set_is_empty(nonValid_waw); } +bool Dependences::isParallelFor(const clast_for *f) { + isl_set *loopDomain = isl_set_from_cloog_domain(f->domain); + assert(loopDomain && "Cannot access domain of loop"); + + return isParallelDimension(loopDomain, isl_set_n_dim(loopDomain)); +} + void Dependences::printScop(raw_ostream &OS) const { OS.indent(4) << "Must dependences:\n"; OS.indent(8) << stringFromIslObj(must_dep) << "\n"; diff --git a/polly/lib/CodeGeneration.cpp b/polly/lib/CodeGeneration.cpp index c4e524fb4b9..24ee350de50 100644 --- a/polly/lib/CodeGeneration.cpp +++ b/polly/lib/CodeGeneration.cpp @@ -826,25 +826,6 @@ public: Builder.SetInsertPoint(AfterBB); } - /// @brief Check if a loop is parallel - /// - /// Detect if a clast_for loop can be executed in parallel. - /// - /// @param f The clast for loop to check. - bool isParallelFor(const clast_for *f) { - isl_set *loopDomain = isl_set_from_cloog_domain(f->domain); - assert(loopDomain && "Cannot access domain of loop"); - - bool isParallel = DP->isParallelDimension(loopDomain, - isl_set_n_dim(loopDomain)); - - if (isParallel) - DEBUG(dbgs() << "Parallel loop with induction variable '" << f->iterator - << "' found\n";); - - return isParallel; - } - /// @brief Add a new definition of an openmp subfunction. Function* addOpenMPSubfunction(Module *M) { Function *F = Builder.GetInsertBlock()->getParent(); @@ -1157,11 +1138,11 @@ public: } void codegen(const clast_for *f) { - if (Vector && isInnermostLoop(f) && isParallelFor(f) + if (Vector && isInnermostLoop(f) && DP->isParallelFor(f) && (-1 != getNumberOfIterations(f)) && (getNumberOfIterations(f) <= 16)) { codegenForVector(f); - } else if (OpenMP && !parallelCodeGeneration && isParallelFor(f)) { + } else if (OpenMP && !parallelCodeGeneration && DP->isParallelFor(f)) { parallelCodeGeneration = true; parallelLoops.push_back(f->iterator); codegenForOpenMP(f); |