1#include <string.h>
2
3void (*f0)();
4void (*f1)();
5void (*f2)();
6
7char dst[200];
8char src[200];
9volatile int n;
10
11__attribute__((noinline)) void foo() {}
12
13__attribute__((noinline)) void bar() {
14 f0 = foo;
15 f1 = foo;
16 f2 = foo;
17 n = 4;
18}
19int main(int argc, char *argv[]) {
20 int i;
21 bar();
22 if (argc == 1) {
23 f0();
24 for (i = 0; i < 9; i++)
25 f1();
26 for (i = 0; i < 99; i++)
27 f2();
28 } else {
29 memcpy(dest: (void *)dst, src: (void *)src, n: n);
30 for (i = 0; i < 6; i++)
31 memcpy(dest: (void *)(dst + 2), src: (void *)src, n: n + 1);
32 for (i = 0; i < 66; i++)
33 memcpy(dest: (void *)(dst + 9), src: (void *)src, n: n + 2);
34 }
35}
36
37// CHECK: Counters:
38// CHECK-NEXT: main:
39// CHECK-NEXT: Hash: 0x0a9bd81e87ab6e87
40// CHECK-NEXT: Counters: 6
41// CHECK-NEXT: Indirect Call Site Count: 3
42// CHECK-NEXT: Number of Memory Intrinsics Calls: 3
43// CHECK-NEXT: Block counts: [27, 297, 12, 132, 3, 2]
44// CHECK-NEXT: Indirect Target Results:
45// CHECK-NEXT: [ 0, foo, 3 ]
46// CHECK-NEXT: [ 1, foo, 27 ]
47// CHECK-NEXT: [ 2, foo, 297 ]
48// CHECK-NEXT: Memory Intrinsic Size Results:
49// CHECK-NEXT: [ 0, 4, 2 ]
50// CHECK-NEXT: [ 1, 5, 12 ]
51// CHECK-NEXT: [ 2, 6, 132 ]
52// CHECK-NEXT: Instrumentation level: IR entry_first = 0
53// CHECK-NEXT: Functions shown: 1
54// CHECK-NEXT: Total functions: 3
55// CHECK-NEXT: Maximum function count: 327
56// CHECK-NEXT: Maximum internal block count: 297
57// CHECK-NEXT: Statistics for indirect call sites profile:
58// CHECK-NEXT: Total number of sites: 3
59// CHECK-NEXT: Total number of sites with values: 3
60// CHECK-NEXT: Total number of profiled values: 3
61// CHECK-NEXT: Value sites histogram:
62// CHECK-NEXT: NumTargets, SiteCount
63// CHECK-NEXT: 1, 3
64// CHECK-NEXT: Statistics for memory intrinsic calls sizes profile:
65// CHECK-NEXT: Total number of sites: 3
66// CHECK-NEXT: Total number of sites with values: 3
67// CHECK-NEXT: Total number of profiled values: 3
68// CHECK-NEXT: Value sites histogram:
69// CHECK-NEXT: NumTargets, SiteCount
70// CHECK-NEXT: 1, 3
71

source code of compiler-rt/test/profile/Linux/Inputs/instrprof-value-merge.c