diff options
Diffstat (limited to 'test/tools/llvm-profdata')
| -rw-r--r-- | test/tools/llvm-profdata/Inputs/c-general.profraw | bin | 1776 -> 1680 bytes | |||
| -rw-r--r-- | test/tools/llvm-profdata/Inputs/compat.profdata.v4 | bin | 0 -> 1336 bytes | |||
| -rw-r--r-- | test/tools/llvm-profdata/c-general.test | 2 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/compat.proftext | 23 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/general.proftext | 40 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/input-filenames.test | 17 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/multiple-inputs.test | 38 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/raw-32-bits-be.test | 18 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/raw-32-bits-le.test | 18 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/raw-64-bits-be.test | 20 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/raw-64-bits-le.test | 20 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/raw-two-profiles.test | 30 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/value-prof.proftext | 10 | ||||
| -rw-r--r-- | test/tools/llvm-profdata/weight-instr.test | 86 |
14 files changed, 188 insertions, 134 deletions
diff --git a/test/tools/llvm-profdata/Inputs/c-general.profraw b/test/tools/llvm-profdata/Inputs/c-general.profraw Binary files differindex a4d94858a9e7c..332d11b140f52 100644 --- a/test/tools/llvm-profdata/Inputs/c-general.profraw +++ b/test/tools/llvm-profdata/Inputs/c-general.profraw diff --git a/test/tools/llvm-profdata/Inputs/compat.profdata.v4 b/test/tools/llvm-profdata/Inputs/compat.profdata.v4 Binary files differnew file mode 100644 index 0000000000000..7db0d1d3f3e9d --- /dev/null +++ b/test/tools/llvm-profdata/Inputs/compat.profdata.v4 diff --git a/test/tools/llvm-profdata/c-general.test b/test/tools/llvm-profdata/c-general.test index efa9bfa18d73c..0ec7c113eb4c6 100644 --- a/test/tools/llvm-profdata/c-general.test +++ b/test/tools/llvm-profdata/c-general.test @@ -9,7 +9,7 @@ REGENERATE: $ CFE_TESTDIR=$CFE/test/Profile REGENERATE: $ clang -o a.out -fprofile-instr-generate $CFE_TESTDIR/c-general.c REGENERATE: $ LLVM_PROFILE_FILE=$TESTDIR/Inputs/c-general.profraw ./a.out -RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - | FileCheck %s -check-prefix=CHECK +RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - | FileCheck %s RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - --function=switches | FileCheck %s -check-prefix=SWITCHES -check-prefix=CHECK SWITCHES-LABEL: Counters: diff --git a/test/tools/llvm-profdata/compat.proftext b/test/tools/llvm-profdata/compat.proftext index 139202d162e6f..17855a7f0f9eb 100644 --- a/test/tools/llvm-profdata/compat.proftext +++ b/test/tools/llvm-profdata/compat.proftext @@ -63,5 +63,26 @@ large_numbers # FORMATV2-NEXT: Total functions: 2 # FORMATV2-NEXT: Maximum function count: 499500 # FORMATV2-NEXT: Maximum internal block count: 1000000 +# +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v4 -all-functions --counts | FileCheck %s -check-prefix=FORMATV4 - +# FORMATV4: Counters: +# FORMATV4: name with spaces: +# FORMATV4: Hash: 0x0000000000000400 +# FORMATV4: Counters: 2 +# FORMATV4: Function count: 0 +# FORMATV4: Block counts: [0] +# FORMATV4: function_count_only: +# FORMATV4: Hash: 0x0000000000000000 +# FORMATV4: Counters: 1 +# FORMATV4: Function count: 97531 +# FORMATV4: Block counts: [] +# FORMATV4: large_numbers: +# FORMATV4: Hash: 0x3fffffffffffffff +# FORMATV4: Counters: 6 +# FORMATV4: Function count: 2305843009213693952 +# FORMATV4: Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936] +# FORMATV4: Functions shown: 3 +# FORMATV4: Total functions: 3 +# FORMATV4: Maximum function count: 2305843009213693952 +# FORMATV4: Maximum internal block count: 1152921504606846976 diff --git a/test/tools/llvm-profdata/general.proftext b/test/tools/llvm-profdata/general.proftext index 5302fce015e8b..6669cd6f12dcc 100644 --- a/test/tools/llvm-profdata/general.proftext +++ b/test/tools/llvm-profdata/general.proftext @@ -1,6 +1,6 @@ +# RUN: llvm-profdata merge -sparse=true %s -o %t.profdata - -# RUN: llvm-profdata merge %s -o %t.profdata +# RUN: llvm-profdata merge -sparse=false %s -o %t.profdata.dense # RUN: llvm-profdata show %t.profdata --function function_count_only --counts | FileCheck %s -check-prefix=FUNC_COUNT_ONLY function_count_only @@ -12,7 +12,8 @@ function_count_only # FUNC_COUNT_ONLY-NEXT: Function count: 97531 # FUNC_COUNT_ONLY-NEXT: Block counts: [] -# RUN: llvm-profdata show %t.profdata --function "name with spaces" --counts | FileCheck %s -check-prefix=SPACES +# RUN: llvm-profdata show %t.profdata.dense --function "name with spaces" --counts | FileCheck %s -check-prefix=SPACES +# RUN: llvm-profdata show %t.profdata --function "name with spaces" --counts | FileCheck %s --check-prefix=SPARSE_SPACES name with spaces 1024 2 @@ -22,6 +23,7 @@ name with spaces # SPACES-NEXT: Counters: 2 # SPACES-NEXT: Function count: 0 # SPACES-NEXT: Block counts: [0] +# SPARSE_SPACES-NOT: Function count: 0 # RUN: llvm-profdata show %t.profdata --function large_numbers --counts | FileCheck %s -check-prefix=LARGENUM large_numbers @@ -38,7 +40,7 @@ large_numbers # LARGENUM-NEXT: Function count: 2305843009213693952 # LARGENUM-NEXT: Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936] -# RUN: llvm-profdata show %t.profdata --function hex_hash | FileCheck %s -check-prefix=HEX-HASH +# RUN: llvm-profdata show %t.profdata.dense --function hex_hash | FileCheck %s -check-prefix=HEX-HASH hex_hash 0x1234 1 @@ -51,14 +53,36 @@ hex_hash # NOSUCHFUNC: Functions shown: 0 # RUN: llvm-profdata show %t.profdata --function _ | FileCheck %s -check-prefix=SOMEFUNCS +# RUN: llvm-profdata show %t.profdata.dense --function _ | FileCheck %s -check-prefix=SOMEFUNCS_DENSE # SOMEFUNCS: Counters: -# SOMEFUNCS: function_count_only: -# SOMEFUNCS: large_numbers: -# SOMEFUNCS: Functions shown: 3 +# SOMEFUNCS-DAG: large_numbers: +# SOMEFUNCS-DAG: function_count_only: +# SOMEFUNCS: Functions shown: 2 +# SOMEFUNCS_DENSE: Functions shown: 3 -# RUN: llvm-profdata show %t.profdata | FileCheck %s -check-prefix=SUMMARY +# RUN: llvm-profdata show %t.profdata.dense | FileCheck %s -check-prefix=SUMMARY # SUMMARY-NOT: Counters: # SUMMARY-NOT: Functions shown: # SUMMARY: Total functions: 4 # SUMMARY: Maximum function count: 2305843009213693952 # SUMMARY: Maximum internal block count: 1152921504606846976 + +# RUN: llvm-profdata show --detailed-summary %t.profdata.dense | FileCheck %s -check-prefix=DETAILED-SUMMARY +# DETAILED-SUMMARY: Detailed summary: +# DETAILED-SUMMARY: Total number of blocks: 10 +# DETAILED-SUMMARY: Total count: 4539628424389557499 +# DETAILED-SUMMARY: 3 blocks with count >= 576460752303423488 account for 80 percentage of the total counts. +# DETAILED-SUMMARY: 4 blocks with count >= 288230376151711744 account for 90 percentage of the total counts. +# DETAILED-SUMMARY: 4 blocks with count >= 288230376151711744 account for 95 percentage of the total counts. +# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99 percentage of the total counts. +# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.9 percentage of the total counts. +# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.99 percentage of the total counts. +# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.999 percentage of the total counts. + +# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-2 +# DETAILED-SUMMARY-2: 2 blocks with count >= 1152921504606846976 account for 60 percentage of the total counts. +# +# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000,900000,999999 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-3 +# DETAILED-SUMMARY-3: 2 blocks with count >= 1152921504606846976 account for 60 percentage of the total counts. +# DETAILED-SUMMARY-3: 4 blocks with count >= 288230376151711744 account for 90 percentage of the total counts. +# DETAILED-SUMMARY-3: 6 blocks with count >= 72057594037927936 account for 99.9999 percentage of the total counts. diff --git a/test/tools/llvm-profdata/input-filenames.test b/test/tools/llvm-profdata/input-filenames.test new file mode 100644 index 0000000000000..da0c47bf82acd --- /dev/null +++ b/test/tools/llvm-profdata/input-filenames.test @@ -0,0 +1,17 @@ +# Create an input file. +RUN: echo '# comment 1' > %t.input +RUN: echo ' # comment 2' >> %t.input +RUN: echo 'bar' >> %t.input +RUN: echo ' baz' >> %t.input +RUN: echo "2,%t.weighted" >> %t.input + +# Create the weighted file, since these actually need to exist. +RUN: echo ' ' > %t.weighted + +RUN: llvm-profdata merge -f %t.input -dump-input-file-list -o /dev/null foo | FileCheck %s +RUN: llvm-profdata merge -input-files %t.input -dump-input-file-list -o /dev/null foo | FileCheck %s + +CHECK: 1,foo +CHECK-NEXT: 1,bar +CHECK-NEXT: 1,baz +CHECK-NEXT: 2,{{.*}}.weighted diff --git a/test/tools/llvm-profdata/multiple-inputs.test b/test/tools/llvm-profdata/multiple-inputs.test index 616efe92bb868..40d11083c0c57 100644 --- a/test/tools/llvm-profdata/multiple-inputs.test +++ b/test/tools/llvm-profdata/multiple-inputs.test @@ -23,29 +23,31 @@ FOO3EMPTY: Maximum function count: 1 FOO3EMPTY: Maximum internal block count: 3 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3bar3-1.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3 -FOO3FOO3BAR3: foo: -FOO3FOO3BAR3: Counters: 3 -FOO3FOO3BAR3: Function count: 3 -FOO3FOO3BAR3: Block counts: [5, 8] -FOO3FOO3BAR3: bar: -FOO3FOO3BAR3: Counters: 3 -FOO3FOO3BAR3: Function count: 7 -FOO3FOO3BAR3: Block counts: [11, 13] +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3 --check-prefix=FOO3FOO3BAR3-1 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3 --check-prefix=FOO3FOO3BAR3-2 +FOO3FOO3BAR3-1: foo: +FOO3FOO3BAR3-1: Counters: 3 +FOO3FOO3BAR3-1: Function count: 3 +FOO3FOO3BAR3-1: Block counts: [5, 8] +FOO3FOO3BAR3-2: bar: +FOO3FOO3BAR3-2: Counters: 3 +FOO3FOO3BAR3-2: Function count: 7 +FOO3FOO3BAR3-2: Block counts: [11, 13] FOO3FOO3BAR3: Total functions: 2 FOO3FOO3BAR3: Maximum function count: 7 FOO3FOO3BAR3: Maximum internal block count: 13 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/bar3-1.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=DISJOINT -DISJOINT: foo: -DISJOINT: Counters: 3 -DISJOINT: Function count: 1 -DISJOINT: Block counts: [2, 3] -DISJOINT: bar: -DISJOINT: Counters: 3 -DISJOINT: Function count: 1 -DISJOINT: Block counts: [2, 3] +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=DISJOINT --check-prefix=DISJOINT-1 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=DISJOINT --check-prefix=DISJOINT-2 +DISJOINT-1: foo: +DISJOINT-1: Counters: 3 +DISJOINT-1: Function count: 1 +DISJOINT-1: Block counts: [2, 3] +DISJOINT-2: bar: +DISJOINT-2: Counters: 3 +DISJOINT-2: Function count: 1 +DISJOINT-2: Block counts: [2, 3] DISJOINT: Total functions: 2 DISJOINT: Maximum function count: 1 DISJOINT: Maximum internal block count: 3 diff --git a/test/tools/llvm-profdata/raw-32-bits-be.test b/test/tools/llvm-profdata/raw-32-bits-be.test index d20c36022fa65..d6e1daa1655cc 100644 --- a/test/tools/llvm-profdata/raw-32-bits-be.test +++ b/test/tools/llvm-profdata/raw-32-bits-be.test @@ -1,36 +1,32 @@ RUN: printf '\377lprofR\201' > %t -RUN: printf '\0\0\0\0\0\0\0\2' >> %t +RUN: printf '\0\0\0\0\0\0\0\4' >> %t RUN: printf '\0\0\0\0\0\0\0\2' >> %t RUN: printf '\0\0\0\0\0\0\0\3' >> %t -RUN: printf '\0\0\0\0\0\0\0\6' >> %t +RUN: printf '\0\0\0\0\0\0\0\20' >> %t RUN: printf '\0\0\0\0\1\0\0\0' >> %t RUN: printf '\0\0\0\0\2\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\3' >> %t -RUN: printf '\0\0\0\1' >> %t +RUN: printf '\134\370\302\114\333\030\275\254' >> %t RUN: printf '\0\0\0\0\0\0\0\1' >> %t -RUN: printf '\2\0\0\0' >> %t RUN: printf '\1\0\0\0' >> %t RUN: printf '\0\0\0\0' >> %t RUN: printf '\0\0\0\0' >> %t +RUN: printf '\0\0\0\1' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\3' >> %t -RUN: printf '\0\0\0\2' >> %t +RUN: printf '\344\023\165\112\031\035\265\067' >> %t RUN: printf '\0\0\0\0\0\0\0\2' >> %t -RUN: printf '\2\0\0\03' >> %t RUN: printf '\1\0\0\10' >> %t RUN: printf '\0\0\0\0' >> %t RUN: printf '\0\0\0\0' >> %t +RUN: printf '\0\0\0\2' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\023' >> %t RUN: printf '\0\0\0\0\0\0\0\067' >> %t RUN: printf '\0\0\0\0\0\0\0\101' >> %t -RUN: printf 'foobar\0\0' >> %t +RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s diff --git a/test/tools/llvm-profdata/raw-32-bits-le.test b/test/tools/llvm-profdata/raw-32-bits-le.test index 1bd81a87fbac5..cd36aafc9ad9e 100644 --- a/test/tools/llvm-profdata/raw-32-bits-le.test +++ b/test/tools/llvm-profdata/raw-32-bits-le.test @@ -1,36 +1,32 @@ RUN: printf '\201Rforpl\377' > %t -RUN: printf '\2\0\0\0\0\0\0\0' >> %t +RUN: printf '\4\0\0\0\0\0\0\0' >> %t RUN: printf '\2\0\0\0\0\0\0\0' >> %t RUN: printf '\3\0\0\0\0\0\0\0' >> %t -RUN: printf '\6\0\0\0\0\0\0\0' >> %t +RUN: printf '\20\0\0\0\0\0\0\0' >> %t RUN: printf '\0\0\0\1\0\0\0\0' >> %t RUN: printf '\0\0\0\2\0\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\3\0\0\0' >> %t -RUN: printf '\1\0\0\0' >> %t +RUN: printf '\254\275\030\333\114\302\370\134' >> %t RUN: printf '\1\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\2' >> %t RUN: printf '\0\0\0\1' >> %t RUN: printf '\0\0\0\0' >> %t RUN: printf '\0\0\0\0' >> %t +RUN: printf '\1\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\3\0\0\0' >> %t -RUN: printf '\2\0\0\0' >> %t +RUN: printf '\067\265\035\031\112\165\023\344' >> %t RUN: printf '\02\0\0\0\0\0\0\0' >> %t -RUN: printf '\03\0\0\2' >> %t RUN: printf '\10\0\0\1' >> %t RUN: printf '\0\0\0\0' >> %t RUN: printf '\0\0\0\0' >> %t +RUN: printf '\2\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t RUN: printf '\023\0\0\0\0\0\0\0' >> %t RUN: printf '\067\0\0\0\0\0\0\0' >> %t RUN: printf '\101\0\0\0\0\0\0\0' >> %t -RUN: printf 'foobar\0\0' >> %t +RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s diff --git a/test/tools/llvm-profdata/raw-64-bits-be.test b/test/tools/llvm-profdata/raw-64-bits-be.test index 902cedd476ab3..75cc84d68862d 100644 --- a/test/tools/llvm-profdata/raw-64-bits-be.test +++ b/test/tools/llvm-profdata/raw-64-bits-be.test @@ -1,36 +1,30 @@ RUN: printf '\377lprofr\201' > %t -RUN: printf '\0\0\0\0\0\0\0\2' >> %t +RUN: printf '\0\0\0\0\0\0\0\4' >> %t RUN: printf '\0\0\0\0\0\0\0\2' >> %t RUN: printf '\0\0\0\0\0\0\0\3' >> %t -RUN: printf '\0\0\0\0\0\0\0\6' >> %t +RUN: printf '\0\0\0\0\0\0\0\20' >> %t RUN: printf '\0\0\0\1\0\4\0\0' >> %t RUN: printf '\0\0\0\2\0\4\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\3' >> %t -RUN: printf '\0\0\0\1' >> %t +RUN: printf '\134\370\302\114\333\030\275\254' >> %t RUN: printf '\0\0\0\0\0\0\0\1' >> %t -RUN: printf '\0\0\0\2\0\4\0\0' >> %t RUN: printf '\0\0\0\1\0\4\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t +RUN: printf '\0\0\0\1\0\0\0\0' >> %t -RUN: printf '\0\0\0\3' >> %t -RUN: printf '\0\0\0\2' >> %t +RUN: printf '\344\023\165\112\031\035\265\067' >> %t RUN: printf '\0\0\0\0\0\0\0\02' >> %t -RUN: printf '\0\0\0\2\0\4\0\03' >> %t RUN: printf '\0\0\0\1\0\4\0\10' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t +RUN: printf '\0\0\0\02\0\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\023' >> %t RUN: printf '\0\0\0\0\0\0\0\067' >> %t RUN: printf '\0\0\0\0\0\0\0\101' >> %t -RUN: printf 'foobar\0\0' >> %t +RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s diff --git a/test/tools/llvm-profdata/raw-64-bits-le.test b/test/tools/llvm-profdata/raw-64-bits-le.test index d2f410a6bb950..d8a9c9a7586c7 100644 --- a/test/tools/llvm-profdata/raw-64-bits-le.test +++ b/test/tools/llvm-profdata/raw-64-bits-le.test @@ -1,36 +1,30 @@ RUN: printf '\201rforpl\377' > %t -RUN: printf '\2\0\0\0\0\0\0\0' >> %t +RUN: printf '\4\0\0\0\0\0\0\0' >> %t RUN: printf '\2\0\0\0\0\0\0\0' >> %t RUN: printf '\3\0\0\0\0\0\0\0' >> %t -RUN: printf '\6\0\0\0\0\0\0\0' >> %t +RUN: printf '\20\0\0\0\0\0\0\0' >> %t RUN: printf '\0\0\4\0\1\0\0\0' >> %t RUN: printf '\0\0\4\0\2\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\3\0\0\0' >> %t -RUN: printf '\1\0\0\0' >> %t +RUN: printf '\254\275\030\333\114\302\370\134' >> %t RUN: printf '\1\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\4\0\2\0\0\0' >> %t RUN: printf '\0\0\4\0\1\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t +RUN: printf '\1\0\0\0\0\0\0\0' >> %t -RUN: printf '\03\0\0\0' >> %t -RUN: printf '\02\0\0\0' >> %t +RUN: printf '\067\265\035\031\112\165\023\344' >> %t RUN: printf '\02\0\0\0\0\0\0\0' >> %t -RUN: printf '\03\0\4\0\2\0\0\0' >> %t RUN: printf '\10\0\4\0\1\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t RUN: printf '\0\0\0\0\0\0\0\0' >> %t -RUN: printf '\0\0\0\0\0\0\0\0' >> %t +RUN: printf '\02\0\0\0\0\0\0\0' >> %t RUN: printf '\023\0\0\0\0\0\0\0' >> %t RUN: printf '\067\0\0\0\0\0\0\0' >> %t RUN: printf '\101\0\0\0\0\0\0\0' >> %t -RUN: printf 'foobar\0\0' >> %t +RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s diff --git a/test/tools/llvm-profdata/raw-two-profiles.test b/test/tools/llvm-profdata/raw-two-profiles.test index 09eb121adf3fe..a377375c1768c 100644 --- a/test/tools/llvm-profdata/raw-two-profiles.test +++ b/test/tools/llvm-profdata/raw-two-profiles.test @@ -1,49 +1,41 @@ RUN: printf '\201rforpl\377' > %t-foo.profraw -RUN: printf '\2\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\4\0\0\0\0\0\0\0' >> %t-foo.profraw RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw -RUN: printf '\3\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\10\0\0\0\0\0\0\0' >> %t-foo.profraw RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw -RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw -RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw -RUN: printf '\3\0\0\0' >> %t-foo.profraw -RUN: printf '\1\0\0\0' >> %t-foo.profraw +RUN: printf '\254\275\030\333\114\302\370\134' >> %t-foo.profraw RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw -RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw -RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw RUN: printf '\023\0\0\0\0\0\0\0' >> %t-foo.profraw -RUN: printf 'foo\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\3\0foo\0\0\0' >> %t-foo.profraw RUN: printf '\201rforpl\377' > %t-bar.profraw -RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\4\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw -RUN: printf '\3\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\10\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw -RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw -RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw -RUN: printf '\3\0\0\0' >> %t-bar.profraw -RUN: printf '\2\0\0\0' >> %t-bar.profraw -RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw -RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw +RUN: printf '\067\265\035\031\112\165\023\344' >> %t-bar.profraw +RUN: printf '\02\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw -RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\02\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\067\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\101\0\0\0\0\0\0\0' >> %t-bar.profraw -RUN: printf 'bar\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\3\0bar\0\0\0' >> %t-bar.profraw RUN: cat %t-foo.profraw %t-bar.profraw > %t-pad.profraw RUN: llvm-profdata show %t-pad.profraw -all-functions -counts | FileCheck %s diff --git a/test/tools/llvm-profdata/value-prof.proftext b/test/tools/llvm-profdata/value-prof.proftext index a8f6e8641c679..75a745664499c 100644 --- a/test/tools/llvm-profdata/value-prof.proftext +++ b/test/tools/llvm-profdata/value-prof.proftext @@ -1,7 +1,7 @@ -# RUN: llvm-profdata show -ic-targets -all-functions %s | FileCheck %s --check-prefix=ICTXT +# RUN: llvm-profdata show -ic-targets -all-functions %s | FileCheck %s --check-prefix=ICTXT --check-prefix=ICSUM # RUN: llvm-profdata show -ic-targets -counts -text -all-functions %s | FileCheck %s --check-prefix=ICTEXT # RUN: llvm-profdata merge -o %t.profdata %s -# RUN: llvm-profdata show -ic-targets -all-functions %t.profdata | FileCheck %s --check-prefix=IC +# RUN: llvm-profdata show -ic-targets -all-functions %t.profdata | FileCheck %s --check-prefix=IC --check-prefix=ICSUM foo # Func Hash: @@ -61,3 +61,9 @@ foo2:20000 #ICTEXT-NEXT: foo2:1000 #ICTEXT-NEXT: 1 #ICTEXT-NEXT: foo2:20000 +# + +#ICSUM: Total Number of Indirect Call Sites : 3 +#ICSUM: Total Number of Sites With Values : 2 +#ICSUM: Total Number of Profiled Values : 3 + diff --git a/test/tools/llvm-profdata/weight-instr.test b/test/tools/llvm-profdata/weight-instr.test index 7294cf3b01f04..927a89647b459 100644 --- a/test/tools/llvm-profdata/weight-instr.test +++ b/test/tools/llvm-profdata/weight-instr.test @@ -2,52 +2,64 @@ Tests for weighted merge of instrumented profiles. 1- Merge the foo and bar profiles with unity weight and verify the combined output RUN: llvm-profdata merge -instr -weighted-input=1,%p/Inputs/weight-instr-bar.profdata -weighted-input=1,%p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show -instr -all-functions %t | FileCheck %s -check-prefix=1X_1X_WEIGHT +RUN: llvm-profdata show -instr -all-functions %t > %t.out1 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-1 < %t.out1 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-2 < %t.out1 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-3 < %t.out1 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-4 < %t.out1 RUN: llvm-profdata merge -instr -weighted-input=1,%p/Inputs/weight-instr-bar.profdata %p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show -instr -all-functions %t | FileCheck %s -check-prefix=1X_1X_WEIGHT +RUN: llvm-profdata show -instr -all-functions %t > %t.out2 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-1 < %t.out2 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-2 < %t.out2 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-3 < %t.out2 +RUN: FileCheck %s -check-prefix=1X_1X_WEIGHT --check-prefix=1X_1X_WEIGHT-4 < %t.out2 1X_1X_WEIGHT: Counters: -1X_1X_WEIGHT-NEXT: usage: -1X_1X_WEIGHT-NEXT: Hash: 0x0000000000000000 -1X_1X_WEIGHT-NEXT: Counters: 1 -1X_1X_WEIGHT-NEXT: Function count: 0 -1X_1X_WEIGHT-NEXT: foo: -1X_1X_WEIGHT-NEXT: Hash: 0x000000000000028a -1X_1X_WEIGHT-NEXT: Counters: 3 -1X_1X_WEIGHT-NEXT: Function count: 866988873 -1X_1X_WEIGHT-NEXT: bar: -1X_1X_WEIGHT-NEXT: Hash: 0x000000000000028a -1X_1X_WEIGHT-NEXT: Counters: 3 -1X_1X_WEIGHT-NEXT: Function count: 866988873 -1X_1X_WEIGHT-NEXT: main: -1X_1X_WEIGHT-NEXT: Hash: 0x7d31c47ea98f8248 -1X_1X_WEIGHT-NEXT: Counters: 60 -1X_1X_WEIGHT-NEXT: Function count: 2 -1X_1X_WEIGHT-NEXT: Functions shown: 4 +1X_1X_WEIGHT-1: usage: +1X_1X_WEIGHT-1: Hash: 0x0000000000000000 +1X_1X_WEIGHT-1: Counters: 1 +1X_1X_WEIGHT-1: Function count: 0 +1X_1X_WEIGHT-2: foo: +1X_1X_WEIGHT-2: Hash: 0x000000000000028a +1X_1X_WEIGHT-2: Counters: 3 +1X_1X_WEIGHT-2: Function count: 866988873 +1X_1X_WEIGHT-3: bar: +1X_1X_WEIGHT-3: Hash: 0x000000000000028a +1X_1X_WEIGHT-3: Counters: 3 +1X_1X_WEIGHT-3: Function count: 866988873 +1X_1X_WEIGHT-4: main: +1X_1X_WEIGHT-4: Hash: 0x7d31c47ea98f8248 +1X_1X_WEIGHT-4: Counters: 60 +1X_1X_WEIGHT-4: Function count: 2 +1X_1X_WEIGHT: Functions shown: 4 1X_1X_WEIGHT-NEXT: Total functions: 4 1X_1X_WEIGHT-NEXT: Maximum function count: 866988873 1X_1X_WEIGHT-NEXT: Maximum internal block count: 267914296 2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output RUN: llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=5,%p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show -instr -all-functions %t | FileCheck %s -check-prefix=3X_5X_WEIGHT +RUN: llvm-profdata show -instr -all-functions %t > %t.out3 +RUN: FileCheck %s -check-prefix=3X_5X_WEIGHT --check-prefix=3X_5X_WEIGHT-1 < %t.out3 +RUN: FileCheck %s -check-prefix=3X_5X_WEIGHT --check-prefix=3X_5X_WEIGHT-2 < %t.out3 +RUN: FileCheck %s -check-prefix=3X_5X_WEIGHT --check-prefix=3X_5X_WEIGHT-3 < %t.out3 +RUN: FileCheck %s -check-prefix=3X_5X_WEIGHT --check-prefix=3X_5X_WEIGHT-4 < %t.out3 3X_5X_WEIGHT: Counters: -3X_5X_WEIGHT-NEXT: usage: -3X_5X_WEIGHT-NEXT: Hash: 0x0000000000000000 -3X_5X_WEIGHT-NEXT: Counters: 1 -3X_5X_WEIGHT-NEXT: Function count: 0 -3X_5X_WEIGHT-NEXT: foo: -3X_5X_WEIGHT-NEXT: Hash: 0x000000000000028a -3X_5X_WEIGHT-NEXT: Counters: 3 -3X_5X_WEIGHT-NEXT: Function count: 4334944365 -3X_5X_WEIGHT-NEXT: bar: -3X_5X_WEIGHT-NEXT: Hash: 0x000000000000028a -3X_5X_WEIGHT-NEXT: Counters: 3 -3X_5X_WEIGHT-NEXT: Function count: 2600966619 -3X_5X_WEIGHT-NEXT: main: -3X_5X_WEIGHT-NEXT: Hash: 0x7d31c47ea98f8248 -3X_5X_WEIGHT-NEXT: Counters: 60 -3X_5X_WEIGHT-NEXT: Function count: 8 -3X_5X_WEIGHT-NEXT: Functions shown: 4 +3X_5X_WEIGHT-1: usage: +3X_5X_WEIGHT-1: Hash: 0x0000000000000000 +3X_5X_WEIGHT-1: Counters: 1 +3X_5X_WEIGHT-1: Function count: 0 +3X_5X_WEIGHT-2: foo: +3X_5X_WEIGHT-2: Hash: 0x000000000000028a +3X_5X_WEIGHT-2: Counters: 3 +3X_5X_WEIGHT-2: Function count: 4334944365 +3X_5X_WEIGHT-3: bar: +3X_5X_WEIGHT-3: Hash: 0x000000000000028a +3X_5X_WEIGHT-3: Counters: 3 +3X_5X_WEIGHT-3: Function count: 2600966619 +3X_5X_WEIGHT-4: main: +3X_5X_WEIGHT-4: Hash: 0x7d31c47ea98f8248 +3X_5X_WEIGHT-4: Counters: 60 +3X_5X_WEIGHT-4: Function count: 8 +3X_5X_WEIGHT: Functions shown: 4 3X_5X_WEIGHT-NEXT: Total functions: 4 3X_5X_WEIGHT-NEXT: Maximum function count: 4334944365 3X_5X_WEIGHT-NEXT: Maximum internal block count: 1339571480 |
