1 ; RUN: opt < %s -internalize -S | FileCheck %s
3 %struct.A = type { i32 (...)** }
4 %struct.B = type { i32 (...)** }
5 %struct.C = type { i32 (...)** }
7 ; Class A has default visibility, so has no !vcall_visibility metadata before
9 ; CHECK-NOT: @_ZTV1A = {{.*}}!vcall_visibility
10 @_ZTV1A = dso_local unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%struct.A*)* @_ZN1A3fooEv to i8*)] }, align 8, !type !0, !type !1
12 ; Class B has hidden visibility but public LTO visibility, so has no
13 ; !vcall_visibility metadata before or after LTO.
14 ; CHECK-NOT: @_ZTV1B = {{.*}}!vcall_visibility
15 @_ZTV1B = hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%struct.B*)* @_ZN1B3fooEv to i8*)] }, align 8, !type !2, !type !3
17 ; Class C has hidden visibility, so the !vcall_visibility metadata is set to 1
18 ; (linkage unit) before LTO, and 2 (translation unit) after LTO.
19 ; CHECK: @_ZTV1C ={{.*}}!vcall_visibility [[MD_TU_VIS:![0-9]+]]
20 @_ZTV1C = hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%struct.C*)* @_ZN1C3fooEv to i8*)] }, align 8, !type !4, !type !5, !vcall_visibility !6
22 ; Class D has translation unit visibility before LTO, and this is not changed
24 ; CHECK: @_ZTVN12_GLOBAL__N_11DE = {{.*}}!vcall_visibility [[MD_TU_VIS:![0-9]+]]
25 @_ZTVN12_GLOBAL__N_11DE = internal unnamed_addr constant { [3 x i8*] } zeroinitializer, align 8, !type !7, !type !9, !vcall_visibility !11
27 define dso_local void @_ZN1A3fooEv(%struct.A* nocapture %this) {
32 define hidden void @_ZN1B3fooEv(%struct.B* nocapture %this) {
37 define hidden void @_ZN1C3fooEv(%struct.C* nocapture %this) {
42 define hidden noalias nonnull i8* @_Z6make_dv() {
44 %call = tail call i8* @_Znwm(i64 8) #3
45 %0 = bitcast i8* %call to i32 (...)***
46 store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN12_GLOBAL__N_11DE, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
50 declare dso_local noalias nonnull i8* @_Znwm(i64)
52 ; CHECK: [[MD_TU_VIS]] = !{i64 2}
53 !0 = !{i64 16, !"_ZTS1A"}
54 !1 = !{i64 16, !"_ZTSM1AFvvE.virtual"}
55 !2 = !{i64 16, !"_ZTS1B"}
56 !3 = !{i64 16, !"_ZTSM1BFvvE.virtual"}
57 !4 = !{i64 16, !"_ZTS1C"}
58 !5 = !{i64 16, !"_ZTSM1CFvvE.virtual"}