1cee313d2SEric Christopher; Test to check thin link importing stats 2cee313d2SEric Christopher 3cee313d2SEric Christopher; -stats requires asserts 4cee313d2SEric Christopher; REQUIRES: asserts 5cee313d2SEric Christopher 6cee313d2SEric Christopher; REQUIRES: x86-registered-target 7cee313d2SEric Christopher 8cee313d2SEric Christopher; RUN: opt -module-summary %s -o %t.bc 9cee313d2SEric Christopher; RUN: opt -module-summary %p/Inputs/import_stats.ll -o %t2.bc 10cee313d2SEric Christopher 11cee313d2SEric Christopher; Test thin link stats with both new and old LTO 12cee313d2SEric Christopher; RUN: llvm-lto -thinlto-action=run -stats %t.bc %t2.bc \ 13cee313d2SEric Christopher; RUN: 2>&1 | FileCheck %s --check-prefix=THINLINKSTATS 14cee313d2SEric Christopher; RUN: llvm-lto2 run -stats -o %t3 %t.bc %t2.bc \ 15cee313d2SEric Christopher; RUN: -r %t.bc,hot_function,plx \ 16cee313d2SEric Christopher; RUN: -r %t.bc,hot, \ 17cee313d2SEric Christopher; RUN: -r %t.bc,critical, \ 18cee313d2SEric Christopher; RUN: -r %t.bc,none, \ 19cee313d2SEric Christopher; RUN: -r %t2.bc,hot,plx \ 20cee313d2SEric Christopher; RUN: -r %t2.bc,critical,plx \ 21cee313d2SEric Christopher; RUN: -r %t2.bc,none,plx \ 22cee313d2SEric Christopher; RUN: -r %t2.bc,globalvar,plx \ 23cee313d2SEric Christopher; RUN: 2>&1 | FileCheck %s --check-prefix=THINLINKSTATS 24cee313d2SEric Christopher 25cee313d2SEric Christopher; THINLINKSTATS-DAG: 1 function-import - Number of global variables thin link decided to import 26cee313d2SEric Christopher; THINLINKSTATS-DAG: 1 function-import - Number of critical functions thin link decided to import 27cee313d2SEric Christopher; THINLINKSTATS-DAG: 3 function-import - Number of functions thin link decided to import 28cee313d2SEric Christopher; THINLINKSTATS-DAG: 1 function-import - Number of hot functions thin link decided to import 29cee313d2SEric Christopher 30cee313d2SEric Christopher; ModuleID = 'import_stats.ll' 31*7b1d7937SAmy Huangtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 32cee313d2SEric Christophertarget triple = "x86_64-unknown-linux-gnu" 33cee313d2SEric Christopher 34cee313d2SEric Christopher; This function has a high profile count, so entry block is hot. 35cee313d2SEric Christopherdefine void @hot_function(i1 %a) !prof !20 { 36cee313d2SEric Christopherentry: 37cee313d2SEric Christopher call void @hot() 38cee313d2SEric Christopher call void @critical() 39cee313d2SEric Christopher br i1 %a, label %None1, label %None2, !prof !42 40cee313d2SEric ChristopherNone1: ; half goes here 41cee313d2SEric Christopher call void @none() 42cee313d2SEric Christopher br label %exit 43cee313d2SEric ChristopherNone2: ; half goes here 44cee313d2SEric Christopher br label %exit 45cee313d2SEric Christopherexit: 46cee313d2SEric Christopher ret void 47cee313d2SEric Christopher} 48cee313d2SEric Christopher 49cee313d2SEric Christopherdeclare void @hot() 50cee313d2SEric Christopherdeclare void @none() 51cee313d2SEric Christopherdeclare void @critical() 52cee313d2SEric Christopher 53cee313d2SEric Christopher!42 = !{!"branch_weights", i32 1, i32 1} 54cee313d2SEric Christopher 55cee313d2SEric Christopher!llvm.module.flags = !{!1} 56cee313d2SEric Christopher!20 = !{!"function_entry_count", i64 100, i64 696010031887058302} 57cee313d2SEric Christopher 58cee313d2SEric Christopher!1 = !{i32 1, !"ProfileSummary", !2} 59cee313d2SEric Christopher!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} 60cee313d2SEric Christopher!3 = !{!"ProfileFormat", !"InstrProf"} 61cee313d2SEric Christopher!4 = !{!"TotalCount", i64 300} 62cee313d2SEric Christopher!5 = !{!"MaxCount", i64 100} 63cee313d2SEric Christopher!6 = !{!"MaxInternalCount", i64 100} 64cee313d2SEric Christopher!7 = !{!"MaxFunctionCount", i64 100} 65cee313d2SEric Christopher!8 = !{!"NumCounts", i64 4} 66cee313d2SEric Christopher!9 = !{!"NumFunctions", i64 1} 67cee313d2SEric Christopher!10 = !{!"DetailedSummary", !11} 68cee313d2SEric Christopher!11 = !{!12, !13, !14} 69cee313d2SEric Christopher!12 = !{i32 10000, i64 100, i32 1} 70cee313d2SEric Christopher!13 = !{i32 999000, i64 100, i32 1} 71cee313d2SEric Christopher!14 = !{i32 999999, i64 1, i32 4} 72