2014-12-09 02:02:35 +08:00
|
|
|
; RUN: opt < %s -instrprof -S | FileCheck %s
|
2016-04-19 01:47:38 +08:00
|
|
|
; RUN: opt < %s -passes=instrprof -S | FileCheck %s
|
2014-12-09 02:02:35 +08:00
|
|
|
|
|
|
|
target triple = "x86_64-apple-macosx10.10.0"
|
|
|
|
|
2015-12-15 08:32:56 +08:00
|
|
|
@__profn_foo = hidden constant [3 x i8] c"foo"
|
2017-02-15 04:03:48 +08:00
|
|
|
; CHECK-NOT: __profn_foo
|
2015-12-15 08:32:56 +08:00
|
|
|
@__profn_bar = hidden constant [4 x i8] c"bar\00"
|
2017-02-15 04:03:48 +08:00
|
|
|
; CHECK-NOT: __profn_bar
|
2015-12-15 08:32:56 +08:00
|
|
|
@__profn_baz = hidden constant [3 x i8] c"baz"
|
2017-02-15 04:03:48 +08:00
|
|
|
; CHECK-NOT: __profn_baz
|
2014-12-09 02:02:35 +08:00
|
|
|
|
2015-12-15 08:32:56 +08:00
|
|
|
; CHECK: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
|
2016-10-12 05:48:16 +08:00
|
|
|
; CHECK: @__profd_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8
|
2014-12-09 02:02:35 +08:00
|
|
|
define void @foo() {
|
2015-12-15 08:32:56 +08:00
|
|
|
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)
|
2014-12-09 02:02:35 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-12-15 08:32:56 +08:00
|
|
|
; CHECK: @__profc_bar = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
|
2016-10-12 05:48:16 +08:00
|
|
|
; CHECK: @__profd_bar = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8
|
2014-12-09 02:02:35 +08:00
|
|
|
define void @bar() {
|
2015-12-15 08:32:56 +08:00
|
|
|
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)
|
2014-12-09 02:02:35 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-12-15 08:32:56 +08:00
|
|
|
; CHECK: @__profc_baz = hidden global [3 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
|
2016-10-12 05:48:16 +08:00
|
|
|
; CHECK: @__profd_baz = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8
|
2014-12-09 02:02:35 +08:00
|
|
|
define void @baz() {
|
2015-12-15 08:32:56 +08:00
|
|
|
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)
|
|
|
|
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)
|
|
|
|
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)
|
2014-12-09 02:02:35 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
|
|
|
|
|
|
|
|
; CHECK: @__llvm_profile_runtime = external global i32
|
2015-12-15 08:32:56 +08:00
|
|
|
; CHECK: @llvm.used = appending global {{.*}} @__profd_foo {{.*}} @__profd_bar {{.*}} @__profd_baz {{.*}} section "llvm.metadata"
|