Imported Upstream version 5.18.0.167

Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-20 08:25:10 +00:00
parent e19d552987
commit b084638f15
28489 changed files with 184 additions and 3866856 deletions

View File

@ -1,37 +0,0 @@
define void @globalfunc1() {
entry:
call void @trampoline()
ret void
}
; Adds an artificial level in the call graph to reduce the importing threshold
define void @trampoline() {
entry:
call void @largefunction()
ret void
}
define void @globalfunc2() {
entry:
call void @largefunction()
ret void
}
; Size is 5: if two layers below in the call graph the threshold will be 4,
; but if only one layer below the threshold will be 7.
define void @largefunction() {
entry:
call void @staticfunc2()
call void @staticfunc2()
call void @staticfunc2()
call void @staticfunc2()
call void @staticfunc2()
ret void
}
define internal void @staticfunc2() {
entry:
ret void
}

View File

@ -1,154 +0,0 @@
@globalvar = global i32 1, align 4
@staticvar = internal global i32 1, align 4
@staticconstvar = internal unnamed_addr constant [2 x i32] [i32 10, i32 20], align 4
@commonvar = common global i32 0, align 4
@P = internal global void ()* null, align 8
@weakalias = weak alias void (...), bitcast (void ()* @globalfunc1 to void (...)*)
@analias = alias void (...), bitcast (void ()* @globalfunc2 to void (...)*)
@linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
define void @globalfunc1() #0 {
entry:
call void @funcwithpersonality()
call void (...) @variadic()
ret void
}
define void @globalfunc2() #0 {
entry:
ret void
}
define linkonce_odr void @linkoncefunc() #0 {
entry:
ret void
}
define i32 @referencestatics(i32 %i) #0 {
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
%call = call i32 @staticfunc()
%0 = load i32, i32* @staticvar, align 4
%add = add nsw i32 %call, %0
%1 = load i32, i32* %i.addr, align 4
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* @staticconstvar, i64 0, i64 %idxprom
%2 = load i32, i32* %arrayidx, align 4
%add1 = add nsw i32 %add, %2
ret i32 %add1
}
define i32 @referenceglobals(i32 %i) #0 {
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @globalfunc1()
%0 = load i32, i32* @globalvar, align 4
ret i32 %0
}
define i32 @referencecommon(i32 %i) #0 {
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
%0 = load i32, i32* @commonvar, align 4
ret i32 %0
}
define void @setfuncptr() #0 {
entry:
store void ()* @staticfunc2, void ()** @P, align 8
ret void
}
define void @callfuncptr() #0 {
entry:
%0 = load void ()*, void ()** @P, align 8
call void %0()
ret void
}
@weakvar = weak global i32 1, align 4
define weak void @weakfunc() #0 {
entry:
ret void
}
define linkonce void @linkoncefunc2() #0 {
entry:
ret void
}
define internal i32 @staticfunc() #0 {
entry:
ret i32 1
}
declare i32 @__gxx_personality_v0(...)
; Add enough instructions to prevent import with inst limit of 5
define internal void @funcwithpersonality() #2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
ret void
}
define internal void @staticfunc2() #0 {
entry:
ret void
}
define void @referencelargelinkonce() #0 {
entry:
call void @linkonceodr()
ret void
}
; A large enough linkonce_odr function that should never be imported
define linkonce_odr void @linkonceodr() #0 {
entry:
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
call void @globalfunc2()
ret void
}
; Variadic function should not be imported because inliner doesn't handle it.
define void @variadic(...) {
ret void
}

View File

@ -1,7 +0,0 @@
declare void @analias()
define void @callanalias() #0 {
entry:
call void @analias()
ret void
}

View File

@ -1,26 +0,0 @@
; ModuleID = 'funcimport_debug.o'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define void @func() #0 !dbg !4 {
entry:
ret void, !dbg !10
}
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8}
!llvm.ident = !{!9}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "funcimport_debug.c", directory: ".")
!2 = !{}
!4 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, variables: !2)
!5 = !DISubroutineType(types: !6)
!6 = !{null}
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{!"clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)"}
!10 = !DILocation(line: 2, column: 1, scope: !4)

View File

@ -1,10 +0,0 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@link = internal global i32 0, align 4
; Function Attrs: norecurse nounwind readnone uwtable
define nonnull i32* @get_link() local_unnamed_addr {
ret i32* @link
}

View File

@ -1,81 +0,0 @@
; ModuleID = 'thinlto-function-summary-callgraph-profile-summary2.ll'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @hot1() #1 {
ret void
}
define void @hot2() #1 !prof !20 {
call void @calledFromHot()
call void @calledFromHot()
ret void
}
define void @hot3() #1 !prof !20 {
call void @calledFromHot()
call void @calledFromHot()
call void @calledFromHot()
ret void
}
define void @cold() #1 !prof !0 {
ret void
}
define void @cold2() #1 !prof !0 {
call void @calledFromCold()
call void @calledFromCold()
ret void
}
define void @none1() #1 {
ret void
}
define void @none2() #1 {
call void @calledFromNone()
ret void
}
define void @none3() #1 {
call void @calledFromNone()
call void @calledFromNone()
ret void
}
define void @calledFromCold() {
ret void
}
define void @calledFromHot() !prof !20 {
call void @calledFromHot2()
ret void
}
define void @calledFromHot2() !prof !20 {
call void @calledFromHot3()
ret void
}
define void @calledFromNone() !prof !0 {
ret void
}
declare void @calledFromHot3()
!0 = !{!"function_entry_count", i64 1}
!20 = !{!"function_entry_count", i64 110}
!llvm.module.flags = !{!1}
!1 = !{i32 1, !"ProfileSummary", !2}
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
!3 = !{!"ProfileFormat", !"InstrProf"}
!4 = !{!"TotalCount", i64 10000}
!5 = !{!"MaxCount", i64 10}
!6 = !{!"MaxInternalCount", i64 1}
!7 = !{!"MaxFunctionCount", i64 1000}
!8 = !{!"NumCounts", i64 3}
!9 = !{!"NumFunctions", i64 3}
!10 = !{!"DetailedSummary", !11}
!11 = !{!12, !13, !14}
!12 = !{i32 10000, i64 100, i32 1}
!13 = !{i32 999000, i64 100, i32 1}
!14 = !{i32 999999, i64 1, i32 2}

View File

@ -1,42 +0,0 @@
; ModuleID = 'thinlto-function-summary-callgraph-profile-summary2.ll'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @hot() #1 !prof !28 {
call void @calledFromHot()
ret void
}
; 9 instructions so it is above decayed cold threshold of 7 and below
; decayed hot threshold of 10.
define void @calledFromHot() !prof !28 {
%b = alloca i32, align 4
store i32 1, i32* %b, align 4
store i32 1, i32* %b, align 4
store i32 1, i32* %b, align 4
store i32 1, i32* %b, align 4
store i32 1, i32* %b, align 4
store i32 1, i32* %b, align 4
store i32 1, i32* %b, align 4
ret void
}
!llvm.module.flags = !{!1}
!1 = !{i32 1, !"ProfileSummary", !2}
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
!3 = !{!"ProfileFormat", !"InstrProf"}
!4 = !{!"TotalCount", i64 222}
!5 = !{!"MaxCount", i64 110}
!6 = !{!"MaxInternalCount", i64 1}
!7 = !{!"MaxFunctionCount", i64 110}
!8 = !{!"NumCounts", i64 4}
!9 = !{!"NumFunctions", i64 3}
!10 = !{!"DetailedSummary", !11}
!11 = !{!12, !13, !14}
!12 = !{i32 10000, i64 110, i32 2}
!13 = !{i32 999000, i64 2, i32 4}
!14 = !{i32 999999, i64 2, i32 4}
!28 = !{!"function_entry_count", i64 110}
!29 = !{!"function_entry_count", i64 1}

View File

@ -1,11 +0,0 @@
@myvar = internal constant i8 1, align 1
@llvm.used = appending global [1 x i8*] [i8* @myvar], section "llvm.metadata"
define void @foo(i64* %v) #0 {
entry:
%v.addr = alloca i64*, align 8
store i64* %v, i64** %v.addr, align 8
%0 = load i64*, i64** %v.addr, align 8
call void asm sideeffect "movzbl myvar(%rip), %eax\0A\09movq %rax, $0\0A\09", "=*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i64* %0) #1
ret void
}

View File

@ -1,31 +0,0 @@
; Do setup work for all below tests: generate bitcode and combined index
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/adjustable_threshold.ll -o %t2.bc
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
; Test import with default progressive instruction factor
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=10 -S | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIM-DEFAULT
; INSTLIM-DEFAULT: call void @staticfunc2.llvm.
; Test import with a reduced progressive instruction factor
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=10 -import-instr-evolution-factor=0.5 -S | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIM-PROGRESSIVE
; INSTLIM-PROGRESSIVE-NOT: call void @staticfunc
declare void @globalfunc1()
declare void @globalfunc2()
define void @entry() {
entry:
; Call site are processed in reversed order!
; On the direct call, we reconsider @largefunction with a higher threshold and
; import it
call void @globalfunc2()
; When importing globalfunc1, the threshold was limited and @largefunction was
; not imported.
call void @globalfunc1()
ret void
}

View File

@ -1,144 +0,0 @@
; Do setup work for all below tests: generate bitcode and combined index
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/funcimport.ll -o %t2.bc
; RUN: llvm-lto -thinlto -print-summary-global-ids -o %t3 %t.bc %t2.bc 2>&1 | FileCheck %s --check-prefix=GUID
; Do the import now
; RUN: opt -function-import -stats -print-imports -enable-import-metadata -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIMDEF
; Try again with new pass manager
; RUN: opt -passes='function-import' -stats -print-imports -enable-import-metadata -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIMDEF
; "-stats" requires +Asserts.
; REQUIRES: asserts
; Test import with smaller instruction limit
; RUN: opt -function-import -enable-import-metadata -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=5 -S | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIM5
; INSTLIM5-NOT: @staticfunc.llvm.
define i32 @main() #0 {
entry:
call void (...) @weakalias()
call void (...) @analias()
call void (...) @linkoncealias()
%call = call i32 (...) @referencestatics()
%call1 = call i32 (...) @referenceglobals()
%call2 = call i32 (...) @referencecommon()
call void (...) @setfuncptr()
call void (...) @callfuncptr()
call void (...) @weakfunc()
call void (...) @linkoncefunc2()
call void (...) @referencelargelinkonce()
call void (...) @variadic()
ret i32 0
}
; Won't import weak alias
; CHECK-DAG: declare void @weakalias
declare void @weakalias(...) #1
; External alias imported as available_externally copy of aliasee
; CHECK-DAG: define available_externally void @analias
declare void @analias(...) #1
; External alias imported as available_externally copy of aliasee
; (linkoncealias is an external alias to a linkonce_odr)
declare void @linkoncealias(...) #1
; CHECK-DAG: define available_externally void @linkoncealias()
; INSTLIMDEF-DAG: Import referencestatics
; INSTLIMDEF-DAG: define available_externally i32 @referencestatics(i32 %i) !thinlto_src_module !0 {
; INSTLIM5-DAG: declare i32 @referencestatics(...)
declare i32 @referencestatics(...) #1
; The import of referencestatics will expose call to staticfunc that
; should in turn be imported as a promoted/renamed and hidden function.
; Ensure that the call is to the properly-renamed function.
; INSTLIMDEF-DAG: Import staticfunc
; INSTLIMDEF-DAG: %call = call i32 @staticfunc.llvm.
; INSTLIMDEF-DAG: define available_externally hidden i32 @staticfunc.llvm.{{.*}} !thinlto_src_module !0 {
; INSTLIMDEF-DAG: Import referenceglobals
; CHECK-DAG: define available_externally i32 @referenceglobals(i32 %i) !thinlto_src_module !0 {
declare i32 @referenceglobals(...) #1
; The import of referenceglobals will expose call to globalfunc1 that
; should in turn be imported.
; INSTLIMDEF-DAG: Import globalfunc1
; CHECK-DAG: define available_externally void @globalfunc1() !thinlto_src_module !0
; INSTLIMDEF-DAG: Import referencecommon
; CHECK-DAG: define available_externally i32 @referencecommon(i32 %i) !thinlto_src_module !0 {
declare i32 @referencecommon(...) #1
; INSTLIMDEF-DAG: Import setfuncptr
; CHECK-DAG: define available_externally void @setfuncptr() !thinlto_src_module !0 {
declare void @setfuncptr(...) #1
; INSTLIMDEF-DAG: Import callfuncptr
; CHECK-DAG: define available_externally void @callfuncptr() !thinlto_src_module !0 {
declare void @callfuncptr(...) #1
; Ensure that all uses of local variable @P which has used in setfuncptr
; and callfuncptr are to the same promoted/renamed global.
; CHECK-DAG: @P.llvm.{{.*}} = external hidden global void ()*
; CHECK-DAG: %0 = load void ()*, void ()** @P.llvm.
; CHECK-DAG: store void ()* @staticfunc2.llvm.{{.*}}, void ()** @P.llvm.
; Ensure that @referencelargelinkonce definition is pulled in, but later we
; also check that the linkonceodr function is not.
; CHECK-DAG: define available_externally void @referencelargelinkonce() !thinlto_src_module !0 {
; INSTLIM5-DAG: declare void @linkonceodr()
declare void @referencelargelinkonce(...)
; Won't import weak func
; CHECK-DAG: declare void @weakfunc(...)
declare void @weakfunc(...) #1
; Won't import linkonce func
; CHECK-DAG: declare void @linkoncefunc2(...)
declare void @linkoncefunc2(...) #1
; INSTLIMDEF-DAG: Import funcwithpersonality
; INSTLIMDEF-DAG: define available_externally hidden void @funcwithpersonality.llvm.{{.*}}() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !thinlto_src_module !0 {
; INSTLIM5-DAG: declare hidden void @funcwithpersonality.llvm.{{.*}}()
; CHECK-DAG: declare void @variadic(...)
declare void @variadic(...)
; INSTLIMDEF-DAG: Import globalfunc2
; INSTLIMDEF-DAG: 13 function-import - Number of functions imported
; CHECK-DAG: !0 = !{!"{{.*}}/Inputs/funcimport.ll"}
; The actual GUID values will depend on path to test.
; GUID-DAG: GUID {{.*}} is weakalias
; GUID-DAG: GUID {{.*}} is referenceglobals
; GUID-DAG: GUID {{.*}} is weakfunc
; GUID-DAG: GUID {{.*}} is main
; GUID-DAG: GUID {{.*}} is referencecommon
; GUID-DAG: GUID {{.*}} is analias
; GUID-DAG: GUID {{.*}} is referencestatics
; GUID-DAG: GUID {{.*}} is linkoncealias
; GUID-DAG: GUID {{.*}} is setfuncptr
; GUID-DAG: GUID {{.*}} is callfuncptr
; GUID-DAG: GUID {{.*}} is funcwithpersonality
; GUID-DAG: GUID {{.*}} is setfuncptr
; GUID-DAG: GUID {{.*}} is staticfunc2
; GUID-DAG: GUID {{.*}} is __gxx_personality_v0
; GUID-DAG: GUID {{.*}} is referencestatics
; GUID-DAG: GUID {{.*}} is globalfunc1
; GUID-DAG: GUID {{.*}} is globalfunc2
; GUID-DAG: GUID {{.*}} is P
; GUID-DAG: GUID {{.*}} is staticvar
; GUID-DAG: GUID {{.*}} is commonvar
; GUID-DAG: GUID {{.*}} is weakalias
; GUID-DAG: GUID {{.*}} is staticfunc
; GUID-DAG: GUID {{.*}} is weakfunc
; GUID-DAG: GUID {{.*}} is referenceglobals
; GUID-DAG: GUID {{.*}} is weakvar
; GUID-DAG: GUID {{.*}} is staticconstvar
; GUID-DAG: GUID {{.*}} is analias
; GUID-DAG: GUID {{.*}} is globalvar
; GUID-DAG: GUID {{.*}} is referencecommon
; GUID-DAG: GUID {{.*}} is linkoncealias
; GUID-DAG: GUID {{.*}} is callfuncptr
; GUID-DAG: GUID {{.*}} is linkoncefunc

View File

@ -1,25 +0,0 @@
; Do setup work for all below tests: generate bitcode and combined index
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/funcimport_alias.ll -o %t2.bc
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
; Do the import now. Ensures that the importer handles an external call
; from imported callanalias() to a function that is defined already in
; the dest module, but as an alias.
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -S | FileCheck %s
define i32 @main() #0 {
entry:
call void @callanalias()
ret i32 0
}
@analias = alias void (), void ()* @globalfunc
define void @globalfunc() #0 {
entry:
ret void
}
declare void @callanalias() #1
; CHECK-DAG: define available_externally void @callanalias()

View File

@ -1,53 +0,0 @@
; Do setup work for all below tests: generate bitcode and combined index
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/funcimport_debug.ll -o %t2.bc
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
; Do the import now and confirm that metadata is linked for imported function.
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -S | FileCheck %s
; CHECK: define available_externally void @func()
; Check that we have exactly two subprograms (that func's subprogram wasn't
; linked more than once for example), and that they are connected to
; the correct compile unit.
; CHECK: ![[CU1:[0-9]+]] = distinct !DICompileUnit(
; CHECK: ![[CU2:[0-9]+]] = distinct !DICompileUnit(
; CHECK: distinct !DISubprogram(name: "main"
; CHECK-SAME: unit: ![[CU1]]
; CHECK: distinct !DISubprogram(name: "func"
; CHECK-SAME: unit: ![[CU2]]
; CHECK-NOT: distinct !DISubprogram
; ModuleID = 'funcimport_debug.o'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define i32 @main() #0 !dbg !4 {
entry:
call void (...) @func(), !dbg !11
ret i32 0, !dbg !12
}
declare void @func(...) #1
attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!8, !9}
!llvm.ident = !{!10}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "funcimport_debug.c", directory: ".")
!2 = !{}
!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, variables: !2)
!5 = !DISubroutineType(types: !6)
!6 = !{!7}
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = !{i32 2, !"Dwarf Version", i32 4}
!9 = !{i32 2, !"Debug Info Version", i32 3}
!10 = !{!"clang version 3.8.0 (trunk 255685) (llvm/trunk 255682)"}
!11 = !DILocation(line: 3, column: 3, scope: !4)
!12 = !DILocation(line: 4, column: 1, scope: !4)

View File

@ -1,27 +0,0 @@
; This test makes sure a static var is not selected as a callee target
; (which will crash compilation).
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/funcimport_var2.ll -o %t2.bc
; RUN: llvm-lto -thinlto -thinlto-action=thinlink -o %t3 %t.bc %t2.bc
; RUN: llvm-lto -thinlto -thinlto-action=import -thinlto-index=%t3 %t.bc %t2.bc
; RUN: llvm-lto -thinlto -thinlto-action=run %t.bc %t2.bc
; RUN: llvm-nm %t.bc.thinlto.o | FileCheck %s
; RUN: llvm-lto2 run %t.bc %t2.bc -o %t.out \
; RUN: -r %t.bc,_Z4LinkPKcS0_,plx \
; RUN: -r %t.bc,link,l \
; RUN: -r %t2.bc,get_link,plx
; RUN: llvm-nm %t.out.1 | FileCheck %s
; CHECK: U link
; REQUIRES: x86-registered-target
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i32 @_Z4LinkPKcS0_(i8*, i8*) local_unnamed_addr {
%3 = tail call i32 @link(i8* %0, i8* %1) #2
ret i32 %3
}
; Function Attrs: nounwind
declare i32 @link(i8*, i8*) local_unnamed_addr

View File

@ -1,137 +0,0 @@
; Test to check the callgraph in summary when there is PGO
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/hotness_based_import.ll -o %t2.bc
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
; Test import with default hot multiplier (3) and default hot-evolution-factor (1.0)
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 --S | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-DEFAULT
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 --S -import-hot-multiplier=3.0 -import-cold-multiplier=0.0 | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-DEFAULT
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 --S -import-hot-multiplier=3.0 | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-DEFAULT
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 --S -import-hot-multiplier=3.0 -import-instr-evolution-factor=0.0 | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-DEFAULT
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 --S -import-hot-multiplier=3.0 -import-hot-evolution-factor=1.0 | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-DEFAULT
; HOT-DEFAULT-DAG: define available_externally void @hot1()
; HOT-DEFAULT-DAG: define available_externally void @hot2()
; HOT-DEFAULT-DAG: define available_externally void @calledFromHot()
; HOT-DEFAULT-DAG: define available_externally void @calledFromHot2()
; HOT-DEFAULT-DAG: define available_externally void @none1()
; HOT-DEFAULT-NOT: define available_externally void @cold()
; HOT-DEFAULT-NOT: define available_externally void @hot3()
; HOT-DEFAULT-NOT: define available_externally void @none2()
; HOT-DEFAULT-NOT: define available_externally void @none3()
; HOT-DEFAULT-NOT: define available_externally void @cold2()
; HOT-DEFAULT-NOT: define available_externally void @calledFromCold()
; HOT-DEFAULT-NOT: define available_externally void @calledFromNone()
; This one tests if we decay threshold for hot callsites. With hot-evolution-factor of 0
; we should not import any of calledFromHot functions
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 --S -import-hot-multiplier=3.0 -import-hot-evolution-factor=0.0 | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-EVOLUTION
; HOT-EVOLUTION-DAG: define available_externally void @hot1()
; HOT-EVOLUTION-DAG: define available_externally void @hot2()
; HOT-EVOLUTION-DAG: define available_externally void @none1()
; HOT-EVOLUTION-NOT: define available_externally void @hot3()
; HOT-EVOLUTION-NOT: define available_externally void @cold()
; HOT-EVOLUTION-NOT: define available_externally void @none2()
; HOT-EVOLUTION-NOT: define available_externally void @none3()
; HOT-EVOLUTION-NOT: define available_externally void @cold2()
; HOT-EVOLUTION-NOT: define available_externally void @calledFromHot()
; HOT-EVOLUTION-NOT: define available_externally void @calledFromHot2()
; Test import with hot multiplier 1.0 - treat hot callsites as normal.
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 -import-hot-multiplier=1.0 --S | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-ONE
; HOT-ONE-DAG: define available_externally void @hot1()
; HOT-ONE-DAG: define available_externally void @none1()
; HOT-ONE-NOT: define available_externally void @cold()
; HOT-ONE-NOT: define available_externally void @hot2()
; HOT-ONE-NOT: define available_externally void @hot3()
; HOT-ONE-NOT: define available_externally void @none2()
; HOT-ONE-NOT: define available_externally void @none3()
; HOT-ONE-NOT: define available_externally void @cold2()
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=1 -import-hot-multiplier=1.0 -import-cold-multiplier=1.0 --S | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-COLD-ONE
; HOT-COLD-ONE-DAG: define available_externally void @hot1()
; HOT-COLD-ONE-DAG: define available_externally void @cold()
; HOT-COLD-ONE-DAG: define available_externally void @none1()
; HOT-COLD-ONE-NOT: define available_externally void @hot2()
; HOT-COLD-ONE-NOT: define available_externally void @hot3()
; HOT-COLD-ONE-NOT: define available_externally void @none2()
; HOT-COLD-ONE-NOT: define available_externally void @none3()
; HOT-COLD-ONE-NOT: define available_externally void @cold2()
; Test import with hot multiplier 0.0 and high threshold - don't import functions called from hot callsite.
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=10 -import-hot-multiplier=0.0 -import-cold-multiplier=1.0 --S | FileCheck %s --check-prefix=CHECK --check-prefix=HOT-ZERO
; HOT-ZERO-DAG: define available_externally void @cold()
; HOT-ZERO-DAG: define available_externally void @none1()
; HOT-ZERO-DAG: define available_externally void @none2()
; HOT-ZERO-DAG: define available_externally void @none3()
; HOT-ZERO-DAG: define available_externally void @cold2()
; HOT-ZERO-DAG: define available_externally void @calledFromCold()
; HOT-ZERO-DAG: define available_externally void @calledFromNone()
; HOT-ZERO-NOT: define available_externally void @hot2()
; HOT-ZERO-NOT: define available_externally void @hot1()
; HOT-ZERO-NOT: define available_externally void @hot3()
; HOT-ZERO-NOT: define available_externally void @calledFromHot()
; HOT-ZERO-NOT: define available_externally void @calledFromHot2()
; ModuleID = 'thinlto-function-summary-callgraph.ll'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; This function have high profile count, so entry block is hot.
define void @hot_function(i1 %a, i1 %a2) !prof !20 {
entry:
call void @hot1()
br i1 %a, label %Cold, label %Hot, !prof !41
Cold: ; 1/1000 goes here
call void @cold()
call void @cold2()
call void @hot2()
call void @none1()
br label %exit
Hot: ; 999/1000 goes here
call void @hot2()
call void @hot3()
br i1 %a2, label %None1, label %None2, !prof !42
None1: ; half goes here
call void @none1()
call void @none2()
br label %exit
None2: ; half goes here
call void @none3()
br label %exit
exit:
ret void
}
declare void @hot1() #1
declare void @hot2() #1
declare void @hot3() #1
declare void @cold() #1
declare void @cold2() #1
declare void @none1() #1
declare void @none2() #1
declare void @none3() #1
!41 = !{!"branch_weights", i32 1, i32 1000}
!42 = !{!"branch_weights", i32 1, i32 1}
!llvm.module.flags = !{!1}
!20 = !{!"function_entry_count", i64 110}
!1 = !{i32 1, !"ProfileSummary", !2}
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
!3 = !{!"ProfileFormat", !"InstrProf"}
!4 = !{!"TotalCount", i64 10000}
!5 = !{!"MaxCount", i64 10}
!6 = !{!"MaxInternalCount", i64 1}
!7 = !{!"MaxFunctionCount", i64 1000}
!8 = !{!"NumCounts", i64 3}
!9 = !{!"NumFunctions", i64 3}
!10 = !{!"DetailedSummary", !11}
!11 = !{!12, !13, !14}
!12 = !{i32 10000, i64 100, i32 1}
!13 = !{i32 999000, i64 100, i32 1}
!14 = !{i32 999999, i64 1, i32 2}

View File

@ -1,53 +0,0 @@
; Test to check that callee reached from cold and then hot path gets
; hot thresholds.
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/hotness_based_import2.ll -o %t2.bc
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
; Teset with limit set to 10 and multipliers set to 1. Since cold call to
; hot is first in the other module, we'll first add calledFromHot to worklist
; with threshold decayed by default 0.7 factor. Test ensures that when we
; encounter it again from hot path, we re-enqueue with higher non-decayed
; threshold which will allow it to be imported.
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=10 -import-hot-multiplier=1.0 -import-cold-multiplier=1.0 -S | FileCheck %s --check-prefix=CHECK
; CHECK-DAG: define available_externally void @hot()
; CHECK-DAG: define available_externally void @calledFromHot()
; ModuleID = 'thinlto-function-summary-callgraph.ll'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; This function has a high profile count, so entry block is hot.
define void @hot_function(i1 %a, i1 %a2) !prof !28 {
entry:
call void @hot()
ret void
}
; This function has a low profile count, so entry block is hot.
define void @cold_function(i1 %a, i1 %a2) !prof !29 {
entry:
call void @hot()
ret void
}
declare void @hot() #1
!llvm.module.flags = !{!1}
!1 = !{i32 1, !"ProfileSummary", !2}
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
!3 = !{!"ProfileFormat", !"InstrProf"}
!4 = !{!"TotalCount", i64 222}
!5 = !{!"MaxCount", i64 110}
!6 = !{!"MaxInternalCount", i64 1}
!7 = !{!"MaxFunctionCount", i64 110}
!8 = !{!"NumCounts", i64 4}
!9 = !{!"NumFunctions", i64 3}
!10 = !{!"DetailedSummary", !11}
!11 = !{!12, !13, !14}
!12 = !{i32 10000, i64 110, i32 2}
!13 = !{i32 999000, i64 2, i32 4}
!14 = !{i32 999999, i64 2, i32 4}
!28 = !{!"function_entry_count", i64 110}
!29 = !{!"function_entry_count", i64 1}

View File

@ -1,19 +0,0 @@
; Do setup work for all below tests: generate bitcode and combined index
; RUN: opt -module-summary %s -o %t.bc
; RUN: opt -module-summary %p/Inputs/inlineasm.ll -o %t2.bc
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
; Attempt the import now, ensure below that file containing inline assembly
; is not imported from. Otherwise we would need to promote its local variable
; used in the inline assembly, which would not see the rename.
; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s
define i32 @main() #0 {
entry:
%f = alloca i64, align 8
call void @foo(i64* %f)
ret i32 0
}
; CHECK: declare void @foo(i64*)
declare void @foo(i64*) #1