summaryrefslogtreecommitdiff
path: root/test/profile/instrprof-basic.c
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-31 22:45:37 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-31 22:45:37 +0000
commita393c329b18213be8bfa9312785b415e4b017337 (patch)
treedc6718319bd8b651415674a8fb30eed1898c13d3 /test/profile/instrprof-basic.c
parente1610ce7f8b49c4c4bc5d1992a9dbf9fbdc1a516 (diff)
InstrProf: Add simple compiler-rt test
Add the test infrastructure for testing lib/profile and a single test. This initial commit only enables the tests on Darwin, but they'll be enabled on Linux soon after. <rdar://problem/16458307> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205256 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/profile/instrprof-basic.c')
-rw-r--r--test/profile/instrprof-basic.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/profile/instrprof-basic.c b/test/profile/instrprof-basic.c
new file mode 100644
index 000000000..0732d84df
--- /dev/null
+++ b/test/profile/instrprof-basic.c
@@ -0,0 +1,12 @@
+// RUN: %clang_profgen -o %t -O3 -flto %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %t
+// RUN: llvm-profdata merge -o %t.profdata %t.profraw
+// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
+
+int main(int argc, const char *argv[]) {
+ // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+ if (argc)
+ return 0;
+ return 1;
+}
+// CHECK: !1 = metadata !{metadata !"branch_weights", i32 2, i32 1}