• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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@__profn_foo = hidden constant [3 x i8] c"foo"
7; CHECK: @__profn_foo = private constant [3 x i8] c"foo"
8@__profn_bar = hidden constant [4 x i8] c"bar\00"
9; CHECK: @__profn_bar = private constant [4 x i8] c"bar\00"
10@__profn_baz = hidden constant [3 x i8] c"baz"
11; CHECK: @__profn_baz = private constant [3 x i8] c"baz"
12
13; CHECK: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
14; CHECK: @__profd_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8
15define void @foo() {
16  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)
17  ret void
18}
19
20; CHECK: @__profc_bar = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
21; CHECK: @__profd_bar = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8
22define void @bar() {
23  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)
24  ret void
25}
26
27; CHECK: @__profc_baz = hidden global [3 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
28; CHECK: @__profd_baz = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8
29define void @baz() {
30  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)
31  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)
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 2)
33  ret void
34}
35
36declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
37
38; CHECK: @__llvm_profile_runtime = external global i32
39; CHECK: @llvm.used = appending global {{.*}} @__profd_foo {{.*}} @__profd_bar {{.*}} @__profd_baz {{.*}} section "llvm.metadata"
40