diff options
author | Dehao Chen <dehao@google.com> | 2017-09-14 17:29:56 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-09-14 17:29:56 +0000 |
commit | 3a81f84d9aaecbb5dfcdecdc02dbfb3dad981b84 (patch) | |
tree | d4690b5832271238c002d407ff6ab788e82f9d98 /llvm/test/Transforms/SampleProfile | |
parent | 55e446737feb6c0b0a15ae95c0b489796658d0db (diff) | |
download | bcm5719-llvm-3a81f84d9aaecbb5dfcdecdc02dbfb3dad981b84.tar.gz bcm5719-llvm-3a81f84d9aaecbb5dfcdecdc02dbfb3dad981b84.zip |
Invoke GetInlineCost for legality check before inline functions in SampleProfileLoader.
Summary: SampleProfileLoader inlines hot functions if it is inlined in the profiled binary. However, the inline needs to be guarded by legality check, otherwise it could lead to correctness issues.
Reviewers: eraman, davidxl
Reviewed By: eraman
Subscribers: vitalybuka, sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D37779
llvm-svn: 313277
Diffstat (limited to 'llvm/test/Transforms/SampleProfile')
-rw-r--r-- | llvm/test/Transforms/SampleProfile/Inputs/einline.prof | 1 | ||||
-rw-r--r-- | llvm/test/Transforms/SampleProfile/early-inline.ll | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/einline.prof b/llvm/test/Transforms/SampleProfile/Inputs/einline.prof index df0275b5005..624990b47ef 100644 --- a/llvm/test/Transforms/SampleProfile/Inputs/einline.prof +++ b/llvm/test/Transforms/SampleProfile/Inputs/einline.prof @@ -1,5 +1,6 @@ _Z3foov:200:100 1: _Z3barv:0 + 2: no_inline:100 3: _Z3barv:100 recursive:200:100 1: recursive:100 diff --git a/llvm/test/Transforms/SampleProfile/early-inline.ll b/llvm/test/Transforms/SampleProfile/early-inline.ll index 8d8294f99db..8b857a449f0 100644 --- a/llvm/test/Transforms/SampleProfile/early-inline.ll +++ b/llvm/test/Transforms/SampleProfile/early-inline.ll @@ -12,6 +12,8 @@ define void @_Z3foov() #0 personality i8* bitcast (i32 (...)* @__gxx_personality %1 = alloca i8* %2 = alloca i32 %3 = alloca i32, align 4 +; CHECK: call void @no_inline + call void @no_inline(), !dbg !16 ; CHECK-NOT: call call void @_ZL3barv(), !dbg !9 ; CHECK-NOT: invoke @@ -45,8 +47,16 @@ define void @recursive() #0 !dbg !13 { ret void } +; The callee has mismatch attributes to the caller, it should not be inlined +define void @no_inline() #1 !dbg !17 { + ret void +} + declare i32 @__gxx_personality_v0(...) +attributes #0 = {"target-features"="+sse4.1"} +attributes #1 = {"target-features"="+sse4.2"} + !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3, !4} @@ -62,3 +72,5 @@ declare i32 @__gxx_personality_v0(...) !13 = distinct !DISubprogram(linkageName: "recursive", scope: !1, file: !1, line: 20, scopeLine: 20, unit: !0) !14 = !DILocation(line: 21, column: 3, scope: !13) !15 = !DILocation(line: 22, column: 3, scope: !13) +!16 = !DILocation(line: 7, column: 3, scope: !6) +!17 = distinct !DISubprogram(linkageName: "no_inline", scope: !1, file: !1, line: 20, scopeLine: 20, unit: !0) |