summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/ADCE
diff options
context:
space:
mode:
authorBetul Buyukkurt <betulb@codeaurora.org>2016-04-13 18:52:19 +0000
committerBetul Buyukkurt <betulb@codeaurora.org>2016-04-13 18:52:19 +0000
commitbf8554c27976709a056005f10cb8ce4568ccd060 (patch)
treef4cadaae3f2b18acd90e499565d219e726b4db8b /llvm/test/Transforms/ADCE
parent87bcae366daf2cd690b2fc2711a7908be40b2bcf (diff)
downloadbcm5719-llvm-bf8554c27976709a056005f10cb8ce4568ccd060.tar.gz
bcm5719-llvm-bf8554c27976709a056005f10cb8ce4568ccd060.zip
[PGO] Remove redundant VP instrumentation
LLVM optimization passes may reduce a profiled target expression to a constant. Removing runtime calls at such instrumentation points would help speedup the runtime of the instrumented program. llvm-svn: 266229
Diffstat (limited to 'llvm/test/Transforms/ADCE')
-rw-r--r--llvm/test/Transforms/ADCE/delete-profiling-calls-to-constant.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ADCE/delete-profiling-calls-to-constant.ll b/llvm/test/Transforms/ADCE/delete-profiling-calls-to-constant.ll
new file mode 100644
index 00000000000..a61e8f8cacc
--- /dev/null
+++ b/llvm/test/Transforms/ADCE/delete-profiling-calls-to-constant.ll
@@ -0,0 +1,19 @@
+; RUN: opt < %s -adce | FileCheck %s
+; RUN: opt < %s -passes=adce | FileCheck %s
+
+; Verify that a call to instrument a constant is deleted.
+
+@__profc_foo = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
+@__profd_foo = private global { i64, i64, i64*, i8*, i8*, i32, [1 x i16] } { i64 6699318081062747564, i64 0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0), i8* bitcast (i32 ()* @foo to i8*), i8* null, i32 1, [1 x i16] [i16 1] }, section "__llvm_prf_data", align 8
+
+define i32 @foo() {
+; CHECK-NOT: __llvm_profile_instrument_target
+entry:
+ tail call void @__llvm_profile_instrument_target(i64 ptrtoint (i32 (i32)* @bar to i64), i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [1 x i16] }* @__profd_foo to i8*), i32 0)
+ %call = tail call i32 @bar(i32 21)
+ ret i32 %call
+}
+
+declare i32 @bar(i32)
+
+declare void @__llvm_profile_instrument_target(i64, i8*, i32)
OpenPOWER on IntegriCloud