• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Tests for weighted merge of sample profiles.
2
31- Merge the foo and bar profiles with unity weight and verify the combined output
4RUN: 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
5RUN: 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
61X_1X_WEIGHT: foo:1763288:35327
71X_1X_WEIGHT-NEXT:  7: 35327
81X_1X_WEIGHT-NEXT:  8: 35327
91X_1X_WEIGHT-NEXT:  9: 6930
101X_1X_WEIGHT-NEXT:  10: 29341
111X_1X_WEIGHT-NEXT:  11: 11906
121X_1X_WEIGHT-NEXT:  13: 18185 foo:19531
131X_1X_WEIGHT-NEXT:  15: 36458
141X_1X_WEIGHT-NEXT: bar:1772037:35370
151X_1X_WEIGHT-NEXT:  17: 35370
161X_1X_WEIGHT-NEXT:  18: 35370
171X_1X_WEIGHT-NEXT:  19: 7005
181X_1X_WEIGHT-NEXT:  20: 29407
191X_1X_WEIGHT-NEXT:  21: 12170
201X_1X_WEIGHT-NEXT:  23: 18150 bar:19829
211X_1X_WEIGHT-NEXT:  25: 36666
22
232- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output
24RUN: 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
253X_5X_WEIGHT: foo:8816440:176635
263X_5X_WEIGHT-NEXT:  7: 176635
273X_5X_WEIGHT-NEXT:  8: 176635
283X_5X_WEIGHT-NEXT:  9: 34650
293X_5X_WEIGHT-NEXT:  10: 146705
303X_5X_WEIGHT-NEXT:  11: 59530
313X_5X_WEIGHT-NEXT:  13: 90925 foo:97655
323X_5X_WEIGHT-NEXT:  15: 182290
333X_5X_WEIGHT-NEXT: bar:5316111:106110
343X_5X_WEIGHT-NEXT:  17: 106110
353X_5X_WEIGHT-NEXT:  18: 106110
363X_5X_WEIGHT-NEXT:  19: 21015
373X_5X_WEIGHT-NEXT:  20: 88221
383X_5X_WEIGHT-NEXT:  21: 36510
393X_5X_WEIGHT-NEXT:  23: 54450 bar:59487
403X_5X_WEIGHT-NEXT:  25: 109998
41
423- Bad merge: invalid weight
43RUN: 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
44RUN: 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
45RUN: 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
46RUN: 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
47RUN: 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
48INVALID_WEIGHT: error: Input weight must be a positive integer.
49
504- Bad merge: input path does not exist
51RUN: 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
52INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: {{[Nn]}}o such file or directory
53
545- No inputs
55RUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
56NO_INPUT: {{.*}}: No input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help
57