summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-profdata
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2019-03-06 19:31:37 +0000
committerRong Xu <xur@google.com>2019-03-06 19:31:37 +0000
commit05c0afe842cfd54eca4aa870c345bd53e8ce20ce (patch)
treeea06fedef9a8750bc677076324f0e5adbcb66ba7 /llvm/test/tools/llvm-profdata
parent9549f7560f67c3a4c8319474455116ca68906fb8 (diff)
downloadbcm5719-llvm-05c0afe842cfd54eca4aa870c345bd53e8ce20ce.tar.gz
bcm5719-llvm-05c0afe842cfd54eca4aa870c345bd53e8ce20ce.zip
[PGO] Context sensitive PGO (part 4)
Part 4 of CSPGO changes: (1) add support in cmake for cspgo build. (2) fix an issue in big endian. (3) test cases. Differential Revision: https://reviews.llvm.org/D54175 llvm-svn: 355541
Diffstat (limited to 'llvm/test/tools/llvm-profdata')
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/CSIR_profile.proftext11
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/cs.proftext10
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/noncs.proftext11
-rw-r--r--llvm/test/tools/llvm-profdata/csprof-dump.test31
4 files changed, 63 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/Inputs/CSIR_profile.proftext b/llvm/test/tools/llvm-profdata/Inputs/CSIR_profile.proftext
new file mode 100644
index 00000000000..0881a532a22
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/CSIR_profile.proftext
@@ -0,0 +1,11 @@
+# CSIR level Instrumentation Flag
+:csir
+bar
+# Func Hash:
+1152921534274394772
+# Num Counters:
+2
+# Counter Values:
+99938
+62
+
diff --git a/llvm/test/tools/llvm-profdata/Inputs/cs.proftext b/llvm/test/tools/llvm-profdata/Inputs/cs.proftext
new file mode 100644
index 00000000000..99e1825b036
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/cs.proftext
@@ -0,0 +1,10 @@
+# CSIR level Instrumentation Flag
+:csir
+bar
+# Func Hash:
+1152921534274394772
+# Num Counters:
+2
+# Counter Values:
+99938
+62
diff --git a/llvm/test/tools/llvm-profdata/Inputs/noncs.proftext b/llvm/test/tools/llvm-profdata/Inputs/noncs.proftext
new file mode 100644
index 00000000000..d1d58fdc98e
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/Inputs/noncs.proftext
@@ -0,0 +1,11 @@
+# IR level Instrumentation Flag
+:ir
+bar
+# Func Hash:
+29667547796
+# Num Counters:
+2
+# Counter Values:
+99938
+62
+
diff --git a/llvm/test/tools/llvm-profdata/csprof-dump.test b/llvm/test/tools/llvm-profdata/csprof-dump.test
new file mode 100644
index 00000000000..39643dc38f2
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/csprof-dump.test
@@ -0,0 +1,31 @@
+Basic test for option -showcs:
+RUN: llvm-profdata show %p/Inputs/cs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY
+RUN: llvm-profdata show %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=SUMMARY
+RUN: llvm-profdata show -showcs %p/Inputs/cs.proftext | FileCheck %s -check-prefix=SUMMARY
+RUN: llvm-profdata show -showcs %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY
+ZEROSUMMARY: Instrumentation level: IR
+ZEROSUMMARY: Total functions: 0
+ZEROSUMMARY: Maximum function count: 0
+ZEROSUMMARY: Maximum internal block count: 0
+SUMMARY: Instrumentation level: IR
+SUMMARY: Total functions: 1
+SUMMARY: Maximum function count: 99938
+SUMMARY: Maximum internal block count: 62
+
+Basic tests for context sensitive profile dump functions:
+RUN: llvm-profdata merge -o %t-combined.profdata %p/Inputs/cs.proftext %p/Inputs/noncs.proftext
+
+RUN: llvm-profdata show --all-functions -counts -showcs %p/Inputs/cs.proftext > %t-text.csdump
+RUN: llvm-profdata show --all-functions -counts -showcs %t-combined.profdata > %t-index.csdump
+RUN: diff %t-text.csdump %t-index.csdump
+
+RUN: llvm-profdata show --all-functions -counts %p/Inputs/noncs.proftext > %t-text.noncsdump
+RUN: llvm-profdata show --all-functions -counts %t-combined.profdata > %t-index.noncsdump
+RUN: diff %t-text.noncsdump %t-index.noncsdump
+
+Roundtrip test:
+
+RUN: llvm-profdata merge -o %t.0.profdata %S/Inputs/CSIR_profile.proftext
+RUN: llvm-profdata merge -text -o %t.0.proftext %t.0.profdata
+RUN: diff %t.0.proftext %S/Inputs/CSIR_profile.proftext
+
OpenPOWER on IntegriCloud