• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -thinlto-bc -o %t %s
2; RUN: llvm-modextract -n 0 -o - %t | llvm-dis | FileCheck --check-prefix=THIN %s
3; RUN: llvm-modextract -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=MERGED %s
4
5target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-pc-windows-msvc19.0.24215"
7
8; Internal comdat leader with type metadata. All comdat members need to live
9; in the merged module, and the comdat needs to be renamed.
10; MERGED: ${{"?lwt[^ ]+}} = comdat any
11$lwt = comdat any
12
13; External comdat leader, type metadata on non-leader. All comdat
14; members need to live in the merged module, internal members need to
15; be renamed.
16; MERGED: $nlwt = comdat any
17$nlwt = comdat any
18
19; Comdat with two members without type metadata. All comdat members live in
20; the ThinLTO module and no renaming needs to take place.
21; THIN: $nt = comdat any
22$nt = comdat any
23
24; MERGED: @lwt_aliasee = private unnamed_addr global
25; MERGED-SAME: comdat(${{"?lwt[^ ]+}})
26@lwt_aliasee = private unnamed_addr global [1 x i8*] [i8* null], comdat($lwt), !type !0
27
28; MERGED: {{@"?lwt_nl[^ ]+}} = hidden unnamed_addr global
29; MERGED-SAME: comdat(${{"?lwt[^ ]+}})
30; THIN: {{@"?lwt_nl[^ ]+}} = external hidden
31@lwt_nl = internal unnamed_addr global i32 0, comdat($lwt)
32
33; MERGED: @nlwt_aliasee = private unnamed_addr global
34; MERGED-SAME: comdat($nlwt)
35@nlwt_aliasee = private unnamed_addr global [1 x i8*] [i8* null], comdat($nlwt), !type !0
36
37; MERGED: @nlwt = unnamed_addr global
38; MERGED-SAME: comdat
39; THIN: @nlwt = external
40@nlwt = unnamed_addr global i32 0, comdat
41
42; THIN: @nt = internal
43; THIN-SAME: comdat
44@nt = internal unnamed_addr global [1 x i8*] [i8* null], comdat
45
46; THIN: @nt_nl = internal
47; THIN-SAME: comdat($nt)
48@nt_nl = internal unnamed_addr global i32 0, comdat($nt)
49
50; MERGED: {{@"?lwt[^ ]+}} = hidden unnamed_addr alias
51; THIN: {{@"?lwt[^ ]+}} = external hidden
52@lwt = internal unnamed_addr alias [1 x i8*], [1 x i8*]* @lwt_aliasee
53
54; MERGED: {{@"?nlwt_nl[^ ]+}} = hidden unnamed_addr alias
55; THIN: {{@"?nlwt_nl[^ ]+}} = external hidden
56@nlwt_nl = internal unnamed_addr alias [1 x i8*], [1 x i8*]* @nlwt_aliasee
57
58; The functions below exist just to make sure the globals are used.
59define i8* @lwt_fun() {
60  %1 = load i32, i32* @lwt_nl
61  %2 = getelementptr inbounds [1 x i8*], [1 x i8*]* @lwt, i32 0, i32 %1
62  %3 = load i8*, i8** %2
63  ret i8* %3
64}
65
66define i8* @nlwt_fun() {
67  %1 = load i32, i32* @nlwt
68  %2 = getelementptr inbounds [1 x i8*], [1 x i8*]* @nlwt_nl, i32 0, i32 %1
69  %3 = load i8*, i8** %2
70  ret i8* %3
71}
72
73define i8* @nt_fun() {
74  %1 = load i32, i32* @nt_nl
75  %2 = getelementptr inbounds [1 x i8*], [1 x i8*]* @nt, i32 0, i32 %1
76  %3 = load i8*, i8** %2
77  ret i8* %3
78}
79
80!0 = !{i64 8, !"?AVA@@"}
81