summaryrefslogtreecommitdiff
path: root/test/profile/infinite_loop.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:11:54 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:11:54 +0000
commitcdf4f3055e964bb585f294cf77cb549ead82783f (patch)
tree7bceeca766b3fbe491245bc926a083f78c35d1de /test/profile/infinite_loop.c
parent625108084a3ec7c19c7745004c5af0ed7aa417a9 (diff)
Notes
Diffstat (limited to 'test/profile/infinite_loop.c')
-rw-r--r--test/profile/infinite_loop.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/profile/infinite_loop.c b/test/profile/infinite_loop.c
new file mode 100644
index 0000000000000..0e3981c712f6b
--- /dev/null
+++ b/test/profile/infinite_loop.c
@@ -0,0 +1,30 @@
+// RUN: %clang_pgogen -O2 -o %t %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s
+
+void exit(int);
+int g;
+__attribute__((noinline)) void foo()
+{
+ g++;
+ if (g==1000)
+ exit(0);
+}
+
+
+int main()
+{
+ while (1) {
+ foo();
+ }
+
+}
+
+// CHECK: Counters:
+// CHECK-NEXT: main:
+// CHECK-NEXT: Hash: {{.*}}
+// CHECK-NEXT: Counters: 2
+// CHECK-NEXT: Block counts: [1000, 1]
+
+
+