|
| 1 | +; REQUIRES: x86-registered-target |
| 2 | + |
| 3 | +; RUN: opt -module-summary %s -o %t.bc |
| 4 | + |
| 5 | +; Tests that with dead stripping in the thin link enabled (default), we do not |
| 6 | +; promote to target of the dropped dead symbol _ZL3foov. This can happen with a |
| 7 | +; sample profile collected for one binary used to optimize for another binary. |
| 8 | +; RUN: llvm-lto2 run -save-temps -o %t2 %t.bc -r %t.bc,fptr,plx \ |
| 9 | +; RUN: -r %t.bc,main,plx -r %t.bc,_ZL3foov,l |
| 10 | +; RUN: llvm-dis < %t2.1.4.opt.bc | FileCheck %s --check-prefix=OPT |
| 11 | +; RUN: llvm-lto2 run -save-temps -o %t2 %t.bc -r %t.bc,fptr,plx \ |
| 12 | +; RUN: -r %t.bc,main,plx -r %t.bc,_ZL3foov,l -compute-dead=false |
| 13 | +; RUN: llvm-dis < %t2.1.4.opt.bc | FileCheck %s --check-prefix=OPT-NODEAD |
| 14 | + |
| 15 | +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 16 | +target triple = "x86_64-unknown-linux-gnu" |
| 17 | + |
| 18 | +@fptr = local_unnamed_addr global void ()* null, align 8 |
| 19 | + |
| 20 | +define void @_ZL3foov() #1 { |
| 21 | +entry: |
| 22 | + ret void |
| 23 | +} |
| 24 | + |
| 25 | +define i32 @main() local_unnamed_addr #0 !prof !34 { |
| 26 | +entry: |
| 27 | + %0 = load void ()*, void ()** @fptr, align 8 |
| 28 | +; OPT-NOT: label %if.false.orig_indirect |
| 29 | +; OPT-NODEAD: br i1 %{{[0-9]+}}, label %if.end.icp, label %if.false.orig_indirect |
| 30 | + tail call void %0(), !prof !40 |
| 31 | + ret i32 0 |
| 32 | +} |
| 33 | + |
| 34 | +!llvm.dbg.cu = !{!0} |
| 35 | +!llvm.module.flags = !{!3,!4} |
| 36 | +!llvm.ident = !{!31} |
| 37 | + |
| 38 | +!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) |
| 39 | +!1 = !DIFile(filename: "main.cc", directory: ".") |
| 40 | +!2 = !{} |
| 41 | +!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 42 | +!4 = !{i32 1, !"ProfileSummary", !5} |
| 43 | +!5 = !{!6, !7, !8, !9, !10, !11, !12, !13} |
| 44 | +!6 = !{!"ProfileFormat", !"SampleProfile"} |
| 45 | +!7 = !{!"TotalCount", i64 3003} |
| 46 | +!8 = !{!"MaxCount", i64 3000} |
| 47 | +!9 = !{!"MaxInternalCount", i64 0} |
| 48 | +!10 = !{!"MaxFunctionCount", i64 0} |
| 49 | +!11 = !{!"NumCounts", i64 3} |
| 50 | +!12 = !{!"NumFunctions", i64 1} |
| 51 | +!13 = !{!"DetailedSummary", !14} |
| 52 | +!14 = !{!15, !16, !17, !18, !19, !20, !20, !21, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30} |
| 53 | +!15 = !{i32 10000, i64 3000, i32 1} |
| 54 | +!16 = !{i32 100000, i64 3000, i32 1} |
| 55 | +!17 = !{i32 200000, i64 3000, i32 1} |
| 56 | +!18 = !{i32 300000, i64 3000, i32 1} |
| 57 | +!19 = !{i32 400000, i64 3000, i32 1} |
| 58 | +!20 = !{i32 500000, i64 3000, i32 1} |
| 59 | +!21 = !{i32 600000, i64 3000, i32 1} |
| 60 | +!22 = !{i32 700000, i64 3000, i32 1} |
| 61 | +!23 = !{i32 800000, i64 3000, i32 1} |
| 62 | +!24 = !{i32 900000, i64 3000, i32 1} |
| 63 | +!25 = !{i32 950000, i64 3000, i32 1} |
| 64 | +!26 = !{i32 990000, i64 3000, i32 1} |
| 65 | +!27 = !{i32 999000, i64 3000, i32 1} |
| 66 | +!28 = !{i32 999900, i64 2, i32 2} |
| 67 | +!29 = !{i32 999990, i64 2, i32 2} |
| 68 | +!30 = !{i32 999999, i64 2, i32 2} |
| 69 | +!31 = !{!"clang version 5.0.0 (trunk 297016)"} |
| 70 | +!34 = !{!"function_entry_count", i64 1} |
| 71 | +!40 = !{!"VP", i32 0, i64 3000, i64 -8789629626369651636, i64 3000} |
0 commit comments