xref: /aosp_15_r20/external/llvm/test/Instrumentation/InstrProfiling/platform.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker;; Checks for platform specific section names and initialization code.
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s -check-prefix=MACHO
4*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s -check-prefix=MACHO
5*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s -check-prefix=LINUX
6*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s -check-prefix=LINUX
7*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -instrprof -S | FileCheck %s -check-prefix=FREEBSD
8*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -passes=instrprof -S | FileCheck %s -check-prefix=FREEBSD
9*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-scei-ps4 -instrprof -S | FileCheck %s -check-prefix=PS4
10*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-scei-ps4 -passes=instrprof -S | FileCheck %s -check-prefix=PS4
11*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-pc-solaris -instrprof -S | FileCheck %s -check-prefix=SOLARIS
12*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-pc-solaris -passes=instrprof -S | FileCheck %s -check-prefix=SOLARIS
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker@__profn_foo = hidden constant [3 x i8] c"foo"
15*9880d681SAndroid Build Coastguard Worker; MACHO: @__profn_foo = private constant [3 x i8] c"foo"
16*9880d681SAndroid Build Coastguard Worker; ELF: @__profn_foo = private constant [3 x i8] c"foo"
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; MACHO: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
19*9880d681SAndroid Build Coastguard Worker; ELF: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker; MACHO: @__profd_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8
22*9880d681SAndroid Build Coastguard Worker; LINUX: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
23*9880d681SAndroid Build Coastguard Worker; FREEBSD: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
24*9880d681SAndroid Build Coastguard Worker; PS4: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
25*9880d681SAndroid Build Coastguard Worker; SOLARIS: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; ELF: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}__llvm_prf_names"
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdefine void @foo() {
30*9880d681SAndroid Build Coastguard Worker  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)
31*9880d681SAndroid Build Coastguard Worker  ret void
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.instrprof.increment(i8*, i64, i32, i32)
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker;; Emit registration functions for platforms that don't find the
37*9880d681SAndroid Build Coastguard Worker;; symbols by their sections.
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; MACHO-NOT: define internal void @__llvm_profile_register_functions
40*9880d681SAndroid Build Coastguard Worker; LINUX-NOT: define internal void @__llvm_profile_register_functions
41*9880d681SAndroid Build Coastguard Worker; FREEBSD-NOT: define internal void @__llvm_profile_register_functions
42*9880d681SAndroid Build Coastguard Worker; PS4-NOT: define internal void @__llvm_profile_register_functions
43*9880d681SAndroid Build Coastguard Worker; SOLARIS: define internal void @__llvm_profile_register_functions
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker; MACHO-NOT: define internal void @__llvm_profile_init
46*9880d681SAndroid Build Coastguard Worker; LINUX-NOT: define internal void @__llvm_profile_init
47*9880d681SAndroid Build Coastguard Worker; FREEBSD-NOT: define internal void @__llvm_profile_init
48*9880d681SAndroid Build Coastguard Worker; PS4-NOT: define internal void @__llvm_profile_init
49*9880d681SAndroid Build Coastguard Worker; SOLARIS: define internal void @__llvm_profile_init
50