Skip to content

Commit efc86aa

Browse files
authored
Merge pull request #68843 from augusto2112/keep-funcs-for-deb-tests
Keep certain function that are potentially used in the debugger
2 parents 3a6a10b + 1c4b67a commit efc86aa

File tree

24 files changed

+253
-184
lines changed

24 files changed

+253
-184
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,10 @@ class SILFunction
855855
/// current SILModule.
856856
bool isPossiblyUsedExternally() const;
857857

858+
/// Helper method which returns whether this function should be preserved so
859+
/// it can potentially be used in the debugger.
860+
bool shouldBePreservedForDebugger() const;
861+
858862
/// In addition to isPossiblyUsedExternally() it returns also true if this
859863
/// is a (private or internal) vtable method which can be referenced by
860864
/// vtables of derived classes outside the compilation unit.

lib/IRGen/GenDecl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,12 +1252,6 @@ static bool isLazilyEmittedFunction(SILFunction &f, SILModule &m) {
12521252
if (f.getDynamicallyReplacedFunction())
12531253
return false;
12541254

1255-
// Needed by lldb to print global variables which are propagated by the
1256-
// mandatory GlobalOpt.
1257-
if (m.getOptions().OptMode == OptimizationMode::NoOptimization &&
1258-
f.isGlobalInit())
1259-
return false;
1260-
12611255
return true;
12621256
}
12631257

@@ -3576,6 +3570,7 @@ llvm::Function *IRGenModule::getAddrOfSILFunction(
35763570
// Mark as llvm.used if @_used, set section if @_section
35773571
if (f->markedAsUsed())
35783572
addUsedGlobal(fn);
3573+
35793574
if (!f->section().empty())
35803575
fn->setSection(f->section());
35813576
if (!f->wasmExportName().empty()) {
@@ -3584,6 +3579,11 @@ llvm::Function *IRGenModule::getAddrOfSILFunction(
35843579
fn->addFnAttrs(attrBuilder);
35853580
}
35863581

3582+
// Also mark as llvm.used any functions that should be kept for the debugger.
3583+
// Only definitions should be kept.
3584+
if (f->shouldBePreservedForDebugger() && !fn->isDeclaration())
3585+
addUsedGlobal(fn);
3586+
35873587
// If `hasCReferences` is true, then the function is either marked with
35883588
// @_silgen_name OR @_cdecl. If it is the latter, it must have a definition
35893589
// associated with it. The combination of the two allows us to identify the

lib/SIL/IR/SILFunction.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,9 @@ SILFunction::isPossiblyUsedExternally() const {
862862
if (markedAsUsed())
863863
return true;
864864

865+
if (shouldBePreservedForDebugger())
866+
return true;
867+
865868
// Declaration marked as `@_alwaysEmitIntoClient` that
866869
// returns opaque result type with availability conditions
867870
// has to be kept alive to emit opaque type metadata descriptor.
@@ -872,6 +875,39 @@ SILFunction::isPossiblyUsedExternally() const {
872875
return swift::isPossiblyUsedExternally(linkage, getModule().isWholeModule());
873876
}
874877

878+
bool SILFunction::shouldBePreservedForDebugger() const {
879+
// Only preserve for the debugger at Onone.
880+
if (getEffectiveOptimizationMode() != OptimizationMode::NoOptimization)
881+
return false;
882+
883+
// Only keep functions defined in this module.
884+
if (!isDefinition())
885+
return false;
886+
887+
// Don't preserve anything markes as always emit into client.
888+
if (markedAsAlwaysEmitIntoClient())
889+
return false;
890+
891+
// Needed by lldb to print global variables which are propagated by the
892+
// mandatory GlobalOpt.
893+
if (isGlobalInit())
894+
return true;
895+
896+
// Preserve any user-written functions.
897+
if (auto declContext = getDeclContext())
898+
if (auto decl = declContext->getAsDecl())
899+
if (!decl->isImplicit())
900+
return true;
901+
902+
// Keep any setters/getters, even compiler generated ones.
903+
if (auto *accessorDecl =
904+
llvm::dyn_cast_or_null<swift::AccessorDecl>(getDeclContext()))
905+
if (accessorDecl->isGetterOrSetter())
906+
return true;
907+
908+
return false;
909+
}
910+
875911
bool SILFunction::isExternallyUsedSymbol() const {
876912
return swift::isPossiblyUsedExternally(getEffectiveSymbolLinkage(),
877913
getModule().isWholeModule());

test/IRGen/asmname.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,36 @@ _ = atan2test(0.0, 0.0)
1111

1212

1313
// Ordinary Swift definitions
14-
// The unused internal and private functions are expected to be eliminated.
14+
// The unused internal and private functions are expected to be kept as they
15+
// may be used from the debugger in unoptimized builds.
1516

1617
public func PlainPublic() { }
1718
internal func PlainInternal() { }
1819
private func PlainPrivate() { }
1920
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s7asmname11PlainPublic
20-
// CHECK-NOT: PlainInternal
21-
// CHECK-NOT: PlainPrivate
21+
// CHECK: define{{( dllexport)?}}{{( protected)?}} hidden swiftcc void @"$s7asmname13PlainInternalyyF
22+
// CHECK: define{{( dllexport)?}}{{( protected)?}} internal swiftcc void @"$s7asmname12PlainPrivate
2223

2324

2425
// Swift _silgen_name definitions
25-
// The private function is expected to be eliminated
26-
// but the internal function must survive for C use.
26+
// The private function is expected
27+
// to be eliminated as it may be used from the
28+
// debugger in unoptimized builds,
29+
// and the internal function must survive for C use.
2730
// Only the C-named definition is emitted.
2831

2932
@_silgen_name("silgen_name_public") public func SilgenNamePublic() { }
3033
@_silgen_name("silgen_name_internal") internal func SilgenNameInternal() { }
3134
@_silgen_name("silgen_name_private") private func SilgenNamePrivate() { }
3235
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @silgen_name_public
3336
// CHECK: define hidden swiftcc void @silgen_name_internal
34-
// CHECK-NOT: silgen_name_private
37+
// CHECK: define internal swiftcc void @silgen_name_private
3538
// CHECK-NOT: SilgenName
3639

3740

3841
// Swift cdecl definitions
39-
// The private functions are expected to be eliminated
40-
// but the internal functions must survive for C use.
42+
// The private functions are expected to be kept as it may be used from the debugger,
43+
// and the internal functions must survive for C use.
4144
// Both a C-named definition and a Swift-named definition are emitted.
4245

4346
@_cdecl("cdecl_public") public func CDeclPublic() { }
@@ -47,4 +50,4 @@ private func PlainPrivate() { }
4750
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s7asmname11CDeclPublic
4851
// CHECK: define hidden void @cdecl_internal
4952
// CHECK: define hidden swiftcc void @"$s7asmname13CDeclInternal
50-
// CHECK-NOT: cdecl_private
53+
// CHECK: define internal void @cdecl_private()

test/IRGen/async/run-call-class-witnessmethod-void-to-void.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ protocol P {
2828
// CHECK: exiting call_f
2929

3030
// CHECK-LL: @"$s4main1PPAAE1fyyYaFTu" = hidden global %swift.async_func_pointer
31-
// CHECK-LL: @"$s4main6call_fyyxYaAA1PRzlFTu" = hidden global %swift.async_func_pointer
3231
// CHECK-LL: @"$s4main1XCAA1PA2aDP1fyyYaFTWTu" = internal global %swift.async_func_pointer
32+
// CHECK-LL: @"$s4main6call_fyyxYaAA1PRzlFTu" = hidden global %swift.async_func_pointer
3333

3434
extension P {
3535
// CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main1PPAAE1fyyYaF"(

test/IRGen/objc_implementation.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
// RUN: %FileCheck --input-file %t.ir --check-prefix NEGATIVE %s
77
// REQUIRES: objc_interop
88

9+
// CHECK: [[selector_data_implProperty:@[^, ]+]] = private global [13 x i8] c"implProperty\00", section "__TEXT,__objc_methname,cstring_literals", align 1
10+
// CHECK: [[selector_data_setImplProperty_:@[^, ]+]] = private global [17 x i8] c"setImplProperty:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
11+
912
// CHECK: [[selector_data_mainMethod_:@[^, ]+]] = private global [12 x i8] c"mainMethod:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
1013

1114
//
@@ -19,8 +22,6 @@
1922
// TODO: Why the extra i32 field above?
2023

2124
// Class
22-
// CHECK: [[selector_data_implProperty:@[^, ]+]] = private global [13 x i8] c"implProperty\00", section "__TEXT,__objc_methname,cstring_literals", align 1
23-
// CHECK: [[selector_data_setImplProperty_:@[^, ]+]] = private global [17 x i8] c"setImplProperty:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
2425
// CHECK: [[selector_data__cxx_destruct:@[^, ]+]] = private global [14 x i8] c".cxx_destruct\00", section "__TEXT,__objc_methname,cstring_literals", align 1
2526
// CHECK: [[_INSTANCE_METHODS_ImplClass:@[^, ]+]] = internal constant { i32, i32, [7 x { ptr, ptr, ptr }] } { i32 24, i32 7, [7 x { ptr, ptr, ptr }] [{ ptr, ptr, ptr } { ptr @"\01L_selector_data(init)", ptr @".str.7.@16@0:8", ptr @"$sSo9ImplClassC19objc_implementationEABycfcTo{{(\.ptrauth)?}}" }, { ptr, ptr, ptr } { ptr [[selector_data_implProperty]], ptr @".str.7.i16@0:8", ptr @"$sSo9ImplClassC19objc_implementationE12implPropertys5Int32VvgTo{{(\.ptrauth)?}}" }, { ptr, ptr, ptr } { ptr [[selector_data_setImplProperty_]], ptr @".str.10.v20@0:8i16", ptr @"$sSo9ImplClassC19objc_implementationE12implPropertys5Int32VvsTo{{(\.ptrauth)?}}" }, { ptr, ptr, ptr } { ptr [[selector_data_mainMethod_]], ptr @".str.10.v20@0:8i16", ptr @"$sSo9ImplClassC19objc_implementationE10mainMethodyys5Int32VFTo{{(\.ptrauth)?}}" }, { ptr, ptr, ptr } { ptr @"\01L_selector_data(copyWithZone:)", ptr @".str.11.@24@0:8^v16", ptr @"$sSo9ImplClassC19objc_implementationE4copy4withypSg10ObjectiveC6NSZoneVSg_tFTo{{(\.ptrauth)?}}" }, { ptr, ptr, ptr } { ptr @"\01L_selector_data(dealloc)", ptr @".str.7.v16@0:8", ptr @"$sSo9ImplClassC19objc_implementationEfDTo{{(\.ptrauth)?}}" }, { ptr, ptr, ptr } { ptr [[selector_data__cxx_destruct]], ptr @".str.7.v16@0:8", ptr @"$sSo9ImplClassCfETo{{(\.ptrauth)?}}" }] }, section "__DATA, __objc_data", align 8
2627
// CHECK: [[_IVARS_ImplClass:@[^, ]+]] = internal constant { i32, i32, [2 x { ptr, ptr, ptr, i32, i32 }] } { i32 32, i32 2, [2 x { ptr, ptr, ptr, i32, i32 }] [{ ptr, ptr, ptr, i32, i32 } { ptr @"$sSo9ImplClassC19objc_implementationE12implPropertys5Int32VvpWvd", ptr @.str.12.implProperty, ptr @.str.0., i32 2, i32 4 }, { ptr, ptr, ptr, i32, i32 } { ptr @"$sSo9ImplClassC19objc_implementationE13implProperty2So8NSObjectCSgvpWvd", ptr @.str.13.implProperty2, ptr @.str.0., i32 3, i32 8 }] }, section "__DATA, __objc_const", align 8
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %target-swiftc_driver %s -g -Onone -emit-ir | %FileCheck %s
2+
3+
// Check that unused functions are preserved at Onone.
4+
func unused() {
5+
}
6+
7+
// Property wrappers generate transparent getters, which we would like to check still exist at Onone.
8+
@propertyWrapper
9+
struct IntWrapper {
10+
private var storage = 42
11+
var wrappedValue: Int {
12+
return storage
13+
}
14+
}
15+
16+
public class User {
17+
@IntWrapper private var number: Int
18+
19+
func f() {
20+
// Force the generation of the getter
21+
_ = self.number
22+
}
23+
}
24+
let c = User()
25+
c.f()
26+
27+
// CHECK: !DISubprogram(name: "unused", linkageName: "$s21preserve_for_debugger6unusedyyF"
28+
// CHECK: !DISubprogram(name: "number.get"

test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_distinct_generic_class.swift

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,6 @@ func doit() {
117117
}
118118
doit()
119119

120-
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCMa"([[INT]] [[METADATA_REQUEST:%[0-9]+]], ptr [[ARGUMENT1_METADATA:%[0-9]+]], ptr [[ARGUMENT2_METADATA:%[0-9]+]]) #{{[0-9]+}} {{(section)?.*}}{
121-
// CHECK: call swiftcc %swift.metadata_response @__swift_instantiateCanonicalPrespecializedGenericMetadata(
122-
// CHECK-SAME: [[INT]] [[METADATA_REQUEST]],
123-
// CHECK-SAME: ptr [[ARGUMENT1_METADATA]],
124-
// CHECK-SAME: ptr [[ARGUMENT2_METADATA]],
125-
// CHECK-SAME: ptr undef,
126-
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn
127-
// CHECK-SAME: )
128-
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
129-
// CHECK: }
130-
131-
132120
// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_4]]LLCyAA9Argument1ACLLCySiGAA9Argument2ACLLCySSGGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]}} {{(section)?.*}}{
133121
// CHECK: entry:
134122
// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0)
@@ -147,3 +135,13 @@ doit()
147135
// CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]]
148136
// CHECK: }
149137

138+
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCMa"([[INT]] [[METADATA_REQUEST:%[0-9]+]], ptr [[ARGUMENT1_METADATA:%[0-9]+]], ptr [[ARGUMENT2_METADATA:%[0-9]+]]) #{{[0-9]+}} {{(section)?.*}}{
139+
// CHECK: call swiftcc %swift.metadata_response @__swift_instantiateCanonicalPrespecializedGenericMetadata(
140+
// CHECK-SAME: [[INT]] [[METADATA_REQUEST]],
141+
// CHECK-SAME: ptr [[ARGUMENT1_METADATA]],
142+
// CHECK-SAME: ptr [[ARGUMENT2_METADATA]],
143+
// CHECK-SAME: ptr undef,
144+
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn
145+
// CHECK-SAME: )
146+
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
147+
// CHECK: }

test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_different_value.swift

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,6 @@ func doit() {
109109
}
110110
doit()
111111

112-
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCMa"([[INT]] [[METADATA_REQUEST:%[0-9]+]], ptr [[ARGUMENT1_METADATA:%[0-9]+]], ptr [[ARGUMENT2_METADATA:%[0-9]+]]) #{{[0-9]+}} {{(section)?.*}}{
113-
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateCanonicalPrespecializedGenericMetadata(
114-
// CHECK-SAME: [[INT]] [[METADATA_REQUEST]],
115-
// CHECK-SAME: ptr [[ARGUMENT1_METADATA]],
116-
// CHECK-SAME: ptr [[ARGUMENT2_METADATA]],
117-
// CHECK-SAME: ptr undef,
118-
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn
119-
// CHECK: )
120-
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
121-
// CHECK: }
122-
123-
124112
// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_4]]LLCyAA9Argument1ACLLCySiGAFySSGGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]}} {{(section)?.*}}{
125113
// CHECK: entry:
126114
// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0)
@@ -141,4 +129,13 @@ doit()
141129
// CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]]
142130
// CHECK: }
143131

144-
132+
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCMa"([[INT]] [[METADATA_REQUEST:%[0-9]+]], ptr [[ARGUMENT1_METADATA:%[0-9]+]], ptr [[ARGUMENT2_METADATA:%[0-9]+]]) #{{[0-9]+}} {{(section)?.*}}{
133+
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateCanonicalPrespecializedGenericMetadata(
134+
// CHECK-SAME: [[INT]] [[METADATA_REQUEST]],
135+
// CHECK-SAME: ptr [[ARGUMENT1_METADATA]],
136+
// CHECK-SAME: ptr [[ARGUMENT2_METADATA]],
137+
// CHECK-SAME: ptr undef,
138+
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn
139+
// CHECK: )
140+
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
141+
// CHECK: }

test/IRGen/prespecialized-metadata/class-fileprivate-2argument-1_distinct_use-1st_argument_generic_class-2nd_argument_same_generic_class_same_value.swift

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,6 @@ func doit() {
108108
}
109109
doit()
110110

111-
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCMa"([[INT]] [[METADATA_REQUEST:%[0-9]+]], ptr [[ARGUMENT1_METADATA:%[0-9]+]], ptr [[ARGUMENT2_METADATA:%[0-9]+]]) #{{[0-9]+}} {{(section)?.*}}{
112-
// CHECK: entry:
113-
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateCanonicalPrespecializedGenericMetadata(
114-
// CHECK-SAME: [[INT]] [[METADATA_REQUEST]],
115-
// CHECK-SAME: ptr [[ARGUMENT1_METADATA]],
116-
// CHECK-SAME: ptr [[ARGUMENT2_METADATA]],
117-
// CHECK-SAME: ptr undef,
118-
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn
119-
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMz
120-
// CHECK: )
121-
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
122-
// CHECK: }
123-
124-
125111
// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_4]]LLCyAA9Argument1ACLLCySiGAGGMb"([[INT]] {{%[0-9]+}}) {{#[0-9]}} {{(section)?.*}}{
126112
// CHECK: entry:
127113
// CHECK: call swiftcc %swift.metadata_response @"$s4main9Argument1[[UNIQUE_ID_1]]LLCySiGMb"([[INT]] 0)
@@ -141,3 +127,16 @@ doit()
141127
// CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1
142128
// CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]]
143129
// CHECK: }
130+
131+
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]LLCMa"([[INT]] [[METADATA_REQUEST:%[0-9]+]], ptr [[ARGUMENT1_METADATA:%[0-9]+]], ptr [[ARGUMENT2_METADATA:%[0-9]+]]) #{{[0-9]+}} {{(section)?.*}}{
132+
// CHECK: entry:
133+
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateCanonicalPrespecializedGenericMetadata(
134+
// CHECK-SAME: [[INT]] [[METADATA_REQUEST]],
135+
// CHECK-SAME: ptr [[ARGUMENT1_METADATA]],
136+
// CHECK-SAME: ptr [[ARGUMENT2_METADATA]],
137+
// CHECK-SAME: ptr undef,
138+
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMn
139+
// CHECK-SAME: $s4main5Value[[UNIQUE_ID_1]]LLCMz
140+
// CHECK: )
141+
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
142+
// CHECK: }

test/IRGen/prespecialized-metadata/class-fileprivate-inmodule-1arg-2ancs-1distinct_use-1st_anc_gen-1arg-1st_arg_con_int-2nd_anc_gen-1st-arg_con_double.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ func doit() {
122122
}
123123
doit()
124124

125+
// CHECK: ; Function Attrs: noinline nounwind memory(none)
126+
// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]CySSGMb"([[INT]] {{%[0-9]+}}) #{{[0-9]+}} {{(section)?.*}}{
127+
// CHECK: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0)
128+
// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0)
129+
// CHECK-unknown: ret
130+
// CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call ptr @objc_opt_self(
131+
// CHECK-SAME: @"$s4main5Value[[UNIQUE_ID_1]]CySSGMf"
132+
// CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, ptr [[INITIALIZED_CLASS]], 0
133+
// CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1
134+
// CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]]
135+
// CHECK: }
136+
125137
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CMa"([[INT]] [[METADATA_REQUEST:%[0-9]+]], ptr %1) #{{[0-9]+}} {{(section)?.*}}{
126138
// CHECK: entry:
127139
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateCanonicalPrespecializedGenericMetadata(
@@ -162,18 +174,6 @@ doit()
162174
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
163175
// CHECK: }
164176

165-
// CHECK: ; Function Attrs: noinline nounwind memory(none)
166-
// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]CySSGMb"([[INT]] {{%[0-9]+}}) #{{[0-9]+}} {{(section)?.*}}{
167-
// CHECK: call swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0)
168-
// CHECK-NOT: call swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CySiGMb"([[INT]] 0)
169-
// CHECK-unknown: ret
170-
// CHECK-apple: [[INITIALIZED_CLASS:%[0-9]+]] = call ptr @objc_opt_self(
171-
// CHECK-SAME: @"$s4main5Value[[UNIQUE_ID_1]]CySSGMf"
172-
// CHECK-apple: [[PARTIAL_METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response undef, ptr [[INITIALIZED_CLASS]], 0
173-
// CHECK-apple: [[METADATA_RESPONSE:%[0-9]+]] = insertvalue %swift.metadata_response [[PARTIAL_METADATA_RESPONSE]], [[INT]] 0, 1
174-
// CHECK-apple: ret %swift.metadata_response [[METADATA_RESPONSE]]
175-
// CHECK: }
176-
177177
// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main9Ancestor1[[UNIQUE_ID_1]]CySiGMb"([[INT]] {{%[0-9]+}})
178178

179179
// CHECK: define linkonce_odr hidden swiftcc %swift.metadata_response @"$s4main9Ancestor2[[UNIQUE_ID_1]]CySdGMb"([[INT]] {{%[0-9]+}})

0 commit comments

Comments
 (0)