summaryrefslogtreecommitdiff
path: root/test/Profile
diff options
context:
space:
mode:
authorBetul Buyukkurt <betulb@codeaurora.org>2016-01-23 22:50:44 +0000
committerBetul Buyukkurt <betulb@codeaurora.org>2016-01-23 22:50:44 +0000
commit7ff19db5823c50764fa377576e64f973c94f47f4 (patch)
tree1f2f38e46cb455686080dc7846fa475291543a04 /test/Profile
parent5496a8c53db4003c03e7e1341e4ec9b67e54563a (diff)
Clang changes for value profiling
Differential Revision: http://reviews.llvm.org/D8940 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Profile')
-rw-r--r--test/Profile/c-indirect-call.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Profile/c-indirect-call.c b/test/Profile/c-indirect-call.c
new file mode 100644
index 0000000000..0d8f3babdb
--- /dev/null
+++ b/test/Profile/c-indirect-call.c
@@ -0,0 +1,15 @@
+// Check the data structures emitted by instrumentation.
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instr-generate -mllvm -enable-value-profiling | FileCheck %s
+
+void (*foo)(void);
+
+int main(void) {
+// CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8
+// CHECK-NEXT: call void [[REG1]]()
+// CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64
+// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({ i32, i32, i64, i8*, i64*, i8*, i8*, [1 x i16] }* @__profd_main to i8*), i32 0)
+ foo();
+ return 0;
+}
+
+// CHECK: declare void @__llvm_profile_instrument_target(i64, i8*, i32)