summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2016-01-21 18:11:44 +0000
committerRong Xu <xur@google.com>2016-01-21 18:11:44 +0000
commited9fec736502adf3a8f35a488243c212d640223d (patch)
treefccb332cbe1253ca305180a11309d1897148d3c1 /llvm/test/Transforms
parent4e971da2723972b589f617301b7c838f00c8e2c7 (diff)
downloadbcm5719-llvm-ed9fec736502adf3a8f35a488243c212d640223d.tar.gz
bcm5719-llvm-ed9fec736502adf3a8f35a488243c212d640223d.zip
[PGO] IR level instrumentation of indirect call value profiling
This patch adds the instrumentation for indirect call value profiling. It finds all the indirect call-sites and generates instrprof_value_profile intrinsic calls. A new opt level option -disable-vp is introduced to disable this instrumentation. Reviewers: davidxl, betulb, vsk Differential Revision: http://reviews.llvm.org/D16016 llvm-svn: 258417
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/PGOProfile/indirect_call_profile.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll b/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll
new file mode 100644
index 00000000000..baac51dd453
--- /dev/null
+++ b/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll
@@ -0,0 +1,17 @@
+; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@bar = external global void ()*, align 8
+; GEN: @__profn_foo = private constant [3 x i8] c"foo"
+
+define void @foo() {
+entry:
+; GEN: entry:
+; GEN-NEXT: 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)
+ %tmp = load void ()*, void ()** @bar, align 8
+; GEN: [[ICALL_TARGET:%[0-9]+]] = ptrtoint void ()* %tmp to i64
+; GEN-NEXT: call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 12884901887, i64 [[ICALL_TARGET]], i32 0, i32 0)
+ call void %tmp()
+ ret void
+}
OpenPOWER on IntegriCloud