ellis added a comment.

In D157913#4626007 <https://reviews.llvm.org/D157913#4626007>, @zequanwu wrote:

>> It seems that the `__llvm_prf_names` is retained in this mode. What is the 
>> overhead of this section generally? Can we instead use debug info to lookup 
>> function names?
>
> With debug info correlation enabled, `__llvm_prf_names` section will only 
> contain functions names that are not emitted to the final binary, not even in 
> debug info. So, this section is still much smaller compared to when not 
> enabling debug info correlation. This is used to indicate that those 
> functions are covered but not executed.
>
> Example from the test case above:
>
>   $ cat a.cpp
>   struct A {
>     void unused_func() {}
>   };
>   void used_func() {}
>   int main() {
>     used_func();
>     return 0;
>   }
>   $ clang -fprofile-instr-generate -fcoverage-mapping -mllvm 
> -enable-name-compression=false -mllvm -debug-info-correlate -g a.cpp -o a.out
>   $ llvm-objdump --section=__llvm_prf_names --full-contents a.out
>   
>   a.out:  file format elf64-x86-64
>   Contents of section __llvm_prf_names:
>    7b65 14005f5a 4e314131 31756e75 7365645f  .._ZN1A11unused_
>    7b75 66756e63 4576                        funcEv

Thanks for the explanation!



================
Comment at: clang/test/CodeGen/coverage-debug-info-correlate.c:1
+// RUN: %clang_cc1 -debug-info-kind=standalone -mllvm -debug-info-correlate 
-fprofile-instrument=clang -fcoverage-mapping -emit-llvm -o - %s | FileCheck %s
+
----------------
I think this test can be generalized to check that `__llvm_profile_raw_version` 
is emitted with or without debug info correlation.


================
Comment at: compiler-rt/test/profile/Darwin/coverage-debug-info-correlate.cpp:9
+// RUN: %clang_profgen -o %t -g -mllvm --debug-info-correlate 
-fcoverage-mapping %S/../Inputs/instrprof-debug-info-correlate-main.cpp 
%S/../Inputs/instrprof-debug-info-correlate-foo.cpp
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t.dSYM %t.profraw
----------------
NIT


================
Comment at: compiler-rt/test/profile/Darwin/coverage-debug-info-correlate.cpp:29
+
+// RUN: llvm-cov report --instr-profile=%t.profdata %t | FileCheck %s 
-check-prefix=NONAME
+
----------------
Is it worth testing that `%t.normal.profdata` emits the same coverage?


================
Comment at: llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp:1019-1029
+  if (auto E = NamesSection.takeError()) {
+    if (ProfileNames.isEmpty())
+      return std::move(E);
+    consumeError(std::move(E));
+  } else {
+    std::vector<SectionRef> NamesSectionRefs = *NamesSection;
+    if (NamesSectionRefs.size() != 1)
----------------
I don't quite understand why this was changed. Is there is a test case that 
covers this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157913/new/

https://reviews.llvm.org/D157913

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to