[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / compiler-rt / test / profile / instrprof-merging.cpp
blob4a3f14b044a5c91d35c4038a94edd0b4164e1ec5
1 // UNSUPPORTED: target={{.*windows.*}}
2 // XFAIL: target={{.*}}-aix{{.*}}
3 // 1) Compile shared code into different object files and into an executable.
5 // RUN: %clangxx_profgen -std=c++14 -fcoverage-mapping %s -c -o %t.v1.o \
6 // RUN: -D_VERSION_1
7 // RUN: %clangxx_profgen -std=c++14 -fcoverage-mapping %s -c -o %t.v2.o \
8 // RUN: -D_VERSION_2
9 // RUN: %clangxx_profgen -std=c++14 -fcoverage-mapping %t.v1.o %t.v2.o \
10 // RUN: -o %t.exe
12 // 2) Collect profile data.
14 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe
15 // RUN: llvm-profdata merge %t.profraw -o %t.profdata
17 // 3) Generate coverage reports from the different object files and the exe.
19 // RUN: llvm-cov show %t.v1.o -instr-profile=%t.profdata | FileCheck %s -check-prefixes=V1,V1-ONLY
20 // RUN: llvm-cov show %t.v2.o -instr-profile=%t.profdata | FileCheck %s -check-prefixes=V2,V2-ONLY
21 // RUN: llvm-cov show %t.v1.o -object %t.v2.o -instr-profile=%t.profdata | FileCheck %s -check-prefixes=V1,V2
22 // RUN: llvm-cov show %t.exe -instr-profile=%t.profdata | FileCheck %s -check-prefixes=V1,V2
24 // 4) Verify that coverage reporting on the aggregate coverage mapping shows
25 // hits for all code. (We used to arbitrarily pick a mapping from one binary
26 // and prefer it over others.) When only limited coverage information is
27 // available (just from one binary), don't try to guess any region counts.
29 struct A {
30 A() {} // V1: [[@LINE]]{{ *}}|{{ *}}1
31 // V1-ONLY: [[@LINE+1]]{{ *}}|{{ *}}|
32 A(int) {} // V2-ONLY: [[@LINE-2]]{{ *}}|{{ *}}|
33 // V2: [[@LINE-1]]{{ *}}|{{ *}}1
36 #ifdef _VERSION_1
38 void foo();
40 void bar() {
41 A x; // V1: [[@LINE]]{{ *}}|{{ *}}1
44 int main() {
45 foo(); // V1: [[@LINE]]{{ *}}|{{ *}}1
46 bar();
47 return 0;
50 #endif // _VERSION_1
52 #ifdef _VERSION_2
54 void foo() {
55 A x{0}; // V2: [[@LINE]]{{ *}}|{{ *}}1
58 #endif // _VERSION_2