r337928 - [OPENMP] Fix PR38256: Fix locations of the artificial conditional op.

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 25 10:33:41 PDT 2018


Ah, great. Thanks again!

vedant

> On Jul 25, 2018, at 10:33 AM, Alexey Bataev <a.bataev at outlook.com> wrote:
> 
> This is visible to the user, the statement under #pragma omp parallel directive is outlined as a function.
> -------------
> Best regards,
> Alexey Bataev
> 25.07.2018 13:31, Vedant Kumar пишет:
>> Thanks!
>> 
>> Just out of curiosity, what is the "omp_outlined" function you're checking for? Is it implicitly-defined? If it's not user-visible, i.e it doesn't actually appear in the source code of a program, why should we generate a code coverage mapping for it at all?
>> 
>> vedant
>> 
>>> On Jul 25, 2018, at 7:40 AM, Alexey Bataev via cfe-commits <cfe-commits at lists.llvm.org> <mailto:cfe-commits at lists.llvm.org> wrote:
>>> 
>>> Author: abataev
>>> Date: Wed Jul 25 07:40:26 2018
>>> New Revision: 337928
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=337928&view=rev <http://llvm.org/viewvc/llvm-project?rev=337928&view=rev>
>>> Log:
>>> [OPENMP] Fix PR38256: Fix locations of the artificial conditional op.
>>> 
>>> Fixed the source locations of the conditional op so that they don'r
>>> crash coverage pass.
>>> 
>>> Added:
>>>    cfe/trunk/test/CoverageMapping/openmp.c
>>> Modified:
>>>    cfe/trunk/lib/Sema/SemaOpenMP.cpp
>>> 
>>> Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=337928&r1=337927&r2=337928&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=337928&r1=337927&r2=337928&view=diff>
>>> ==============================================================================
>>> --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Jul 25 07:40:26 2018
>>> @@ -4909,7 +4909,8 @@ checkOpenMPLoop(OpenMPDirectiveKind DKin
>>>     ExprResult IsUBGreater = SemaRef.BuildBinOp(CurScope, InitLoc, BO_GT,
>>>                                                 UB.get(), LastIteration.get());
>>>     ExprResult CondOp = SemaRef.ActOnConditionalOp(
>>> -        InitLoc, InitLoc, IsUBGreater.get(), LastIteration.get(), UB.get());
>>> +        LastIteration.get()->getExprLoc(), InitLoc, IsUBGreater.get(),
>>> +        LastIteration.get(), UB.get());
>>>     EUB = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, UB.get(),
>>>                              CondOp.get());
>>>     EUB = SemaRef.ActOnFinishFullExpr(EUB.get());
>>> 
>>> Added: cfe/trunk/test/CoverageMapping/openmp.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/openmp.c?rev=337928&view=auto <http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/openmp.c?rev=337928&view=auto>
>>> ==============================================================================
>>> --- cfe/trunk/test/CoverageMapping/openmp.c (added)
>>> +++ cfe/trunk/test/CoverageMapping/openmp.c Wed Jul 25 07:40:26 2018
>>> @@ -0,0 +1,12 @@
>>> +// RUN: %clang_cc1 -fopenmp -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name openmp.c %s | FileCheck %s
>>> +
>>> +// CHECK: openmp.c:{{.+}}omp_outlined{{.+}}:
>>> +// CHECK: File 0, 10:3 -> 10:31
>>> +// CHECK: File 0, 10:19 -> 10:24
>>> +// CHECK: File 0, 10:26 -> 10:29
>>> +// CHECK: File 0, 10:30 -> 10:31
>>> +int foo(int time, int n) {
>>> +#pragma omp parallel for default(shared) schedule(dynamic, 1) reduction(+ : time)
>>> +  for (int i = 1; i < n; ++i);
>>> +  return 0;
>>> +}
>>> 
>>> 
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180725/8e6d1f5a/attachment-0001.html>


More information about the cfe-commits mailing list