2017-01-05 06:54:33 +08:00
|
|
|
; Do setup work for all below tests: generate bitcode and combined index
|
|
|
|
; RUN: opt -module-summary %s -o %t.bc -bitcode-mdindex-threshold=0
|
|
|
|
; RUN: opt -module-summary %p/Inputs/lazyload_metadata.ll -o %t2.bc -bitcode-mdindex-threshold=0
|
|
|
|
; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %t2.bc
|
2017-01-05 09:08:01 +08:00
|
|
|
; REQUIRES: asserts
|
2017-01-05 06:54:33 +08:00
|
|
|
|
|
|
|
; Check that importing @globalfunc1 does not trigger loading all the global
|
|
|
|
; metadata for @globalfunc2 and @globalfunc3
|
|
|
|
|
|
|
|
; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t3.bc \
|
|
|
|
; RUN: -o /dev/null -stats \
|
|
|
|
; RUN: 2>&1 | FileCheck %s -check-prefix=LAZY
|
2017-11-03 06:26:51 +08:00
|
|
|
; LAZY: 55 bitcode-reader - Number of Metadata records loaded
|
2017-01-21 04:29:16 +08:00
|
|
|
; LAZY: 2 bitcode-reader - Number of MDStrings loaded
|
2017-01-05 06:54:33 +08:00
|
|
|
|
|
|
|
; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t3.bc \
|
|
|
|
; RUN: -o /dev/null -disable-ondemand-mds-loading -stats \
|
|
|
|
; RUN: 2>&1 | FileCheck %s -check-prefix=NOTLAZY
|
2017-11-03 06:26:51 +08:00
|
|
|
; NOTLAZY: 64 bitcode-reader - Number of Metadata records loaded
|
2017-01-21 04:29:16 +08:00
|
|
|
; NOTLAZY: 7 bitcode-reader - Number of MDStrings loaded
|
2017-01-05 06:54:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-apple-macosx10.11.0"
|
|
|
|
|
|
|
|
define void @globalfunc1(i32 %arg) {
|
2017-01-21 04:29:16 +08:00
|
|
|
%x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
|
2017-01-05 06:54:33 +08:00
|
|
|
%tmp = add i32 %arg, 0, !metadata !2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; We need two functions here that will both reference the same metadata.
|
|
|
|
; This is to force the metadata to be emitted in the global metadata block and
|
|
|
|
; not in the function specific metadata.
|
|
|
|
; These function are not imported and so we don't want to load their metadata.
|
|
|
|
|
|
|
|
define void @globalfunc2(i32 %arg) {
|
2017-01-21 04:29:16 +08:00
|
|
|
%x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
|
2017-01-05 06:54:33 +08:00
|
|
|
%tmp = add i32 %arg, 0, !metadata !1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @globalfunc3(i32 %arg) {
|
|
|
|
%tmp = add i32 %arg, 0, !metadata !1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-01-21 04:29:16 +08:00
|
|
|
declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
|
|
|
|
|
2017-01-05 06:54:33 +08:00
|
|
|
!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
|
|
|
|
!2 = !{!"Hello World"}
|
|
|
|
!3 = !{!"3"}
|
|
|
|
!4 = !{!"4"}
|
|
|
|
!5 = !{!"5"}
|
2017-01-19 02:36:21 +08:00
|
|
|
!6 = !{!9}
|
2017-01-05 06:54:33 +08:00
|
|
|
!7 = !{!"7"}
|
|
|
|
!8 = !{!"8"}
|
2017-03-18 06:17:24 +08:00
|
|
|
!9 = !{!6}
|