llvm-for-llvmta/test/tools/llvm-profgen/pseudoprobe-decoding.test

122 lines
4.3 KiB
Plaintext

; RUN: llvm-profgen --perfscript=%s --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --show-pseudo-probe --show-disassembly-only | FileCheck %s
PERF_RECORD_MMAP2 2854748/2854748: [0x400000(0x1000) @ 0 00:1d 123291722 526021]: r-xp /home/inline-cs-pseudoprobe.perfbin
; CHECK: Pseudo Probe Desc:
; CHECK: GUID: 6699318081062747564 Name: foo
; CHECK: Hash: 138950591924
; CHECK: GUID: 15822663052811949562 Name: main
; CHECK: Hash: 4294967295
; CHECK: GUID: 16434608426314478903 Name: bar
; CHECK: Hash: 72617220756
; CHECK: <bar>:
; CHECK: [Probe]: FUNC: bar Index: 1 Type: Block
; CHECK-NEXT: 754: imull $2863311531, %edi, %eax
; CHECK: [Probe]: FUNC: bar Index: 2 Type: Block Dangling
; CHECK-NEXT: [Probe]: FUNC: bar Index: 3 Type: Block Dangling
; CHECK-NEXT: 768: cmovbl %esi, %ecx
; CHECK: [Probe]: FUNC: bar Index: 4 Type: Block
; CHECK-NEXT: 76e: popq %rbp
; CHECK: <foo>:
; CHECK: [Probe]: FUNC: foo Index: 1 Type: Block
; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block
; CHECK-NEXT: 770: movl $1, %ecx
; CHECK: [Probe]: FUNC: foo Index: 5 Type: Block
; CHECK-NEXT: 780: addl $30, %esi
; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block
; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block
; CHECK-NEXT: 783: addl $1, %ecx
; CHECK: [Probe]: FUNC: foo Index: 3 Type: Block
; CHECK-NEXT: 7a9: cmpl %eax, %ecx
; CHECK: [Probe]: FUNC: foo Index: 4 Type: Block
; CHECK-NEXT: [Probe]: FUNC: bar Index: 1 Type: Block Inlined: @ foo:8
; CHECK-NEXT: 7bf: addl %ecx, %edx
; CHECK: [Probe]: FUNC: bar Index: 2 Type: Block Dangling Inlined: @ foo:8
; CHECK-NEXT: [Probe]: FUNC: bar Index: 3 Type: Block Dangling Inlined: @ foo:8
; CHECK-NEXT: 7c8: cmovel %esi, %eax
; CHECK: [Probe]: FUNC: bar Index: 4 Type: Block Inlined: @ foo:8
; CHECK-NEXT: 7cd: movl %eax, %esi
; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block
; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block
; CHECK: [Probe]: FUNC: foo Index: 7 Type: Block
; CHECK-NEXT: 7de: movl $2098432, %edi
; CHECK: [Probe]: FUNC: foo Index: 9 Type: DirectCall
; CHECK-NEXT: 7e5: callq 0x930
; CHECK: <main>:
; CHECK: [Probe]: FUNC: main Index: 1 Type: Block
; CHECK-NEXT: [Probe]: FUNC: foo Index: 1 Type: Block Inlined: @ main:2
; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block Inlined: @ main:2
; CHECK-NEXT: 7f0: movl $1, %ecx
; CHECK: [Probe]: FUNC: foo Index: 5 Type: Block Inlined: @ main:2
; CHECK-NEXT: 800: addl $30, %esi
; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block Inlined: @ main:2
; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block Inlined: @ main:2
; CHECK-NEXT: 803: addl $1, %ecx
; CHECK: [Probe]: FUNC: foo Index: 3 Type: Block Inlined: @ main:2
; CHECK-NEXT: 829: cmpl %eax, %ecx
; CHECK: [Probe]: FUNC: foo Index: 4 Type: Block Inlined: @ main:2
; CHECK-NEXT: [Probe]: FUNC: bar Index: 1 Type: Block Inlined: @ main:2 @ foo:8
; CHECK-NEXT: 83f: addl %ecx, %edx
; CHECK: [Probe]: FUNC: bar Index: 2 Type: Block Dangling Inlined: @ main:2 @ foo:8
; CHECK-NEXT: [Probe]: FUNC: bar Index: 3 Type: Block Dangling Inlined: @ main:2 @ foo:8
; CHECK-NEXT: 848: cmovel %esi, %eax
; CHECK: [Probe]: FUNC: bar Index: 4 Type: Block Inlined: @ main:2 @ foo:8
; CHECK-NEXT: 84d: movl %eax, %esi
; CHECK: [Probe]: FUNC: foo Index: 6 Type: Block Inlined: @ main:2
; CHECK-NEXT: [Probe]: FUNC: foo Index: 2 Type: Block Inlined: @ main:2
; CHECK-NEXT: 84f: addl $1, %ecx
; CHECK: [Probe]: FUNC: foo Index: 7 Type: Block Inlined: @ main:2
; CHECK-NEXT: 85e: movl $2098432, %edi
; CHECK: [Probe]: FUNC: foo Index: 9 Type: DirectCall Inlined: @ main:2
; CHECK-NEXT: 865: callq 0x930
; clang -O3 -fexperimental-new-pass-manager -fuse-ld=lld -fpseudo-probe-for-profiling
; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls
; -g test.c -o a.out
#include <stdio.h>
int bar(int x, int y) {
if (x % 3) {
return x - y;
}
return x + y;
}
void foo() {
int s, i = 0;
while (i++ < 4000 * 4000)
if (i % 91) s = bar(i, s); else s += 30;
printf("sum is %d\n", s);
}
int main() {
foo();
return 0;
}