1;; Checks for platform specific section names and initialization code.
2
3; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s -check-prefix=MACHO
4; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s -check-prefix=ELF
5
6@__llvm_profile_name_foo = hidden constant [3 x i8] c"foo"
7; MACHO: @__llvm_profile_name_foo = hidden constant [3 x i8] c"foo", section "__DATA,__llvm_prf_names", align 1
8; ELF: @__llvm_profile_name_foo = hidden constant [3 x i8] c"foo", section "__llvm_prf_names", align 1
9
10; MACHO: @__llvm_profile_counters_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
11; ELF: @__llvm_profile_counters_foo = hidden global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
12
13; MACHO: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__DATA,__llvm_prf_data", align 8
14; ELF: @__llvm_profile_data_foo = hidden constant {{.*}}, section "__llvm_prf_data", align 8
15define void @foo() {
16  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64 0, i32 1, i32 0)
17  ret void
18}
19
20declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
21
22;; Emit registration functions for platforms that don't find the
23;; symbols by their sections.
24
25; MACHO-NOT: define internal void @__llvm_profile_register_functions
26; ELF: define internal void @__llvm_profile_register_functions
27
28; MACHO-NOT: define internal void @__llvm_profile_init
29; ELF: define internal void @__llvm_profile_init
30