xref: /aosp_15_r20/external/llvm/test/tools/llvm-profdata/weight-sample.test (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard WorkerTests for weighted merge of sample profiles.
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker1- Merge the foo and bar profiles with unity weight and verify the combined output
4*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge -sample -text -weighted-input=1,%p/Inputs/weight-sample-bar.proftext -weighted-input=1,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT
5*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge -sample -text -weighted-input=1,%p/Inputs/weight-sample-bar.proftext %p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT
6*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT: foo:1763288:35327
7*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  7: 35327
8*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  8: 35327
9*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  9: 6930
10*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  10: 29341
11*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  11: 11906
12*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  13: 18185 foo:19531
13*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  15: 36458
14*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT: bar:1772037:35370
15*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  17: 35370
16*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  18: 35370
17*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  19: 7005
18*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  20: 29407
19*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  21: 12170
20*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  23: 18150 bar:19829
21*9880d681SAndroid Build Coastguard Worker1X_1X_WEIGHT-NEXT:  25: 36666
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output
24*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge -sample -text -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=5,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=3X_5X_WEIGHT
25*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT: foo:8816440:176635
26*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  7: 176635
27*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  8: 176635
28*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  9: 34650
29*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  10: 146705
30*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  11: 59530
31*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  13: 90925 foo:97655
32*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  15: 182290
33*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT: bar:5316111:106110
34*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  17: 106110
35*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  18: 106110
36*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  19: 21015
37*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  20: 88221
38*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  21: 36510
39*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  23: 54450 bar:59487
40*9880d681SAndroid Build Coastguard Worker3X_5X_WEIGHT-NEXT:  25: 109998
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker3- Bad merge: invalid weight
43*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=0,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
44*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=0.75,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
45*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=-5,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
46*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
47*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
48*9880d681SAndroid Build Coastguard WorkerINVALID_WEIGHT: error: Input weight must be a positive integer.
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker4- Bad merge: input path does not exist
51*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/does-not-exist.proftext -weighted-input=2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_INPUT
52*9880d681SAndroid Build Coastguard WorkerINVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: {{[Nn]}}o such file or directory
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker5- No inputs
55*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
56*9880d681SAndroid Build Coastguard WorkerNO_INPUT: {{.*}}: No input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help
57