12f7ea054SFangrui Song;; Check that static counters are allocated for value profiler 22f7ea054SFangrui Song 3acead46aSFangrui Song; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -vp-static-alloc=true -passes=instrprof -S | FileCheck %s --check-prefix=STATIC 4acead46aSFangrui Song; RUN: opt < %s -mtriple=powerpc-ibm-aix-xcoff -passes=instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN 5acead46aSFangrui Song; RUN: opt < %s -mtriple=powerpc64-ibm-aix-xcoff -passes=instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN 62f7ea054SFangrui Song 72f7ea054SFangrui Song@__profn_foo = private constant [3 x i8] c"foo" 82f7ea054SFangrui Song@__profn_bar = private constant [3 x i8] c"bar" 92f7ea054SFangrui Song 10*9ff36df5SFangrui Songdefine i32 @foo(ptr ) { 11*9ff36df5SFangrui Song call void @llvm.instrprof.increment(ptr @__profn_foo, i64 12884901887, i32 1, i32 0) 12*9ff36df5SFangrui Song %2 = ptrtoint ptr %0 to i64 13*9ff36df5SFangrui Song call void @llvm.instrprof.value.profile(ptr @__profn_foo, i64 12884901887, i64 %2, i32 0, i32 0) 142f7ea054SFangrui Song %3 = tail call i32 %0() 152f7ea054SFangrui Song ret i32 %3 162f7ea054SFangrui Song} 172f7ea054SFangrui Song 182f7ea054SFangrui Song; Function Attrs: nounwind 19*9ff36df5SFangrui Songdeclare void @llvm.instrprof.increment(ptr, i64, i32, i32) #0 202f7ea054SFangrui Song 212f7ea054SFangrui Song; Function Attrs: nounwind 22*9ff36df5SFangrui Songdeclare void @llvm.instrprof.value.profile(ptr, i64, i64, i32, i32) #0 232f7ea054SFangrui Song 242f7ea054SFangrui Songattributes #0 = { nounwind } 252f7ea054SFangrui Song 262f7ea054SFangrui Song; STATIC: @__profvp_foo = private global [1 x i64] zeroinitializer, section "{{[^"]+}}" 272f7ea054SFangrui Song; STATIC: @__llvm_prf_vnodes 282f7ea054SFangrui Song 292f7ea054SFangrui Song; DYN-NOT: @__profvp_foo 302f7ea054SFangrui Song; DYN-NOT: @__llvm_prf_vnodes 312f7ea054SFangrui Song 322f7ea054SFangrui Song;; __llvm_prf_vnodes and __llvm_prf_nm are not referenced by other metadata sections. 332f7ea054SFangrui Song;; We have to conservatively place them in llvm.used. 342f7ea054SFangrui Song; STATIC: @llvm.used = appending global 352f7ea054SFangrui Song; STATIC-SAME: @__llvm_prf_vnodes 362f7ea054SFangrui Song; STATIC-SAME: @__llvm_prf_nm 372f7ea054SFangrui Song 38*9ff36df5SFangrui Song; STATIC: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 0) 39*9ff36df5SFangrui Song; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 zeroext 0) 40*9ff36df5SFangrui Song; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, ptr @__profd_foo, i32 signext 0) 412f7ea054SFangrui Song 42*9ff36df5SFangrui Song; STATIC: declare void @__llvm_profile_instrument_target(i64, ptr, i32) 43*9ff36df5SFangrui Song; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 zeroext) 44*9ff36df5SFangrui Song; STATIC-SEXT: declare void @__llvm_profile_instrument_target(i64, ptr, i32 signext) 45