CodeGen: Only check once if a loop is parallel
Suggested by: Sebastian Pop <sebpop@gmail.com>
llvm-svn: 151893
diff --git a/polly/lib/CodeGeneration.cpp b/polly/lib/CodeGeneration.cpp
index c9bea7f..ab6ab83 100644
--- a/polly/lib/CodeGeneration.cpp
+++ b/polly/lib/CodeGeneration.cpp
@@ -1408,17 +1408,23 @@
}
void ClastStmtCodeGen::codegen(const clast_for *f) {
- if (Vector && isInnermostLoop(f) && DP->isParallelFor(f)
- && (-1 != getNumberOfIterations(f))
- && (getNumberOfIterations(f) <= 16)) {
- codegenForVector(f);
- } else if (OpenMP && !parallelCodeGeneration && DP->isParallelFor(f)) {
- parallelCodeGeneration = true;
- parallelLoops.push_back(f->iterator);
- codegenForOpenMP(f);
- parallelCodeGeneration = false;
- } else
- codegenForSequential(f);
+ if ((Vector || OpenMP) && DP->isParallelFor(f)) {
+ if (Vector && isInnermostLoop(f) && (-1 != getNumberOfIterations(f))
+ && (getNumberOfIterations(f) <= 16)) {
+ codegenForVector(f);
+ return;
+ }
+
+ if (OpenMP && !parallelCodeGeneration) {
+ parallelCodeGeneration = true;
+ parallelLoops.push_back(f->iterator);
+ codegenForOpenMP(f);
+ parallelCodeGeneration = false;
+ return;
+ }
+ }
+
+ codegenForSequential(f);
}
Value *ClastStmtCodeGen::codegen(const clast_equation *eq) {