r258307 - [OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 28 20:57:58 PST 2016


I will merge this fix

Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team

28.01.2016 22:18, Hans Wennborg пишет:
> Alexey: you're the owner of openmp in Clang.
>
> Can you comment on what should be merged here?
>
> On Tue, Jan 26, 2016 at 3:43 PM, Jack Howarth
> <howarth.mailing.lists at gmail.com> wrote:
>> Tested the attached patch which contains a back port of the net
>> changes from both r258307 and
>>
>> Author: abataev
>> Date: Fri Jan 22 02:56:50 2016
>> New Revision: 258495
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=258495&view=rev
>> Log:
>> [OPENMP] Generalize codegen for 'sections'-based directive.
>> If 'sections' directive has only one sub-section, the code for
>> 'single'-based directive was emitted. Removed this codegen, because it
>> causes crashes in different cases.
>>
>> Modified:
>>      cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>>      cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>>      cfe/trunk/test/OpenMP/cancel_codegen.cpp
>>      cfe/trunk/test/OpenMP/cancellation_point_codegen.cpp
>>      cfe/trunk/test/OpenMP/parallel_sections_codegen.cpp
>>      cfe/trunk/test/OpenMP/sections_codegen.cpp
>>      cfe/trunk/test/OpenMP/sections_firstprivate_codegen.cpp
>>      cfe/trunk/test/OpenMP/sections_lastprivate_codegen.cpp
>>      cfe/trunk/test/OpenMP/sections_private_codegen.cpp
>>      cfe/trunk/test/OpenMP/sections_reduction_codegen.cpp
>>
>> on x86_64-apple-darwin15 without regressions in the cfe or libomp test suites.
>>               Jack
>> ps Also verified that no regressions occur in the OpenMP3.1_Validation
>> test suite.
>>
>> On Tue, Jan 26, 2016 at 2:23 PM, Hans Wennborg <hans at chromium.org> wrote:
>>> Did that fix land, and should it be merged to 3.8?
>>>
>>> On Thu, Jan 21, 2016 at 7:03 PM, Alexey Bataev <a.bataev at hotmail.com> wrote:
>>>> Later today I will post another fix, that will fix all 'sections'
>>>> related troubles, including this one. So I don't think it is necessary
>>>> to merge it
>>>>
>>>> Best regards,
>>>> Alexey Bataev
>>>> =============
>>>> Software Engineer
>>>> Intel Compiler Team
>>>>
>>>> 22.01.2016 0:10, Hans Wennborg пишет:
>>>>> Jack suggested (https://llvm.org/bugs/show_bug.cgi?id=26059#c7) that
>>>>> this should be merged to 3.8.
>>>>>
>>>>> Alexey, you're the code owner here. OK for merging? If yes, do you
>>>>> want to go ahead and merge with utils/release/merge.sh?
>>>>>
>>>>> On Wed, Jan 20, 2016 at 4:29 AM, Alexey Bataev via cfe-commits
>>>>> <cfe-commits at lists.llvm.org> wrote:
>>>>>> Author: abataev
>>>>>> Date: Wed Jan 20 06:29:47 2016
>>>>>> New Revision: 258307
>>>>>>
>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=258307&view=rev
>>>>>> Log:
>>>>>> [OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.
>>>>>> Allow to emit code for 'cancel' directive within 'sections' directive with single sub-section.
>>>>>>
>>>>>> Modified:
>>>>>>       cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>>>>>>       cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>>>>>>       cfe/trunk/test/OpenMP/cancel_codegen.cpp
>>>>>>
>>>>>> Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=258307&r1=258306&r2=258307&view=diff
>>>>>> ==============================================================================
>>>>>> --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
>>>>>> +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Jan 20 06:29:47 2016
>>>>>> @@ -3685,8 +3685,6 @@ void CGOpenMPRuntime::emitCancelCall(Cod
>>>>>>      // kmp_int32 cncl_kind);
>>>>>>      if (auto *OMPRegionInfo =
>>>>>>              dyn_cast_or_null<CGOpenMPRegionInfo>(CGF.CapturedStmtInfo)) {
>>>>>> -    if (OMPRegionInfo->getDirectiveKind() == OMPD_single)
>>>>>> -      return;
>>>>>>        auto &&ThenGen = [this, Loc, CancelRegion,
>>>>>>                          OMPRegionInfo](CodeGenFunction &CGF) {
>>>>>>          llvm::Value *Args[] = {
>>>>>>
>>>>>> Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=258307&r1=258306&r2=258307&view=diff
>>>>>> ==============================================================================
>>>>>> --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
>>>>>> +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Wed Jan 20 06:29:47 2016
>>>>>> @@ -1786,7 +1786,11 @@ CodeGenFunction::EmitSections(const OMPE
>>>>>>        CGF.EmitOMPPrivateClause(S, SingleScope);
>>>>>>        (void)SingleScope.Privatize();
>>>>>>
>>>>>> +    auto Exit = CGF.getJumpDestInCurrentScope("omp.sections.exit");
>>>>>> +    CGF.BreakContinueStack.push_back(BreakContinue(Exit, Exit));
>>>>>>        CGF.EmitStmt(Stmt);
>>>>>> +    CGF.EmitBlock(Exit.getBlock());
>>>>>> +    CGF.BreakContinueStack.pop_back();
>>>>>>      };
>>>>>>      CGM.getOpenMPRuntime().emitSingleRegion(*this, CodeGen, S.getLocStart(),
>>>>>>                                              llvm::None, llvm::None, llvm::None,
>>>>>> @@ -2647,7 +2651,8 @@ CodeGenFunction::getOMPCancelDestination
>>>>>>      if (Kind == OMPD_parallel || Kind == OMPD_task)
>>>>>>        return ReturnBlock;
>>>>>>      assert(Kind == OMPD_for || Kind == OMPD_section || Kind == OMPD_sections ||
>>>>>> -         Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for);
>>>>>> +         Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for ||
>>>>>> +         Kind == OMPD_single);
>>>>>>      return BreakContinueStack.back().BreakBlock;
>>>>>>    }
>>>>>>
>>>>>>
>>>>>> Modified: cfe/trunk/test/OpenMP/cancel_codegen.cpp
>>>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/cancel_codegen.cpp?rev=258307&r1=258306&r2=258307&view=diff
>>>>>> ==============================================================================
>>>>>> --- cfe/trunk/test/OpenMP/cancel_codegen.cpp (original)
>>>>>> +++ cfe/trunk/test/OpenMP/cancel_codegen.cpp Wed Jan 20 06:29:47 2016
>>>>>> @@ -20,7 +20,7 @@ int main (int argc, char **argv) {
>>>>>>    #pragma omp cancel sections
>>>>>>    }
>>>>>>    // CHECK: call i32 @__kmpc_single(
>>>>>> -// CHECK-NOT: @__kmpc_cancel
>>>>>> +// CHECK: call i32 @__kmpc_cancel(
>>>>>>    // CHECK: call void @__kmpc_end_single(
>>>>>>    // CHECK: call void @__kmpc_barrier(%ident_t*
>>>>>>    #pragma omp sections
>>>>>> @@ -126,7 +126,7 @@ for (int i = 0; i < argc; ++i) {
>>>>>>
>>>>>>    // CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
>>>>>>    // CHECK: call i32 @__kmpc_single(
>>>>>> -// CHECK-NOT: @__kmpc_cancel
>>>>>> +// CHECK: call i32 @__kmpc_cancel(
>>>>>>    // CHECK: call void @__kmpc_end_single(
>>>>>>    // CHECK: ret void
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> cfe-commits mailing list
>>>>>> cfe-commits at lists.llvm.org
>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list