1; RUN: opt < %s -instrprof -S | FileCheck %s 2; RUN: opt < %s -passes=instrprof -S | FileCheck %s 3 4target triple = "x86_64-apple-macosx10.10.0" 5 6; CHECK: @__llvm_profile_runtime = external global i32 7 8@__profn_foo = hidden constant [3 x i8] c"foo" 9; CHECK-NOT: __profn_foo 10@__profn_bar = hidden constant [4 x i8] c"bar\00" 11; CHECK-NOT: __profn_bar 12@__profn_baz = hidden constant [3 x i8] c"baz" 13; CHECK-NOT: __profn_baz 14 15; CHECK: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 16; CHECK: @__profd_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 17define void @foo() { 18 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0) 19 ret void 20} 21 22; CHECK: @__profc_bar = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 23; CHECK: @__profd_bar = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 24define void @bar() { 25 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__profn_bar, i32 0, i32 0), i64 0, i32 1, i32 0) 26 ret void 27} 28 29; CHECK: @__profc_baz = hidden global [3 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 30; CHECK: @__profd_baz = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 31define void @baz() { 32 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_baz, i32 0, i32 0), i64 0, i32 3, i32 0) 33 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_baz, i32 0, i32 0), i64 0, i32 3, i32 1) 34 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_baz, i32 0, i32 0), i64 0, i32 3, i32 2) 35 ret void 36} 37 38declare void @llvm.instrprof.increment(i8*, i64, i32, i32) 39 40; CHECK: @llvm.used = appending global {{.*}} @__profd_foo {{.*}} @__profd_bar {{.*}} @__profd_baz {{.*}} section "llvm.metadata" 41