[PATCH] [OPENMP] Loop collapsing and initial codegen for 'omp simd' directive

hfinkel at anl.gov hfinkel at anl.gov
Fri Sep 26 11:19:06 PDT 2014


================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:67
@@ +66,3 @@
+  if (SeparateIter) {
+    // TODO: Update lastprivates if the SeparateIter flag is true.
+  }
----------------
Is there something missing for you to support this? Looks like everything is in place below.

================
Comment at: lib/Sema/SemaOpenMP.cpp:2534
@@ +2533,3 @@
+  //
+  //   #define NumIterations (NI * ((NJ - J0 - 1 + 2) / 2))
+  //   for (decltype(NumIterations) IV = 0; IV < NumIterations; ++IV ) {
----------------
The OpenMP specification says:

  The integer type (or kind, for Fortran) used to compute the iteration count for the  collapsed loop is implementation defined.

And I'm afraid that, especially if the iteration variables are originally 32-bits, with the current scheme we'll overflow when calculating the total number of iterations. Can we always use a larger integer type?

http://reviews.llvm.org/D5184






More information about the cfe-commits mailing list