summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SampleProfile/indirect-call.ll
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-04-17 22:23:05 +0000
committerDehao Chen <dehao@google.com>2017-04-17 22:23:05 +0000
commit1ea8bd81096b42830bb4f20c891f5a34af385de6 (patch)
treeb806b1f95e312f306d3e3873c2479fb7811ade21 /llvm/test/Transforms/SampleProfile/indirect-call.ll
parent68f82a31d33beca9f276cca580cb3e96c7a4d6af (diff)
downloadbcm5719-llvm-1ea8bd81096b42830bb4f20c891f5a34af385de6.tar.gz
bcm5719-llvm-1ea8bd81096b42830bb4f20c891f5a34af385de6.zip
Build SymbolMap in SampleProfileLoader to help matchin function names with suffix.
Summary: If there is suffix added in the function name (e.g. module hash added by thinLTO), we will not be able to find a match in profile as the suffix does not exist in profile. This patch build a map from function name to Function *. The map includes the entry for the stripped function name so that inlineHotFunctions can find the corresponding function to promote/inline. Reviewers: davidxl, dnovillo, tejohnson Reviewed By: davidxl Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D31952 llvm-svn: 300507
Diffstat (limited to 'llvm/test/Transforms/SampleProfile/indirect-call.ll')
-rw-r--r--llvm/test/Transforms/SampleProfile/indirect-call.ll44
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/indirect-call.ll b/llvm/test/Transforms/SampleProfile/indirect-call.ll
index 5a4913d6358..4647dd42129 100644
--- a/llvm/test/Transforms/SampleProfile/indirect-call.ll
+++ b/llvm/test/Transforms/SampleProfile/indirect-call.ll
@@ -29,6 +29,34 @@ define void @test_inline(i64* (i32*)*, i32* %x) !dbg !3 {
ret void
}
+; CHECK-LABEL: @test_inline_strip
+; If the indirect call is promoted and inlined in profile, and the callee name
+; is stripped we should promote and inline it.
+define void @test_inline_strip(i64* (i32*)*, i32* %x) !dbg !3 {
+ %2 = alloca i64* (i32*)*
+ store i64* (i32*)* %0, i64* (i32*)** %2
+ %3 = load i64* (i32*)*, i64* (i32*)** %2
+; CHECK: icmp {{.*}} @foo_inline_strip.suffix
+; CHECK: if.true.direct_targ:
+; CHECK-NOT: call
+; CHECK: if.false.orig_indirect:
+; CHECK: call
+ call i64* %3(i32* %x), !dbg !5
+ ret void
+}
+
+; CHECK-LABEL: @test_inline_strip_conflict
+; If the indirect call is promoted and inlined in profile, and the callee name
+; is stripped, but have more than 1 potential match, we should not promote.
+define void @test_inline_strip_conflict(i64* (i32*)*, i32* %x) !dbg !3 {
+ %2 = alloca i64* (i32*)*
+ store i64* (i32*)* %0, i64* (i32*)** %2
+ %3 = load i64* (i32*)*, i64* (i32*)** %2
+; CHECK-NOT: if.true.direct_targ:
+ call i64* %3(i32* %x), !dbg !5
+ ret void
+}
+
; CHECK-LABEL: @test_noinline
; If the indirect call target is not available, we should not promote it.
define void @test_noinline(void ()*) !dbg !3 {
@@ -47,6 +75,22 @@ define i32* @foo_inline1(i32* %x) !dbg !3 {
ret i32* %x
}
+define i32* @foo_inline_strip.suffix(i32* %x) !dbg !3 {
+ ret i32* %x
+}
+
+define i32* @foo_inline_strip_conflict.suffix1(i32* %x) !dbg !3 {
+ ret i32* %x
+}
+
+define i32* @foo_inline_strip_conflict.suffix2(i32* %x) !dbg !3 {
+ ret i32* %x
+}
+
+define i32* @foo_inline_strip_conflict.suffix3(i32* %x) !dbg !3 {
+ ret i32* %x
+}
+
define i32* @foo_inline2(i32* %x) !dbg !3 {
ret i32* %x
}
OpenPOWER on IntegriCloud