1;; Check that static counters are allocated for value profiler 2 3; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -vp-static-alloc=true -passes=instrprof -S | FileCheck %s --check-prefix=STATIC 4; RUN: opt < %s -mtriple=powerpc-ibm-aix-xcoff -passes=instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN 5; RUN: opt < %s -mtriple=powerpc64-ibm-aix-xcoff -passes=instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN 6 7@__profn_foo = private constant [3 x i8] c"foo" 8@__profn_bar = private constant [3 x i8] c"bar" 9 10define i32 @foo(ptr ) { 11 call void @llvm.instrprof.increment(ptr @__profn_foo, i64 12884901887, i32 1, i32 0) 12 %2 = ptrtoint ptr %0 to i64 13 call void @llvm.instrprof.value.profile(ptr @__profn_foo, i64 12884901887, i64 %2, i32 0, i32 0) 14 %3 = tail call i32 %0() 15 ret i32 %3 16} 17 18; Function Attrs: nounwind 19declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #0 20 21; Function Attrs: nounwind 22declare void @llvm.instrprof.value.profile(ptr, i64, i64, i32, i32) #0 23 24attributes #0 = { nounwind } 25 26; STATIC: @__profvp_foo = private global [1 x i64] zeroinitializer, section "{{[^"]+}}" 27; STATIC: @__llvm_prf_vnodes 28 29; DYN-NOT: @__profvp_foo 30; DYN-NOT: @__llvm_prf_vnodes 31 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 37 38; STATIC: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 0) 39; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 zeroext 0) 40; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 signext 0) 41 42; STATIC: declare void @__llvm_profile_instrument_target(i64, ptr, i32) 43; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 zeroext) 44; STATIC-SEXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 signext) 45