diff options
author | Dehao Chen <dehao@google.com> | 2017-02-06 23:33:15 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-02-06 23:33:15 +0000 |
commit | 4a9dd70213f5359b5dc5b3772f81a0b1c40ee55b (patch) | |
tree | dcd004296d844b2604e858ec3479fdda59d097be /llvm/test/Transforms | |
parent | becf0a362a030e59f4a78621931342ea8aecd5e1 (diff) | |
download | bcm5719-llvm-4a9dd70213f5359b5dc5b3772f81a0b1c40ee55b.tar.gz bcm5719-llvm-4a9dd70213f5359b5dc5b3772f81a0b1c40ee55b.zip |
Fix the samplepgo indirect call promotion bug: we should not promote a direct call.
Summary: Checking CS.getCalledFunction() == nullptr does not necessary indicate indirect call. We also need to check if CS.getCalledValue() is not a constant.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29570
llvm-svn: 294260
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof | 3 | ||||
-rw-r--r-- | llvm/test/Transforms/SampleProfile/indirect-call.ll | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof b/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof index 9ebfd77147d..ac32967bd54 100644 --- a/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof +++ b/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof @@ -6,3 +6,6 @@ test_inline:3000:0 test_noinline:3000:0 5: foo_noinline:3000 1: 3000 +test_direct:3000:0 + 5: foo_direct:3000 + 1: 3000 diff --git a/llvm/test/Transforms/SampleProfile/indirect-call.ll b/llvm/test/Transforms/SampleProfile/indirect-call.ll index c868d0b83a2..e6e294fd6bf 100644 --- a/llvm/test/Transforms/SampleProfile/indirect-call.ll +++ b/llvm/test/Transforms/SampleProfile/indirect-call.ll @@ -47,6 +47,21 @@ define i32 @foo_noinline(i32 %x) !dbg !3 { ret i32 %x } +define void @foo_direct() !dbg !3 { + ret void +} + +; CHECK-LABEL: @test_direct +; We should not promote a direct call. +define void @test_direct() !dbg !3 { +; CHECK-NOT: icmp +; CHECK: call + call void @foo_alias(), !dbg !5 + ret void +} + +@foo_alias = alias void (), void ()* @foo_direct + !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!2} |