1; RUN: llvm-profgen --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --show-unwinder-output | FileCheck %s --check-prefix=CHECK-UNWINDER
2; RUN: FileCheck %s --input-file %t
3
4; CHECK:[main:1 @ foo]:44:0
5; CHECK: 2.2: 14
6; CHECK: 3: 15
7; CHECK: 3.2: 14 bar:14
8; CHECK: 3.4: 1
9; CHECK:[main:1 @ foo:3.2 @ bar]:14:0
10; CHECK: 1: 14
11
12; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Range Counter:
13; CHECK-UNWINDER: main:1 @ foo
14; CHECK-UNWINDER:   (670, 6ad): 1
15; CHECK-UNWINDER:   (67e, 69b): 1
16; CHECK-UNWINDER:   (67e, 6ad): 13
17; CHECK-UNWINDER:   (6bd, 6c8): 14
18; CHECK-UNWINDER: main:1 @ foo:3.2 @ bar
19; CHECK-UNWINDER:   (6af, 6bb): 14
20
21
22; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Branch Counter:
23; CHECK-UNWINDER: main:1 @ foo
24; CHECK-UNWINDER:   (69b, 670): 1
25; CHECK-UNWINDER:   (6c8, 67e): 15
26
27; original code:
28; clang -O3 -g test.c -o a.out
29#include <stdio.h>
30
31int bar(int x, int y) {
32  if (x % 3) {
33    return x - y;
34  }
35  return x + y;
36}
37
38void foo() {
39  int s, i = 0;
40  while (i++ < 4000 * 4000)
41    if (i % 91) s = bar(i, s); else s += 30;
42  printf("sum is %d\n", s);
43}
44
45int main() {
46  foo();
47  return 0;
48}
49