Xinliang David Li | b628dd3 | 2016-05-21 22:55:34 +0000 | [diff] [blame^] | 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 -instrprof -S | FileCheck %s --check-prefix=STATIC |
| 4 | ; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -vp-static-alloc=true -S | FileCheck %s --check-prefix=STATIC |
| 5 | ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -vp-static-alloc=false -instrprof -S | FileCheck %s --check-prefix=DYN |
| 6 | ; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN |
| 7 | |
| 8 | |
| 9 | @__profn_foo = private constant [3 x i8] c"foo" |
| 10 | |
| 11 | define i32 @foo(i32 ()* ) { |
| 12 | 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) |
| 13 | %2 = ptrtoint i32 ()* %0 to i64 |
| 14 | 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) |
| 15 | %3 = tail call i32 %0() |
| 16 | ret i32 %3 |
| 17 | } |
| 18 | |
| 19 | ; Function Attrs: nounwind |
| 20 | declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0 |
| 21 | |
| 22 | ; Function Attrs: nounwind |
| 23 | declare void @llvm.instrprof.value.profile(i8*, i64, i64, i32, i32) #0 |
| 24 | |
| 25 | attributes #0 = { nounwind } |
| 26 | |
| 27 | ; STATIC: @__profvp_foo |
| 28 | ; STATIC: @__llvm_prf_vnodes |
| 29 | |
| 30 | ; DYN-NOT: @__profvp_foo |
| 31 | ; DYN-NOT: @__llvm_prf_vnodes |