<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>This is visible to the user, the statement under #pragma omp
      parallel directive is outlined as a function.<br>
    </p>
    <pre class="moz-signature" cols="72">-------------
Best regards,
Alexey Bataev</pre>
    <div class="moz-cite-prefix">25.07.2018 13:31, Vedant Kumar пишет:<br>
    </div>
    <blockquote type="cite"
      cite="mid:70893259-B203-42A7-958D-92C3D3928832@apple.com">
      <pre wrap="">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

</pre>
      <blockquote type="cite">
        <pre wrap="">On Jul 25, 2018, at 7:40 AM, Alexey Bataev via cfe-commits <a class="moz-txt-link-rfc2396E" href="mailto:cfe-commits@lists.llvm.org"><cfe-commits@lists.llvm.org></a> wrote:

Author: abataev
Date: Wed Jul 25 07:40:26 2018
New Revision: 337928

URL: <a class="moz-txt-link-freetext" href="http://llvm.org/viewvc/llvm-project?rev=337928&view=rev">http://llvm.org/viewvc/llvm-project?rev=337928&view=rev</a>
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: <a class="moz-txt-link-freetext" href="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</a>
==============================================================================
--- 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: <a class="moz-txt-link-freetext" href="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</a>
==============================================================================
--- 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
<a class="moz-txt-link-abbreviated" href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a>
</pre>
      </blockquote>
      <pre wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>