diff options
author | Dehao Chen <dehao@google.com> | 2017-08-02 01:28:31 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-08-02 01:28:31 +0000 |
commit | cbd284128f6bede7c09c6e28dd205d948a5d6ddf (patch) | |
tree | 51bbdbc79709dedc742122869590459840f8fdf8 /test/LTO | |
parent | dbd873dceb685962f5be9bb84c7fd1fb61f64530 (diff) |
Update the new PM pipeline to make ICP aware if it is SamplePGO build.
Summary: In ThinLTO backend compile, OPTOptions are not set so that the ICP in ThinLTO backend does not know if it is a SamplePGO build, in which profile count needs to be annotated directly on call instructions. This patch cleaned up the PGOOptions handling logic and passes down PGOOptions to ThinLTO backend.
Reviewers: chandlerc, tejohnson, davidxl
Reviewed By: chandlerc
Subscribers: sanjoy, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D36052
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/LTO')
-rw-r--r-- | test/LTO/Resolution/X86/Inputs/load-sample-prof-icp.prof | 2 | ||||
-rw-r--r-- | test/LTO/Resolution/X86/load-sample-prof-icp.ll | 46 |
2 files changed, 48 insertions, 0 deletions
diff --git a/test/LTO/Resolution/X86/Inputs/load-sample-prof-icp.prof b/test/LTO/Resolution/X86/Inputs/load-sample-prof-icp.prof new file mode 100644 index 00000000000..ac9000cd60b --- /dev/null +++ b/test/LTO/Resolution/X86/Inputs/load-sample-prof-icp.prof @@ -0,0 +1,2 @@ +test:1000:0 + 1: 1000 bar:1000 diff --git a/test/LTO/Resolution/X86/load-sample-prof-icp.ll b/test/LTO/Resolution/X86/load-sample-prof-icp.ll new file mode 100644 index 00000000000..57c870c0209 --- /dev/null +++ b/test/LTO/Resolution/X86/load-sample-prof-icp.ll @@ -0,0 +1,46 @@ +; Test that llvm-lto2 handles the -lto-sample-profile-file option and pass +; down to the ICP correctly. +; +; RUN: opt -module-summary < %s -o %t.bc +; RUN: llvm-lto2 run -o %t.out %t.bc -save-temps \ +; RUN: -r %t.bc,test,px -r %t.bc,bar,x \ +; RUN: -lto-sample-profile-file=%S/Inputs/load-sample-prof-icp.prof +; RUN: llvm-dis %t.out.0.4.opt.bc -o - | FileCheck %s +; RUN: llvm-lto2 run -o %t.out %t.bc -save-temps \ +; RUN: -r %t.bc,test,px -r %t.bc,bar,x -use-new-pm \ +; RUN: -lto-sample-profile-file=%S/Inputs/load-sample-prof-icp.prof +; RUN: llvm-dis %t.out.0.4.opt.bc -o - | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK-LABEL: @test +; Checks that the call instruction is promoted to direct call and has +; profile count annotated on the direct call. +define void @test(void ()*) !dbg !7 { + %2 = alloca void ()* + store void ()* %0, void ()** %2 + %3 = load void ()*, void ()** %2 + ; CHECK: call void @bar(),{{.*}}!prof + call void %3(), !dbg !10 + ret void +} + +declare void @bar() local_unnamed_addr + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) +!1 = !DIFile(filename: "test.c", directory: "/tmp") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang version 6.0.0 "} +!7 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, variables: !2) +!8 = !DISubroutineType(types: !9) +!9 = !{null} +!10 = !DILocation(line: 4, column: 5, scope: !7) +!11 = !DILocation(line: 5, column: 1, scope: !7) |