r295474 - [OpenMP] Fix cancellation point in task with no cancel

Hahnfeld, Jonas via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 23:32:02 PST 2017


Thanks!

Jonas

> -----Original Message-----
> From: hwennborg at google.com [mailto:hwennborg at google.com] On Behalf
> Of Hans Wennborg
> Sent: Friday, February 24, 2017 6:39 PM
> To: Hahnfeld, Jonas
> Cc: cfe-commits
> Subject: Re: r295474 - [OpenMP] Fix cancellation point in task with no 
> cancel
>
> Merged to 4.0 in r296139 as requested on the r295473 commit thread.
>
> On Fri, Feb 17, 2017 at 10:32 AM, Jonas Hahnfeld via cfe-commits <cfe-
> commits at lists.llvm.org> wrote:
> > Author: hahnfeld
> > Date: Fri Feb 17 12:32:58 2017
> > New Revision: 295474
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=295474&view=rev
> > Log:
> > [OpenMP] Fix cancellation point in task with no cancel
> >
> > With tasks, the cancel may happen in another task. This has a
> > different region info which means that we can't find it here.
> >
> > Differential Revision: https://reviews.llvm.org/D30091
> >
> > Modified:
> >     cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
> >     cfe/trunk/test/OpenMP/cancellation_point_codegen.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/CodeGen/CGOpenMPRunt
> > ime.cpp?rev=295474&r1=295473&r2=295474&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Fri Feb 17 12:32:58
> 2017
> > @@ -4716,7 +4716,9 @@ void CGOpenMPRuntime::emitCancellationPo
> >    // global_tid, kmp_int32 cncl_kind);
> >    if (auto *OMPRegionInfo =
> >            dyn_cast_or_null<CGOpenMPRegionInfo>(CGF.CapturedStmtInfo)) {
> > -    if (OMPRegionInfo->hasCancel()) {
> > +    // For 'cancellation point taskgroup', the task region info may not 
> > have a
> > +    // cancel. This may instead happen in another adjacent task.
> > +    if (CancelRegion == OMPD_taskgroup || OMPRegionInfo->hasCancel())
> > + {
> >        llvm::Value *Args[] = {
> >            emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
> >            CGF.Builder.getInt32(getCancellationKind(CancelRegion))};
> >
> > Modified: cfe/trunk/test/OpenMP/cancellation_point_codegen.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/cancellation
> > _point_codegen.cpp?rev=295474&r1=295473&r2=295474&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- cfe/trunk/test/OpenMP/cancellation_point_codegen.cpp (original)
> > +++ cfe/trunk/test/OpenMP/cancellation_point_codegen.cpp Fri Feb 17
> > +++ 12:32:58 2017
> > @@ -78,6 +78,12 @@ for (int i = 0; i < argc; ++i) {  }  // CHECK: call
> > i8* @__kmpc_omp_task_alloc(  // CHECK: call i32 @__kmpc_omp_task(
> > +#pragma omp task
> > +{
> > +#pragma omp cancellation point taskgroup } // CHECK: call i8*
> > + at __kmpc_omp_task_alloc( // CHECK: call i32 @__kmpc_omp_task(
> >  #pragma omp parallel sections
> >  {
> >    {
> > @@ -118,6 +124,15 @@ for (int i = 0; i < argc; ++i) {
> >
> >  // CHECK: define internal i32 @{{[^(]+}}(i32
> >  // CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t*
> {{[^,]+}}, i32 {{[^,]+}}, i32 4)
> > +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
> > +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]],
> > +// CHECK: [[EXIT]]
> > +// CHECK: br label %[[RETURN:.+]]
> > +// CHECK: [[RETURN]]
> > +// CHECK: ret i32 0
> > +
> > +// CHECK: define internal i32 @{{[^(]+}}(i32
> > +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t*
> {{[^,]+}}, i32 {{[^,]+}}, i32 4)
> >  // CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
> >  // CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]],
> >  // CHECK: [[EXIT]]
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170228/4bc554c4/attachment-0001.bin>


More information about the cfe-commits mailing list