]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/PGOProfile/thinlto_samplepgo_icp2.ll
Vendor import of llvm trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / test / Transforms / PGOProfile / thinlto_samplepgo_icp2.ll
1 ; Checks if indirect calls to static target functions that are actually
2 ; dead in the new binary target (due to a profile collected from a slightly
3 ; different binary) are properly traversed during ThinLTO liveness analysis.
4 ; If the liveness analysis is changed to ignore indirect edges and the
5 ; importer is changed to check liveness before importing, this test will
6 ; need adjustment (in that case _ZL3foov should not be imported/promoted,
7 ; and _ZL3barv can be internalized/removed).
8
9 ; REQUIRES: x86-registered-target
10
11 ; Do setup work for all below tests: generate bitcode and combined index
12 ; RUN: opt -module-summary %s -o %t.bc
13 ; RUN: opt -module-summary %p/Inputs/thinlto_samplepgo_icp2a.ll -o %t2a.bc
14 ; RUN: opt -module-summary %p/Inputs/thinlto_samplepgo_icp2b.ll -o %t2b.bc
15
16 ; Use -import-instr-limit=5 so that we don't import _ZL3barv, which would
17 ; hide the problem.
18 ; RUN: llvm-lto2 run -save-temps -import-instr-limit=5 -o %t3 %t.bc %t2a.bc %t2b.bc -r %t.bc,fptr,plx -r %t.bc,main,plx -r %t2a.bc,_ZL3barv,l -r %t2b.bc,_ZL3barv,pl -print-imports 2>&1 | FileCheck %s --check-prefix=IMPORTS2
19 ; IMPORTS2-NOT: Import _ZL3barv
20 ; IMPORTS2: Import _ZL3foov.llvm.0
21 ; IMPORTS2-NOT: Import _ZL3barv
22 ; RUN: llvm-nm %t3.2 | FileCheck %s --check-prefix=NM
23 ; NM: _ZL3barv
24 ; RUN: llvm-dis < %t3.3.2.internalize.bc | FileCheck %s --check-prefix=INTERNALIZE
25 ; INTERNALIZE: define dso_local void @_ZL3barv
26
27 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
28 target triple = "x86_64-unknown-linux-gnu"
29
30 @fptr = local_unnamed_addr global void ()* null, align 8
31
32 ; Function Attrs: norecurse uwtable
33 define i32 @main() local_unnamed_addr #0 !prof !34 {
34 entry:
35   %0 = load void ()*, void ()** @fptr, align 8
36 ; ICALL-PROM:   br i1 %{{[0-9]+}}, label %if.true.direct_targ, label %if.false.orig_indirect
37   tail call void %0(), !prof !40
38   ret i32 0
39 }
40
41 !llvm.dbg.cu = !{!0}
42 !llvm.module.flags = !{!3,!4}
43 !llvm.ident = !{!31}
44
45 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
46 !1 = !DIFile(filename: "main.cc", directory: ".")
47 !2 = !{}
48 !3 = !{i32 2, !"Debug Info Version", i32 3}
49 !4 = !{i32 1, !"ProfileSummary", !5}
50 !5 = !{!6, !7, !8, !9, !10, !11, !12, !13}
51 !6 = !{!"ProfileFormat", !"SampleProfile"}
52 !7 = !{!"TotalCount", i64 3003}
53 !8 = !{!"MaxCount", i64 3000}
54 !9 = !{!"MaxInternalCount", i64 0}
55 !10 = !{!"MaxFunctionCount", i64 0}
56 !11 = !{!"NumCounts", i64 3}
57 !12 = !{!"NumFunctions", i64 1}
58 !13 = !{!"DetailedSummary", !14}
59 !14 = !{!15, !16, !17, !18, !19, !20, !20, !21, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30}
60 !15 = !{i32 10000, i64 3000, i32 1}
61 !16 = !{i32 100000, i64 3000, i32 1}
62 !17 = !{i32 200000, i64 3000, i32 1}
63 !18 = !{i32 300000, i64 3000, i32 1}
64 !19 = !{i32 400000, i64 3000, i32 1}
65 !20 = !{i32 500000, i64 3000, i32 1}
66 !21 = !{i32 600000, i64 3000, i32 1}
67 !22 = !{i32 700000, i64 3000, i32 1}
68 !23 = !{i32 800000, i64 3000, i32 1}
69 !24 = !{i32 900000, i64 3000, i32 1}
70 !25 = !{i32 950000, i64 3000, i32 1}
71 !26 = !{i32 990000, i64 3000, i32 1}
72 !27 = !{i32 999000, i64 3000, i32 1}
73 !28 = !{i32 999900, i64 2, i32 2}
74 !29 = !{i32 999990, i64 2, i32 2}
75 !30 = !{i32 999999, i64 2, i32 2}
76 !31 = !{!"clang version 5.0.0 (trunk 297016)"}
77 !34 = !{!"function_entry_count", i64 1}
78 !40 = !{!"VP", i32 0, i64 3000, i64 -8789629626369651636, i64 3000}