/
inline-noprobe.test
52 lines (46 loc) · 1.61 KB
/
inline-noprobe.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-noprobe.perfscript --binary=%S/Inputs/inline-noprobe.perfbin --output=%t --skip-symbolization
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE
; RUN: llvm-profgen --format=text --use-dwarf-correlation --perfscript=%S/Inputs/inline-noprobe.perfscript --binary=%S/Inputs/inline-noprobe.perfbin --output=%t --skip-symbolization
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t --binary=%S/Inputs/inline-noprobe.perfbin --output=%t1
; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK
; RUN: llvm-profgen --format=text --use-dwarf-correlation --perfscript=%S/Inputs/inline-noprobe.perfscript --binary=%S/Inputs/inline-noprobe.perfbin --output=%t
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK
CHECK: main:188:0
CHECK: 0: 0
CHECK: 2: 0
CHECK: 1: foo:188
CHECK: 2.1: 42
CHECK: 3: 62
CHECK: 3.2: 21
CHECK: 4: 0
CHECK: 3.1: bar:42
CHECK: 1: 42
CHECK: 3.2: bar:21
CHECK: 1: 21
CHECK-RAW-PROFILE: 3
CHECK-RAW-PROFILE-NEXT: 650-691:21
CHECK-RAW-PROFILE-NEXT: 669-677:20
CHECK-RAW-PROFILE-NEXT: 669-691:21
CHECK-RAW-PROFILE-NEXT: 2
CHECK-RAW-PROFILE-NEXT: 677->650:21
CHECK-RAW-PROFILE-NEXT: 691->669:43
; original code:
; clang -O3 -g -fdebug-info-for-profiling test.c -o a.out
#include <stdio.h>
int bar(int x, int y) {
if (x % 2) {
return x - y;
}
return x + y;
}
void foo() {
int s, i = 0;
while (i++ < 4000 * 4000)
if (i % 3) s = bar(i, s); else s += bar(s, i);
printf("sum is %d\n", s);
}
int main() {
foo();
return 0;
}