1 ; RUN: llvm-profgen --format=text --perfscript=%s --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --show-pseudo-probe --show-disassembly-only | FileCheck %s
2 ; RUN: llvm-profgen --format=text --perfscript=%s --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --show-pseudo-probe --show-disassembly-only --disassemble-functions=main,foo | FileCheck %s -check-prefix=SYM
4 PERF_RECORD_MMAP2 2854748/2854748: [0x400000(0x1000) @ 0 00:1d 123291722 526021]: r-xp /home/inline-cs-pseudoprobe.perfbin
6 ; CHECK: Pseudo Probe Desc:
7 ; CHECK: GUID: 6699318081062747564 Name: foo
8 ; CHECK: Hash: 563088904013236
9 ; CHECK: GUID: 15822663052811949562 Name: main
10 ; CHECK: Hash: 281479271677951
11 ; CHECK: GUID: 16434608426314478903 Name: bar
12 ; CHECK: Hash: 72617220756
18 ; CHECK: [Probe]: FUNC: bar Index: 1 Type: Block
19 ; CHECK-NEXT: [Probe]: FUNC: bar Index: 4 Type: Block
20 ; CHECK-NEXT: 201754: imull $2863311531, %edi, %eax
23 ; CHECK: [Probe]: FUNC: foo Index: 1 Type: Block
24 ; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block
25 ; CHECK-NEXT: 201770: movl $1, %ecx
27 ; CHECK: [Probe]: FUNC: foo Index: 5 Type: Block
28 ; CHECK-NEXT: 201780: addl $30, %esi
29 ; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block
30 ; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block
31 ; CHECK-NEXT: 201783: addl $1, %ecx
33 ; CHECK: [Probe]: FUNC: foo Index: 3 Type: Block
34 ; CHECK-NEXT: 20178e: movl %ecx, %edx
36 ; CHECK: [Probe]: FUNC: foo Index: 4 Type: Block
37 ; CHECK-NEXT: [Probe]: FUNC: bar Index: 1 Type: Block Inlined: @ foo:8
38 ; CHECK-NEXT: [Probe]: FUNC: bar Index: 4 Type: Block Inlined: @ foo:8
39 ; CHECK-NEXT: 2017bf: addl %ecx, %edx
42 ; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block
43 ; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block
44 ; CHECK-NEXT: 2017cf: addl $1, %ecx
46 ; CHECK: [Probe]: FUNC: foo Index: 7 Type: Block
47 ; CHECK-NEXT: 2017de: movl $2098432, %edi
49 ; CHECK: [Probe]: FUNC: foo Index: 9 Type: DirectCall
50 ; CHECK-NEXT: 2017e5: callq 0x201930
54 ; CHECK: [Probe]: FUNC: main Index: 1 Type: Block
55 ; CHECK-NEXT: [Probe]: FUNC: foo Index: 1 Type: Block Inlined: @ main:2
56 ; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block Inlined: @ main:2
57 ; CHECK-NEXT: 2017f0: movl $1, %ecx
59 ; CHECK: [Probe]: FUNC: foo Index: 5 Type: Block Inlined: @ main:2
60 ; CHECK-NEXT: 201800: addl $30, %esi
61 ; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block Inlined: @ main:2
62 ; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block Inlined: @ main:2
63 ; CHECK-NEXT: 201803: addl $1, %ecx
65 ; CHECK: [Probe]: FUNC: foo Index: 3 Type: Block Inlined: @ main:2
66 ; CHECK-NEXT: 20180e: movl %ecx, %edx
68 ; CHECK: [Probe]: FUNC: foo Index: 4 Type: Block Inlined: @ main:2
69 ; CHECK-NEXT: [Probe]: FUNC: bar Index: 1 Type: Block Inlined: @ main:2 @ foo:8
70 ; CHECK-NEXT: [Probe]: FUNC: bar Index: 4 Type: Block Inlined: @ main:2 @ foo:8
71 ; CHECK-NEXT: 20183f: addl %ecx, %edx
73 ; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block Inlined: @ main:2
74 ; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block Inlined: @ main:2
75 ; CHECK-NEXT: 20184f: addl $1, %ecx
77 ; CHECK: [Probe]: FUNC: foo Index: 7 Type: Block Inlined: @ main:2
78 ; CHECK-NEXT: 20185e: movl $2098432, %edi
80 ; CHECK: [Probe]: FUNC: foo Index: 9 Type: DirectCall Inlined: @ main:2
81 ; CHECK-NEXT: 201865: callq 0x201930
89 ; clang -O3 -fuse-ld=lld -fpseudo-probe-for-profiling
90 ; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls
95 int bar(int x, int y) {
104 while (i++ < 4000 * 4000)
105 if (i % 91) s = bar(i, s); else s += 30;
106 printf("sum is %d\n", s);