summaryrefslogtreecommitdiff
path: root/test/Profile/func-entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Profile/func-entry.c')
-rw-r--r--test/Profile/func-entry.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Profile/func-entry.c b/test/Profile/func-entry.c
new file mode 100644
index 000000000000..32c20a2a458e
--- /dev/null
+++ b/test/Profile/func-entry.c
@@ -0,0 +1,19 @@
+// Test that function entry counts are set correctly.
+
+// RUN: llvm-profdata merge %S/Inputs/func-entry.proftext -o %t.profdata
+// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s
+
+void foo(void);
+
+// CHECK: @foo() #0 !prof [[FOO:![0-9]+]]
+void foo() { return; }
+
+// CHECK: @main() #1 !prof [[MAIN:![0-9]+]]
+int main() {
+ int i;
+ for (i = 0; i < 10000; i++) foo();
+ return 0;
+}
+
+// CHECK: [[FOO]] = !{!"function_entry_count", i64 1000}
+// CHECK: [[MAIN]] = !{!"function_entry_count", i64 1}