Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/test/tools/llvm-profdata/output-size-limit.test
- This file was added.
Tests for output-size-limit option. Functions with least sample count are dropped. | |||||
1- No effect if output size limit >= original size | |||||
RUN: llvm-profdata merge --sample --text --output-size-limit=212 %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=TEST_TEXT1 | |||||
TEST_TEXT1: main:184019:0 | |||||
TEST_TEXT1-NEXT: 4: 534 | |||||
snehasish: I don't think we should use *-DAG here since that means the test will pass if the lines are… | |||||
TEST_TEXT1-NEXT: 4.2: 534 | |||||
TEST_TEXT1-NEXT: 5: 1075 | |||||
TEST_TEXT1-NEXT: 5.1: 1075 | |||||
TEST_TEXT1-NEXT: 6: 2080 | |||||
TEST_TEXT1-NEXT: 7: 534 | |||||
TEST_TEXT1-NEXT: 9: 2064 _Z3bari:1471 _Z3fooi:631 | |||||
TEST_TEXT1-NEXT: 10: inline1:1000 | |||||
TEST_TEXT1-NEXT: 1: 1000 | |||||
TEST_TEXT1-NEXT: 10: inline2:2000 | |||||
TEST_TEXT1-NEXT: 1: 2000 | |||||
TEST_TEXT1-NEXT: _Z3bari:20301:1437 | |||||
TEST_TEXT1-NEXT: 1: 1437 | |||||
TEST_TEXT1-NEXT: _Z3fooi:7711:610 | |||||
TEST_TEXT1-NEXT: 1: 610 | |||||
2- 1 function dropped | |||||
RUN: llvm-profdata merge --sample --text --output-size-limit=211 %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=TEST_TEXT2 | |||||
RUN: llvm-profdata merge --sample --text --output-size-limit=187 %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=TEST_TEXT2 | |||||
TEST_TEXT2: main:184019:0 | |||||
TEST_TEXT2-NEXT: 4: 534 | |||||
TEST_TEXT2-NEXT: 4.2: 534 | |||||
TEST_TEXT2-NEXT: 5: 1075 | |||||
TEST_TEXT2-NEXT: 5.1: 1075 | |||||
TEST_TEXT2-NEXT: 6: 2080 | |||||
TEST_TEXT2-NEXT: 7: 534 | |||||
TEST_TEXT2-NEXT: 9: 2064 _Z3bari:1471 _Z3fooi:631 | |||||
TEST_TEXT2-NEXT: 10: inline1:1000 | |||||
TEST_TEXT2-NEXT: 1: 1000 | |||||
TEST_TEXT2-NEXT: 10: inline2:2000 | |||||
TEST_TEXT2-NEXT: 1: 2000 | |||||
TEST_TEXT2-NEXT: _Z3bari:20301:1437 | |||||
TEST_TEXT2-NEXT: 1: 1437 | |||||
3- 2 functions dropped | |||||
RUN: llvm-profdata merge --sample --text --output-size-limit=170 %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=TEST_TEXT3 | |||||
TEST_TEXT3: main:184019:0 | |||||
TEST_TEXT3-NEXT: 4: 534 | |||||
TEST_TEXT3-NEXT: 4.2: 534 | |||||
TEST_TEXT3-NEXT: 5: 1075 | |||||
TEST_TEXT3-NEXT: 5.1: 1075 | |||||
TEST_TEXT3-NEXT: 6: 2080 | |||||
TEST_TEXT3-NEXT: 7: 534 | |||||
TEST_TEXT3-NEXT: 9: 2064 _Z3bari:1471 _Z3fooi:631 | |||||
TEST_TEXT3-NEXT: 10: inline1:1000 | |||||
TEST_TEXT3-NEXT: 1: 1000 | |||||
TEST_TEXT3-NEXT: 10: inline2:2000 | |||||
TEST_TEXT3-NEXT: 1: 2000 | |||||
4- All functions dropped, should report an error | |||||
RUN: not llvm-profdata merge --sample --text --output-size-limit=158 %p/Inputs/sample-profile.proftext 2>&1 | FileCheck %s --check-prefix=INVALID1 | |||||
INVALID1: error: Too much profile data | |||||
5- ExtBinary form, no function dropped. Check output size and file content converted back to text | |||||
RUN: llvm-profdata merge --sample --extbinary --output-size-limit=489 %p/Inputs/sample-profile.proftext -o %t.output | |||||
RUN: test $(stat -c %%s %t.output) -le 489 | |||||
RUN: llvm-profdata merge --sample --text %t.output | FileCheck %s --check-prefix=TEST_EXTBINARY1 | |||||
Not Done ReplyInline ActionsOn Windows this seems to be expanded in a way you probably did not expect: dyung: On Windows this seems to be expanded in a way you probably did not expect:
(https://lab.llvm. | |||||
TEST_EXTBINARY1: main:184019:0 | |||||
TEST_EXTBINARY1-NEXT: 4: 534 | |||||
TEST_EXTBINARY1-NEXT: 4.2: 534 | |||||
TEST_EXTBINARY1-NEXT: 5: 1075 | |||||
TEST_EXTBINARY1-NEXT: 5.1: 1075 | |||||
TEST_EXTBINARY1-NEXT: 6: 2080 | |||||
TEST_EXTBINARY1-NEXT: 7: 534 | |||||
TEST_EXTBINARY1-NEXT: 9: 2064 _Z3bari:1471 _Z3fooi:631 | |||||
TEST_EXTBINARY1-NEXT: 10: inline1:1000 | |||||
TEST_EXTBINARY1-NEXT: 1: 1000 | |||||
TEST_EXTBINARY1-NEXT: 10: inline2:2000 | |||||
TEST_EXTBINARY1-NEXT: 1: 2000 | |||||
TEST_EXTBINARY1-NEXT: _Z3bari:20301:1437 | |||||
TEST_EXTBINARY1-NEXT: 1: 1437 | |||||
TEST_EXTBINARY1-NEXT: _Z3fooi:7711:610 | |||||
TEST_EXTBINARY1-NEXT: 1: 610 | |||||
6- ExtBinary form, 1 function dropped | |||||
RUN: llvm-profdata merge --sample --extbinary --output-size-limit=488 %p/Inputs/sample-profile.proftext -o %t.output | |||||
RUN: test $(stat -c %%s %t.output) -le 488 | |||||
RUN: llvm-profdata merge --sample --text %t.output | FileCheck %s --check-prefix=TEST_EXTBINARY2 | |||||
TEST_EXTBINARY2: main:184019:0 | |||||
TEST_EXTBINARY2-NEXT: 4: 534 | |||||
TEST_EXTBINARY2-NEXT: 4.2: 534 | |||||
TEST_EXTBINARY2-NEXT: 5: 1075 | |||||
TEST_EXTBINARY2-NEXT: 5.1: 1075 | |||||
TEST_EXTBINARY2-NEXT: 6: 2080 | |||||
TEST_EXTBINARY2-NEXT: 7: 534 | |||||
TEST_EXTBINARY2-NEXT: 9: 2064 _Z3bari:1471 _Z3fooi:631 | |||||
TEST_EXTBINARY2-NEXT: 10: inline1:1000 | |||||
TEST_EXTBINARY2-NEXT: 1: 1000 | |||||
TEST_EXTBINARY2-NEXT: 10: inline2:2000 | |||||
TEST_EXTBINARY2-NEXT: 1: 2000 | |||||
TEST_EXTBINARY2-NEXT: _Z3bari:20301:1437 | |||||
TEST_EXTBINARY2-NEXT: 1: 1437 | |||||
7- ExtBinary form, 2 functions dropped | |||||
RUN: llvm-profdata merge --sample --extbinary --output-size-limit=474 %p/Inputs/sample-profile.proftext -o %t.output | |||||
RUN: test $(stat -c %%s %t.output) -le 474 | |||||
RUN: llvm-profdata merge --sample --text %t.output | FileCheck %s --check-prefix=TEST_EXTBINARY3 | |||||
TEST_EXTBINARY3: main:184019:0 | |||||
TEST_EXTBINARY3-NEXT: 4: 534 | |||||
TEST_EXTBINARY3-NEXT: 4.2: 534 | |||||
TEST_EXTBINARY3-NEXT: 5: 1075 | |||||
TEST_EXTBINARY3-NEXT: 5.1: 1075 | |||||
TEST_EXTBINARY3-NEXT: 6: 2080 | |||||
TEST_EXTBINARY3-NEXT: 7: 534 | |||||
TEST_EXTBINARY3-NEXT: 9: 2064 _Z3bari:1471 _Z3fooi:631 | |||||
TEST_EXTBINARY3-NEXT: 10: inline1:1000 | |||||
TEST_EXTBINARY3-NEXT: 1: 1000 | |||||
TEST_EXTBINARY3-NEXT: 10: inline2:2000 | |||||
TEST_EXTBINARY3-NEXT: 1: 2000 | |||||
8- ExtBinary form, all functions dropped | |||||
RUN: not llvm-profdata merge --sample --extbinary --output-size-limit=400 %p/Inputs/sample-profile.proftext 2>&1 | FileCheck %s --check-prefix=INVALID2 | |||||
INVALID2: error: Too much profile data | |||||
I don't think we should use *-DAG here since that means the test will pass if the lines are reordered. However, if we reorder the symbol line with its contents the text format will be incorrect.
I think the -DAG directive is useful if there is non-determinism in the text format where profile information for a whole symbol may appear before another symbol. In this case we should separate out the CHECKs like the example in [1]. Though we should fix non-deterministic output if this is the case.
[1] https://llvm.org/docs/CommandGuide/FileCheck.html#the-check-dag-directive