[PATCH] [OPENMP] Codegen for 'reduction' clause in 'parallel' directive.

John McCall rjmccall at gmail.com
Thu Apr 9 14:35:20 PDT 2015


Looks very nice, thanks.  Only one serious question.


================
Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:1626
@@ +1625,3 @@
+  //  *(Type<n>-1*)lhs[<n>-1] = ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1],
+  //  *(Type<n>-1*)rhs[<n>-1]);
+  CodeGenFunction::OMPPrivateScope Scope(CGF);
----------------
Writing the second line actually makes this less clear.  I would just write one line in terms of "i", like
  *(Type<i>*)lhs[i] = ...

================
Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:1782
@@ +1781,3 @@
+    };
+    CGF.EHStack.pushCleanup<CallEndCleanup>(
+        NormalAndEHCleanup, [this, WithNowait, EndArgs](CodeGenFunction &CGF) {
----------------
Pushing the cleanup immediately before the scope is left like this doesn't do anything except emit it immediately on the normal path.  Did you mean to push it before doing any of the reduction operations?

http://reviews.llvm.org/D8915

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list