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-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s -check-prefix=MACHO 5; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s -check-prefixes=LINUX,ELF 6; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s -check-prefixes=LINUX,ELF 7; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -instrprof -S | FileCheck %s -check-prefixes=FREEBSD,ELF 8; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -passes=instrprof -S | FileCheck %s -check-prefixes=FREEBSD,ELF 9; RUN: opt < %s -mtriple=x86_64-scei-ps4 -instrprof -S | FileCheck %s -check-prefixes=PS4,ELF 10; RUN: opt < %s -mtriple=x86_64-scei-ps4 -passes=instrprof -S | FileCheck %s -check-prefixes=PS4,ELF 11; RUN: opt < %s -mtriple=x86_64-pc-solaris -instrprof -S | FileCheck %s -check-prefixes=SOLARIS,ELF 12; RUN: opt < %s -mtriple=x86_64-pc-solaris -passes=instrprof -S | FileCheck %s -check-prefixes=SOLARIS,ELF 13; RUN: opt < %s -mtriple=x86_64-pc-windows -instrprof -S | FileCheck %s -check-prefix=WINDOWS 14; RUN: opt < %s -mtriple=x86_64-pc-windows -passes=instrprof -S | FileCheck %s -check-prefix=WINDOWS 15 16@__profn_foo = hidden constant [3 x i8] c"foo" 17; MACHO-NOT: __profn_foo 18; ELF-NOT: __profn_foo 19; WINDOWS-NOT: __profn_foo 20 21; MACHO: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 22; ELF: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8 23; WINDOWS: @__profc_foo = internal global [1 x i64] zeroinitializer, section ".lprfc$M", align 8 24 25; MACHO: @__profd_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 26; ELF: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8 27; WINDOWS: @__profd_foo = internal global {{.*}}, section ".lprfd$M", align 8 28 29; ELF: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}__llvm_prf_names", align 1 30; WINDOWS: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}lprfn$M", align 1 31 32define void @foo() { 33 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) 34 ret void 35} 36 37declare void @llvm.instrprof.increment(i8*, i64, i32, i32) 38 39;; Emit registration functions for platforms that don't find the 40;; symbols by their sections. 41 42; MACHO-NOT: define internal void @__llvm_profile_register_functions 43; LINUX-NOT: define internal void @__llvm_profile_register_functions 44; FREEBSD-NOT: define internal void @__llvm_profile_register_functions 45; SOLARIS-NOT: define internal void @__llvm_profile_register_functions 46; PS4-NOT: define internal void @__llvm_profile_register_functions 47; WINDOWS-NOT: define internal void @__llvm_profile_register_functions 48 49;; PR38340: When dynamic registration is used, we had a bug where we'd register 50;; something that's not a __profd_* variable. 51 52; MACHO-NOT: define internal void @__llvm_profile_init 53; LINUX-NOT: define internal void @__llvm_profile_init 54; FREEBSD-NOT: define internal void @__llvm_profile_init 55; SOLARIS-NOT: define internal void @__llvm_profile_init 56; PS4-NOT: define internal void @__llvm_profile_init 57; WINDOWS-NOT: define internal void @__llvm_profile_init 58