• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Do setup work for all below tests: generate bitcode and combined index
2; RUN: opt -module-summary %s -o %t.bc -bitcode-mdindex-threshold=0
3; RUN: opt -module-summary %p/Inputs/lazyload_metadata.ll -o %t2.bc -bitcode-mdindex-threshold=0
4; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %t2.bc
5; REQUIRES: asserts
6
7; Check that importing @globalfunc1 does not trigger loading all the global
8; metadata for @globalfunc2 and @globalfunc3
9
10; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t3.bc \
11; RUN:          -o /dev/null -stats \
12; RUN:  2>&1 | FileCheck %s -check-prefix=LAZY
13; LAZY: 55 bitcode-reader  - Number of Metadata records loaded
14; LAZY: 2 bitcode-reader  - Number of MDStrings loaded
15
16; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t3.bc \
17; RUN:          -o /dev/null -disable-ondemand-mds-loading -stats \
18; RUN:  2>&1 | FileCheck %s -check-prefix=NOTLAZY
19; NOTLAZY: 64 bitcode-reader  - Number of Metadata records loaded
20; NOTLAZY: 7 bitcode-reader  - Number of MDStrings loaded
21
22
23target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
24target triple = "x86_64-apple-macosx10.11.0"
25
26define void @globalfunc1(i32 %arg) {
27  %x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
28  %tmp = add i32 %arg, 0, !metadata !2
29  ret void
30}
31
32; We need two functions here that will both reference the same metadata.
33; This is to force the metadata to be emitted in the global metadata block and
34; not in the function specific metadata.
35; These function are not imported and so we don't want to load their metadata.
36
37define void @globalfunc2(i32 %arg) {
38  %x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
39  %tmp = add i32 %arg, 0, !metadata !1
40  ret void
41}
42
43define void @globalfunc3(i32 %arg) {
44  %tmp = add i32 %arg, 0, !metadata !1
45  ret void
46}
47
48declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
49
50!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
51!2 = !{!"Hello World"}
52!3 = !{!"3"}
53!4 = !{!"4"}
54!5 = !{!"5"}
55!6 = !{!9}
56!7 = !{!"7"}
57!8 = !{!"8"}
58!9 = !{!6}
59