1 // Check the value profiling instrinsics emitted by instrumentation.
2
3 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-indirect-call.c %s -o - -emit-llvm -fprofile-instrument=clang -mllvm -enable-value-profiling | FileCheck %s
4
5 void (*foo)(void);
6
main(void)7 int main(void) {
8 // CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8
9 // CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64
10 // CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0)
11 // CHECK-NEXT: call void [[REG1]]()
12 foo();
13 return 0;
14 }
15
16 // CHECK: declare void @__llvm_profile_instrument_target(i64, i8*, i32)
17