[llvm-commits] [polly] r151893 - /polly/trunk/lib/CodeGeneration.cpp

Tobias Grosser grosser at fim.uni-passau.de
Fri Mar 2 03:26:43 PST 2012


Author: grosser
Date: Fri Mar  2 05:26:42 2012
New Revision: 151893

URL: http://llvm.org/viewvc/llvm-project?rev=151893&view=rev
Log:
CodeGen: Only check once if a loop is parallel

Suggested by: Sebastian Pop  <sebpop at gmail.com>

Modified:
    polly/trunk/lib/CodeGeneration.cpp

Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=151893&r1=151892&r2=151893&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Fri Mar  2 05:26:42 2012
@@ -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) {





More information about the llvm-commits mailing list