summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2015-10-08 19:40:37 +0000
committerDiego Novillo <dnovillo@google.com>2015-10-08 19:40:37 +0000
commitaae1ed8e08236a8f99b8fca690db7f954f15c031 (patch)
tree944a813f18347274fde4a275a166ddf5d346c730 /llvm/test
parenteb84ce8bd17f7b2516a15aca7d37a768f0cf10f6 (diff)
downloadbcm5719-llvm-aae1ed8e08236a8f99b8fca690db7f954f15c031.tar.gz
bcm5719-llvm-aae1ed8e08236a8f99b8fca690db7f954f15c031.zip
Re-apply r249644: Handle inline stacks in gcov-encoded sample profiles.
This fixes memory allocation problems by making the merge operation keep the profile readers around until the merged profile has been emitted. This is needed to prevent the inlined function names to disappear from the function profiles. Since all the names are kept as references, once the reader disappears, the names are also deallocated. Additionally, XFAIL on big-endian architectures. The test case uses a gcov file generated on a little-endian system. llvm-svn: 249724
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/gcc-sample-profile.gcovbin0 -> 1960 bytes
-rw-r--r--llvm/test/tools/llvm-profdata/gcc-gcov-sample-profile.test29
2 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/Inputs/gcc-sample-profile.gcov b/llvm/test/tools/llvm-profdata/Inputs/gcc-sample-profile.gcov
new file mode 100644
index 00000000000..0099280af2f
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/gcc-sample-profile.gcov
Binary files differ
diff --git a/llvm/test/tools/llvm-profdata/gcc-gcov-sample-profile.test b/llvm/test/tools/llvm-profdata/gcc-gcov-sample-profile.test
new file mode 100644
index 00000000000..723d547555b
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/gcc-gcov-sample-profile.test
@@ -0,0 +1,29 @@
+The input gcov file has been generated on a little endian machine. Expect
+failures on big endian systems.
+
+XFAIL: powerpc64-, s390x, mips-, mips64-, sparc
+
+Tests for sample profiles encoded in GCC's gcov format.
+
+1- Show all functions. This profile has a single main() function with several
+ inlined callees.
+RUN: llvm-profdata show --sample %p/Inputs/gcc-sample-profile.gcov | FileCheck %s --check-prefix=SHOW1
+SHOW1: Function: main: 364084, 0, 6 sampled lines
+SHOW1: line offset: 2, discriminator: 3, inlined callee: _Z3fool: 243786, 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: 98558, 0, 2 sampled lines
+
+2- Convert the profile to text encoding and check that they are both
+ identical.
+RUN: llvm-profdata merge --sample %p/Inputs/gcc-sample-profile.gcov --text -o - | llvm-profdata show --sample - -o %t-text
+RUN: llvm-profdata show --sample %p/Inputs/gcc-sample-profile.gcov -o %t-gcov
+RUN: diff %t-text %t-gcov
+
+4- Merge the gcov and text encodings of the profile and check that the
+ counters have doubled.
+RUN: llvm-profdata merge --sample --text %p/Inputs/gcc-sample-profile.gcov -o %t-gcov
+RUN: llvm-profdata merge --sample --text %p/Inputs/gcc-sample-profile.gcov %t-gcov -o - | FileCheck %s --check-prefix=MERGE1
+MERGE1: main:728168:0
+MERGE1: 2.3: 120298
+MERGE1: 2.3: _Z3fool:487572
OpenPOWER on IntegriCloud