1 | // RUN: rm -f %t.profdata |
2 | // RUN: %clang_pgogen -o %t -mllvm -pgo-temporal-instrumentation %s |
3 | // RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t n |
4 | // RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t y |
5 | // RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input=5,%t.1.profraw |
6 | // RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --implicit-check-not=unused |
7 | |
8 | // RUN: rm -f %t.profdata |
9 | // RUN: %clang_pgogen -o %t -mllvm -pgo-temporal-instrumentation -mllvm -pgo-block-coverage %s |
10 | // RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t n |
11 | // RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t y |
12 | // RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input=5,%t.1.profraw |
13 | // RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --implicit-check-not=unused |
14 | |
15 | extern void exit(int); |
16 | extern void __llvm_profile_reset_counters(); |
17 | |
18 | void a() {} |
19 | void b() {} |
20 | void unused() { exit(1); } |
21 | void c() {} |
22 | |
23 | int main(int argc, const char *argv[]) { |
24 | if (argc != 2) |
25 | unused(); |
26 | a(); |
27 | b(); |
28 | b(); |
29 | c(); |
30 | if (*argv[1] == 'y') |
31 | __llvm_profile_reset_counters(); |
32 | a(); |
33 | c(); |
34 | b(); |
35 | return 0; |
36 | } |
37 | |
38 | // CHECK: Temporal Profile Traces (samples=2 seen=2): |
39 | // CHECK: Temporal Profile Trace 0 (weight=1 count=4): |
40 | // CHECK: main |
41 | // CHECK: a |
42 | // CHECK: b |
43 | // CHECK: c |
44 | // CHECK: Temporal Profile Trace 1 (weight=5 count=3): |
45 | // CHECK: a |
46 | // CHECK: c |
47 | // CHECK: b |
48 | |