| ; 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 |
| ; RUN: echo -e "0\n0" > %t |
| ; RUN: llvm-profgen --format=text --unsymbolized-profile=%t --binary=%S/Inputs/inline-noprobe.perfbin --output=%t1 --fill-zero-for-all-funcs |
| ; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK-ALL-ZERO |
| ; RUN: llvm-profgen --format=text --unsymbolized-profile=%S/Inputs/out-of-bounds.raw.prof --binary=%S/Inputs/inline-noprobe.perfbin --output=%t1 |
| ; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK-OB |
| |
| 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-ALL-ZERO: bar:0:0 |
| CHECK-ALL-ZERO: 1: 0 |
| CHECK-ALL-ZERO: 5: 0 |
| CHECK-ALL-ZERO: foo:0:0 |
| CHECK-ALL-ZERO: 0: 0 |
| CHECK-ALL-ZERO: 2.1: 0 |
| CHECK-ALL-ZERO: 3: 0 |
| CHECK-ALL-ZERO: 3.2: 0 |
| CHECK-ALL-ZERO: 4: 0 |
| CHECK-ALL-ZERO: 3.1: bar:0 |
| CHECK-ALL-ZERO: 1: 0 |
| CHECK-ALL-ZERO: 3.2: bar:0 |
| CHECK-ALL-ZERO: 1: 0 |
| CHECK-ALL-ZERO: 7: 0 |
| CHECK-ALL-ZERO: main:0:0 |
| CHECK-ALL-ZERO: 0: 0 |
| CHECK-ALL-ZERO: 2: 0 |
| CHECK-ALL-ZERO: 1: foo:0 |
| CHECK-ALL-ZERO: 2.1: 0 |
| CHECK-ALL-ZERO: 3: 0 |
| CHECK-ALL-ZERO: 3.2: 0 |
| CHECK-ALL-ZERO: 4: 0 |
| CHECK-ALL-ZERO: 3.1: bar:0 |
| CHECK-ALL-ZERO: 1: 0 |
| CHECK-ALL-ZERO: 3.2: bar:0 |
| CHECK-ALL-ZERO: 1: 0 |
| |
| 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 |
| |
| ;CHECK-OB: foo:8:0 |
| ;CHECK-OB: 0: 1 |
| ;CHECK-OB: 2.1: 1 |
| ;CHECK-OB: 3: 1 |
| ;CHECK-OB: 3.2: 1 |
| ;CHECK-OB: 4: 1 |
| ;CHECK-OB: 3.1: bar:1 |
| ;CHECK-OB: 1: 1 |
| ;CHECK-OB: 3.2: bar:2 |
| ;CHECK-OB: 1: 1 |
| ;CHECK-OB: 7: 1 |
| ;CHECK-OB: main:8:0 |
| ;CHECK-OB: 0: 1 |
| ;CHECK-OB: 2: 1 |
| ;CHECK-OB: 1: foo:6 |
| ;CHECK-OB: 2.1: 1 |
| ;CHECK-OB: 3: 1 |
| ;CHECK-OB: 3.2: 1 |
| ;CHECK-OB: 4: 1 |
| ;CHECK-OB: 3.1: bar:1 |
| ;CHECK-OB: 1: 1 |
| ;CHECK-OB: 3.2: bar:1 |
| ;CHECK-OB: 1: 1 |
| ;CHECK-OB: bar:2:0 |
| ;CHECK-OB: 1: 1 |
| ;CHECK-OB: 5: 1 |
| |
| ; 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; |
| } |