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 = hidden global [1 x i64] zeroinitializer, section ".lprfc", 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 = hidden {{.*}}, section ".lprfd", align 8 28 29 ; ELF: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}__llvm_prf_names" 30 31 define void @foo() { 32 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) 33 ret void 34 } 35 36 declare void @llvm.instrprof.increment(i8*, i64, i32, i32) 37 38 ;; Emit registration functions for platforms that don't find the 39 ;; symbols by their sections. 40 41 ; MACHO-NOT: define internal void @__llvm_profile_register_functions 42 ; LINUX-NOT: define internal void @__llvm_profile_register_functions 43 ; FREEBSD-NOT: define internal void @__llvm_profile_register_functions 44 ; PS4-NOT: define internal void @__llvm_profile_register_functions 45 46 ;; PR38340: When dynamic registration is used, we had a bug where we'd register 47 ;; something that's not a __profd_* variable. 48 49 ; WINDOWS: define internal void @__llvm_profile_register_functions() 50 ; WINDOWS-NOT: __llvm_profile_runtime_user 51 ; WINDOWS: ret void 52 53 ; SOLARIS: define internal void @__llvm_profile_register_functions 54 ; SOLARIS-NOT: __llvm_profile_runtime_user 55 ; SOLARIS: ret void 56 57 ; MACHO-NOT: define internal void @__llvm_profile_init 58 ; LINUX-NOT: define internal void @__llvm_profile_init 59 ; FREEBSD-NOT: define internal void @__llvm_profile_init 60 ; PS4-NOT: define internal void @__llvm_profile_init 61 ; SOLARIS: define internal void @__llvm_profile_init 62 ; WINDOWS: define internal void @__llvm_profile_init 63