Home | History | Annotate | Download | only in InstrProfiling
      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-prefix=LINUX
      6 ; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s -check-prefix=LINUX
      7 ; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -instrprof -S | FileCheck %s -check-prefix=FREEBSD
      8 ; RUN: opt < %s -mtriple=x86_64-unknown-freebsd -passes=instrprof -S | FileCheck %s -check-prefix=FREEBSD
      9 ; RUN: opt < %s -mtriple=x86_64-scei-ps4 -instrprof -S | FileCheck %s -check-prefix=PS4
     10 ; RUN: opt < %s -mtriple=x86_64-scei-ps4 -passes=instrprof -S | FileCheck %s -check-prefix=PS4
     11 ; RUN: opt < %s -mtriple=x86_64-pc-solaris -instrprof -S | FileCheck %s -check-prefix=SOLARIS
     12 ; RUN: opt < %s -mtriple=x86_64-pc-solaris -passes=instrprof -S | FileCheck %s -check-prefix=SOLARIS
     13 
     14 @__profn_foo = hidden constant [3 x i8] c"foo"
     15 ; MACHO: @__profn_foo = private constant [3 x i8] c"foo"
     16 ; ELF: @__profn_foo = private constant [3 x i8] c"foo"
     17 
     18 ; MACHO: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
     19 ; ELF: @__profc_foo = hidden global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
     20 
     21 ; MACHO: @__profd_foo = hidden {{.*}}, section "__DATA,__llvm_prf_data", align 8
     22 ; LINUX: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
     23 ; FREEBSD: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
     24 ; PS4: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
     25 ; SOLARIS: @__profd_foo = hidden {{.*}}, section "__llvm_prf_data", align 8
     26 
     27 ; ELF: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}__llvm_prf_names"
     28 
     29 define void @foo() {
     30   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   ret void
     32 }
     33 
     34 declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
     35 
     36 ;; Emit registration functions for platforms that don't find the
     37 ;; symbols by their sections.
     38 
     39 ; MACHO-NOT: define internal void @__llvm_profile_register_functions
     40 ; LINUX-NOT: define internal void @__llvm_profile_register_functions
     41 ; FREEBSD-NOT: define internal void @__llvm_profile_register_functions
     42 ; PS4-NOT: define internal void @__llvm_profile_register_functions
     43 ; SOLARIS: define internal void @__llvm_profile_register_functions
     44 
     45 ; MACHO-NOT: define internal void @__llvm_profile_init
     46 ; LINUX-NOT: define internal void @__llvm_profile_init
     47 ; FREEBSD-NOT: define internal void @__llvm_profile_init
     48 ; PS4-NOT: define internal void @__llvm_profile_init
     49 ; SOLARIS: define internal void @__llvm_profile_init
     50