[PATCH] [OPENMP] Codegen for 'omp barrier' directive.

John McCall rjmccall at gmail.com
Wed Dec 3 12:12:59 PST 2014


================
Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:640
@@ -642,3 +639,3 @@
                                          OpenMPLocationFlags Flags) {
-  // Build call __kmpc_barrier(loc, thread_id)
+  // Build call __kmpc_cancel_barrier(loc, thread_id);
   llvm::Value *Args[] = {EmitOpenMPUpdateLocation(CGF, Loc, Flags),
----------------
ABataev wrote:
> rjmccall wrote:
> > Does this runtime function always exist, or is it contingent on having a sufficiently new OpenMP runtime?  If the latter, you should introduce the concept of a target OpenMP runtime version, patterned on the target Objective-C runtime version.
> > 
> > Also, please describe in a comment why we're using this function rather than the other, since apparently both "work" in some sense.
> Yes, it exists always. In OpenMP 3.1 it works just the same way as a regular kmpc_barrier() (actually, kmpc_cancel_barrier just calls it). But it adds processing of cancellation directives introduced in OpenMP 4.0.
> Ok, I'll add the comment.
Okay.  Is that desired for the existing uses of EmitOMPBarrierCall?  If everybody always wants a cancel barrier, and both runtime functions take the same arguments, why are there two runtime functions at all?

http://reviews.llvm.org/D6447






More information about the cfe-commits mailing list