[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / Instrumentation / InstrProfiling / icall-nocomdat.ll
blob912d39a71ebca2574de1190aa5cc14e20a002702
1 ;; Check that static counters are allocated for value profiler
3 ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -vp-static-alloc=true -instrprof -S | FileCheck %s --check-prefix=STATIC
4 ; RUN: opt < %s -mtriple=powerpc-ibm-aix-xcoff -instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN
5 ; RUN: opt < %s -mtriple=powerpc64-ibm-aix-xcoff -instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN
7 @__profn_foo = private constant [3 x i8] c"foo"
8 @__profn_bar = private constant [3 x i8] c"bar"
10 define i32 @foo(i32 ()* ) {
11   call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12884901887, i32 1, i32 0)
12   %2 = ptrtoint i32 ()* %0 to i64
13   call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12884901887, i64 %2, i32 0, i32 0)
14   %3 = tail call i32 %0()
15   ret i32 %3
18 ; Function Attrs: nounwind
19 declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0
21 ; Function Attrs: nounwind
22 declare void @llvm.instrprof.value.profile(i8*, i64, i64, i32, i32) #0
24 attributes #0 = { nounwind }
26 ; STATIC: @__profvp_foo = private global [1 x i64] zeroinitializer, section "{{[^"]+}}"
27 ; STATIC: @__llvm_prf_vnodes
29 ; DYN-NOT: @__profvp_foo
30 ; DYN-NOT: @__llvm_prf_vnodes
32 ;; __llvm_prf_vnodes and __llvm_prf_nm are not referenced by other metadata sections.
33 ;; We have to conservatively place them in llvm.used.
34 ; STATIC:      @llvm.used = appending global
35 ; STATIC-SAME:   @__llvm_prf_vnodes
36 ; STATIC-SAME:   @__llvm_prf_nm
38 ; STATIC: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 0)
39 ; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 zeroext 0)
40 ; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 signext 0)
42 ; STATIC: declare void @__llvm_profile_instrument_target(i64, i8*, i32)
43 ; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 zeroext)
44 ; STATIC-SEXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 signext)