summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2015-10-09 17:54:24 +0000
committerDiego Novillo <dnovillo@google.com>2015-10-09 17:54:24 +0000
commita7f1e8ef830e2b8e17fc9eee67ed2454ab9b5041 (patch)
tree3d160022dd8aeee9e681c995350148945de5bfa1 /llvm/test
parent26c6e641591a0f93746038f938ecb00e600ddf1d (diff)
downloadbcm5719-llvm-a7f1e8ef830e2b8e17fc9eee67ed2454ab9b5041.tar.gz
bcm5719-llvm-a7f1e8ef830e2b8e17fc9eee67ed2454ab9b5041.zip
Add inline stack streaming to binary sample profiles.
With this patch we can now read and write inline stacks in sample profiles to the binary encoded profiles. In a subsequent patch, I will add a string table to the binary encoding. Right now function names are emitted as strings every time we find them. This is too bloated and will produce large files in applications with lots of inlining. llvm-svn: 249861
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/SampleProfile/Inputs/fnptr.binprofbin112 -> 115 bytes
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/inline-samples.afdo20
-rw-r--r--llvm/test/tools/llvm-profdata/inline-samples.test30
3 files changed, 50 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/fnptr.binprof b/llvm/test/Transforms/SampleProfile/Inputs/fnptr.binprof
index 14d7fd555da..8cbe646c16e 100644
--- a/llvm/test/Transforms/SampleProfile/Inputs/fnptr.binprof
+++ b/llvm/test/Transforms/SampleProfile/Inputs/fnptr.binprof
Binary files differ
diff --git a/llvm/test/tools/llvm-profdata/Inputs/inline-samples.afdo b/llvm/test/tools/llvm-profdata/Inputs/inline-samples.afdo
new file mode 100644
index 00000000000..f8680d86fcb
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/inline-samples.afdo
@@ -0,0 +1,20 @@
+main:366846:0
+ 2.1: 60401
+ 4: 0
+ 3: 0
+ 0: 0
+ 2.3: 60401
+ 1: 0
+ 2.3: _Z3fool:246044
+ 1.2: 39280
+ 1.4: 46871
+ 1: 60401
+ 1.3: _Z3bari:0
+ 1.2: 0
+ 1.1: 0
+ 1.8: _Z3bari:0
+ 1.2: 0
+ 1.1: 0
+ 1.7: _Z3bari:99492
+ 1.2: 46732
+ 1.1: 52760
diff --git a/llvm/test/tools/llvm-profdata/inline-samples.test b/llvm/test/tools/llvm-profdata/inline-samples.test
new file mode 100644
index 00000000000..b16ac488234
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/inline-samples.test
@@ -0,0 +1,30 @@
+Tests for conversion between text and binary encoded sample profiles.
+
+1- Encode the original profile into binary form. All the tests below will use
+ the binary profile.
+RUN: llvm-profdata merge --sample %p/Inputs/inline-samples.afdo -o %t.profbin
+
+2- Show all functions. This profile has a single main() function with several
+ inlined callees.
+RUN: llvm-profdata show --sample %t.profbin | FileCheck %s --check-prefix=SHOW1
+SHOW1: Function: main: 366846, 0, 6 sampled lines
+SHOW1: line offset: 2, discriminator: 3, inlined callee: _Z3fool: 246044, 0, 3 sampled lines
+SHOW1: line offset: 1, discriminator: 3, inlined callee: _Z3bari: 0, 0, 2 sampled lines
+SHOW1: line offset: 1, discriminator: 8, inlined callee: _Z3bari: 0, 0, 2 sampled lines
+SHOW1: line offset: 1, discriminator: 7, inlined callee: _Z3bari: 99492, 0, 2 sampled lines
+SHOW1: line offset: 1, discriminator: 2, number of samples: 46732
+
+3- Convert the binary profile to text encoding and check that they are both
+ identical.
+RUN: llvm-profdata merge --sample %t.profbin --text -o - | llvm-profdata show --sample - -o %t-bintext
+RUN: llvm-profdata show --sample %p/Inputs/inline-samples.afdo -o %t-text
+RUN: diff %t-bintext %t-text
+
+4- Merge the binary and text encodings of the profile and check that the
+ counters have doubled.
+RUN: llvm-profdata merge --sample --text %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
+MERGE1: main:733692:0
+MERGE1: 2.3: 120802
+MERGE1: 2.3: _Z3fool:492088
+MERGE1: 1.7: _Z3bari:198984
+MERGE1: 1.1: 105520
OpenPOWER on IntegriCloud