summaryrefslogtreecommitdiffstats
path: root/llvm/test/Instrumentation/InstrProfiling
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-05-21 22:55:34 +0000
committerXinliang David Li <davidxl@google.com>2016-05-21 22:55:34 +0000
commitb628dd35689ba0e333bb81d0c46c4efcc2f26d24 (patch)
tree3a27ec2194088b7a08d003431334701f42d4f49b /llvm/test/Instrumentation/InstrProfiling
parent3fc3b4453d2f5c9db4ebcd43478ed39b93b6815b (diff)
downloadbcm5719-llvm-b628dd35689ba0e333bb81d0c46c4efcc2f26d24.tar.gz
bcm5719-llvm-b628dd35689ba0e333bb81d0c46c4efcc2f26d24.zip
[profile] Static counter allocation for value profiling (part-1)
Differential Revision: http://reviews.llvm.org/D20459 llvm-svn: 270336
Diffstat (limited to 'llvm/test/Instrumentation/InstrProfiling')
-rw-r--r--llvm/test/Instrumentation/InstrProfiling/icall.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/InstrProfiling/icall.ll b/llvm/test/Instrumentation/InstrProfiling/icall.ll
new file mode 100644
index 00000000000..3f6b18125b5
--- /dev/null
+++ b/llvm/test/Instrumentation/InstrProfiling/icall.ll
@@ -0,0 +1,31 @@
+;; Check that static counters are allocated for value profiler
+
+; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -vp-static-alloc=true -instrprof -S | FileCheck %s --check-prefix=STATIC
+; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -vp-static-alloc=true -S | FileCheck %s --check-prefix=STATIC
+; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -vp-static-alloc=false -instrprof -S | FileCheck %s --check-prefix=DYN
+; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -vp-static-alloc=false -S | FileCheck %s --check-prefix=DYN
+
+
+@__profn_foo = private constant [3 x i8] c"foo"
+
+define i32 @foo(i32 ()* ) {
+ 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)
+ %2 = ptrtoint i32 ()* %0 to i64
+ 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)
+ %3 = tail call i32 %0()
+ ret i32 %3
+}
+
+; Function Attrs: nounwind
+declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0
+
+; Function Attrs: nounwind
+declare void @llvm.instrprof.value.profile(i8*, i64, i64, i32, i32) #0
+
+attributes #0 = { nounwind }
+
+; STATIC: @__profvp_foo
+; STATIC: @__llvm_prf_vnodes
+
+; DYN-NOT: @__profvp_foo
+; DYN-NOT: @__llvm_prf_vnodes
OpenPOWER on IntegriCloud