summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-profdata
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-12-14 18:44:01 +0000
committerXinliang David Li <davidxl@google.com>2015-12-14 18:44:01 +0000
commite3bf4fd3943bffb5383d95376cb11e729c4b1669 (patch)
tree53a7b8c7755e28f348b58b89e7a2575b26ddc9d0 /llvm/test/tools/llvm-profdata
parentbbfc7219ef121d345784b0c080a268beb051c736 (diff)
downloadbcm5719-llvm-e3bf4fd3943bffb5383d95376cb11e729c4b1669.tar.gz
bcm5719-llvm-e3bf4fd3943bffb5383d95376cb11e729c4b1669.zip
[PGO] Value profiling text format reader/writer support
This patch adds the missing functionality in parsable text format support for value profiling. Differential Revision: http://reviews.llvm.org/D15212 llvm-svn: 255523
Diffstat (limited to 'llvm/test/tools/llvm-profdata')
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/vp-malform.proftext42
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/vp-malform2.proftext32
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/vp-truncate.proftext36
-rw-r--r--llvm/test/tools/llvm-profdata/text-format-errors.test9
-rw-r--r--llvm/test/tools/llvm-profdata/value-prof.proftext61
5 files changed, 180 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/Inputs/vp-malform.proftext b/llvm/test/tools/llvm-profdata/Inputs/vp-malform.proftext
new file mode 100644
index 00000000000..2db3096cecf
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/vp-malform.proftext
@@ -0,0 +1,42 @@
+foo
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+999000
+359800
+
+foo2
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+1001000
+360200
+
+main
+# Func Hash:
+16650
+# Num Counters:
+4
+# Counter Values:
+2
+2000
+2000000
+999000
+# NumValueKinds
+1
+# Value Kind IPVK_IndirectCallTarget
+0
+# NumSites
+3
+# Values for each site
+0
+2
+# !!!! Malformed Value/Count pair
+foo+100
+foo2:1000
+1
+foo2:20000
diff --git a/llvm/test/tools/llvm-profdata/Inputs/vp-malform2.proftext b/llvm/test/tools/llvm-profdata/Inputs/vp-malform2.proftext
new file mode 100644
index 00000000000..02ed5a968d8
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/vp-malform2.proftext
@@ -0,0 +1,32 @@
+foo
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+999000
+359800
+
+main
+# Func Hash:
+16650
+# Num Counters:
+4
+# Counter Values:
+2
+2000
+2000000
+999000
+# NumValueKinds
+1
+# Value Kind IPVK_IndirectCallTarget
+0
+# NumSites
+3
+# Values for each site
+0
+# !! Malformed value site, missing one value
+2
+foo:100
+1
+foo2:20000
diff --git a/llvm/test/tools/llvm-profdata/Inputs/vp-truncate.proftext b/llvm/test/tools/llvm-profdata/Inputs/vp-truncate.proftext
new file mode 100644
index 00000000000..98b4b572b65
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/vp-truncate.proftext
@@ -0,0 +1,36 @@
+foo
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+999000
+359800
+
+foo2
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+1001000
+360200
+
+main
+# Func Hash:
+16650
+# Num Counters:
+4
+# Counter Values:
+2
+2000
+2000000
+999000
+# NumValueKinds
+1
+# Value Kind IPVK_IndirectCallTarget
+0
+# NumSites
+3
+# Values for each site
+0
diff --git a/llvm/test/tools/llvm-profdata/text-format-errors.test b/llvm/test/tools/llvm-profdata/text-format-errors.test
index c8500bfac76..b300586d102 100644
--- a/llvm/test/tools/llvm-profdata/text-format-errors.test
+++ b/llvm/test/tools/llvm-profdata/text-format-errors.test
@@ -18,3 +18,12 @@ NO-COUNTS: error: {{.*}}no-counts.proftext: Malformed instrumentation profile da
RUN: not llvm-profdata show %p/Inputs/text-format-errors.text.bin 2>&1 | FileCheck %s --check-prefix=BINARY
BINARY: error: {{.+}}: Unrecognized instrumentation profile encoding format
BINARY: Perhaps you forgot to use the -sample option?
+
+5- Detect malformed value profile data
+RUN: not llvm-profdata show %p/Inputs/vp-malform.proftext 2>&1 | FileCheck %s --check-prefix=VP
+RUN: not llvm-profdata show %p/Inputs/vp-malform2.proftext 2>&1 | FileCheck %s --check-prefix=VP
+VP: Malformed instrumentation profile data
+
+6- Detect truncated value profile data
+RUN: not llvm-profdata show %p/Inputs/vp-truncate.proftext 2>&1 | FileCheck %s --check-prefix=VPTRUNC
+VPTRUNC: Truncated profile data
diff --git a/llvm/test/tools/llvm-profdata/value-prof.proftext b/llvm/test/tools/llvm-profdata/value-prof.proftext
new file mode 100644
index 00000000000..effa6d5754a
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/value-prof.proftext
@@ -0,0 +1,61 @@
+# RUN: llvm-profdata show -ic-targets -all-functions %s | FileCheck %s --check-prefix=IC
+# 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
+
+foo
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+999000
+359800
+
+foo2
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+1001000
+360200
+
+main
+# Func Hash:
+16650
+# Num Counters:
+4
+# Counter Values:
+2
+2000
+2000000
+999000
+# NumValueKinds
+1
+# Value Kind IPVK_IndirectCallTarget
+0
+# NumSites
+3
+# Values for each site
+0
+2
+foo:100
+foo2:1000
+1
+foo2:20000
+
+#IC: Indirect Call Site Count: 3
+#IC-NEXT: Indirect Target Results:
+#IC-NEXT: [ 1, foo, 100 ]
+#IC-NEXT: [ 1, foo2, 1000 ]
+#IC-NEXT: [ 2, foo2, 20000 ]
+
+#ICTEXT: foo:100
+#ICTEXT-NEXT: foo2:1000
+#ICTEXT-NEXT: 1
+#ICTEXT-NEXT: foo2:20000
+# RUN: llvm-profdata show -ic-targets -all-functions %s | FileCheck %s --check-prefix=IC
+# 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
OpenPOWER on IntegriCloud