Skip to content

Commit 768fb5d

Browse files
authored
Merge pull request #11943 from slavapestov/reapply-preserve-sil-when-merging-modules
Re-apply "Preserve SIL when merging modules"
2 parents 695ded2 + 86d241b commit 768fb5d

29 files changed

+154
-65
lines changed

lib/AST/Module.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,13 +663,11 @@ ModuleDecl::lookupConformance(Type type, ProtocolDecl *protocol) {
663663
if (auto inherited = dyn_cast<InheritedProtocolConformance>(conformance)) {
664664
// Dig out the conforming nominal type.
665665
auto rootConformance = inherited->getRootNormalConformance();
666-
auto conformingNominal
666+
auto conformingClass
667667
= rootConformance->getType()->getClassOrBoundGenericClass();
668668

669669
// Map up to our superclass's type.
670-
Type superclassTy = type->getSuperclass();
671-
while (superclassTy->getAnyNominal() != conformingNominal)
672-
superclassTy = superclassTy->getSuperclass();
670+
auto superclassTy = type->getSuperclassForDecl(conformingClass);
673671

674672
// Compute the conformance for the inherited type.
675673
auto inheritedConformance = lookupConformance(superclassTy, protocol);

lib/Driver/ToolChains.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,14 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job,
687687
// serialized ASTs.
688688
Arguments.push_back("-parse-as-library");
689689

690+
// Merge serialized SIL from partial modules.
691+
Arguments.push_back("-sil-merge-partial-modules");
692+
693+
// Disable SIL optimization passes; we've already optimized the code in each
694+
// partial mode.
695+
Arguments.push_back("-disable-diagnostic-passes");
696+
Arguments.push_back("-disable-sil-perf-optzns");
697+
690698
addCommonFrontendArgs(*this, context.OI, context.Output, context.Args,
691699
Arguments);
692700
context.Args.AddLastArg(Arguments, options::OPT_import_objc_header);

lib/IRGen/GenMeta.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4034,7 +4034,14 @@ IRGenFunction::emitValueWitnessTableRef(SILType type,
40344034
std::pair<llvm::Value *, llvm::Value *>
40354035
irgen::emitClassFragileInstanceSizeAndAlignMask(IRGenFunction &IGF,
40364036
ClassDecl *theClass,
4037-
llvm::Value *metadata) {
4037+
llvm::Value *metadata) {
4038+
// FIXME: The below checks should capture this property already, but
4039+
// resilient class metadata layout is not fully implemented yet.
4040+
auto expansion = IGF.IGM.getResilienceExpansionForLayout(theClass);
4041+
if (IGF.IGM.isResilient(theClass, expansion)) {
4042+
return emitClassResilientInstanceSizeAndAlignMask(IGF, theClass, metadata);
4043+
}
4044+
40384045
// If the class has fragile fixed layout, return the constant size and
40394046
// alignment.
40404047
if (llvm::Constant *size

lib/SIL/SIL.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,12 @@ swift::getLinkageForProtocolConformance(const NormalProtocolConformance *C,
117117
if (C->isBehaviorConformance())
118118
return (definition ? SILLinkage::Private : SILLinkage::PrivateExternal);
119119

120-
ModuleDecl *conformanceModule = C->getDeclContext()->getParentModule();
121-
122120
// If the conformance was synthesized by the ClangImporter, give it
123121
// shared linkage.
124-
auto typeDecl = C->getType()->getNominalOrBoundGenericNominal();
125-
auto typeUnit = typeDecl->getModuleScopeContext();
126-
if (isa<ClangModuleUnit>(typeUnit)
127-
&& conformanceModule == typeUnit->getParentModule())
122+
if (isa<ClangModuleUnit>(C->getDeclContext()->getModuleScopeContext()))
128123
return SILLinkage::Shared;
129124

125+
auto typeDecl = C->getType()->getNominalOrBoundGenericNominal();
130126
AccessLevel access = std::min(C->getProtocol()->getEffectiveAccess(),
131127
typeDecl->getEffectiveAccess());
132128
switch (access) {

lib/SIL/SILWitnessTable.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "swift/AST/ASTMangler.h"
2424
#include "swift/AST/Module.h"
2525
#include "swift/AST/ProtocolConformance.h"
26+
#include "swift/ClangImporter/ClangModule.h"
2627
#include "swift/SIL/SILModule.h"
2728
#include "llvm/ADT/SmallString.h"
2829

@@ -160,6 +161,11 @@ Identifier SILWitnessTable::getIdentifier() const {
160161
bool SILWitnessTable::conformanceIsSerialized(ProtocolConformance *conformance,
161162
ResilienceStrategy strategy,
162163
bool silSerializeWitnessTables) {
164+
// Serialize witness tables for conformances synthesized by
165+
// the ClangImporter.
166+
if (isa<ClangModuleUnit>(conformance->getDeclContext()->getModuleScopeContext()))
167+
return true;
168+
163169
auto *nominal = conformance->getType()->getAnyNominal();
164170
// Only serialize if the witness table is sufficiently static, and resilience
165171
// is explicitly enabled for this compilation or if we serialize all eligible

test/ClangImporter/enum-error.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// REQUIRES: OS=macosx
22

3-
// RUN: %target-swift-frontend -DVALUE -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=VALUE
4-
// RUN: %target-swift-frontend -DEMPTYCATCH -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=EMPTYCATCH
5-
// RUN: %target-swift-frontend -DASQEXPR -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=ASQEXPR
6-
// RUN: %target-swift-frontend -DASBANGEXPR -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=ASBANGEXPR
7-
// RUN: %target-swift-frontend -DCATCHIS -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=CATCHIS
8-
// RUN: %target-swift-frontend -DCATCHAS -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=CATCHAS
9-
// RUN: %target-swift-frontend -DGENERICONLY -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=GENERICONLY
10-
11-
// RUN: not %target-swift-frontend -DEXHAUSTIVE -emit-sil -sil-serialize-witness-tables %s -import-objc-header %S/Inputs/enum-error.h 2>&1 | %FileCheck %s -check-prefix=EXHAUSTIVE
3+
// RUN: %target-swift-frontend -DVALUE -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=VALUE
4+
// RUN: %target-swift-frontend -DEMPTYCATCH -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=EMPTYCATCH
5+
// RUN: %target-swift-frontend -DASQEXPR -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=ASQEXPR
6+
// RUN: %target-swift-frontend -DASBANGEXPR -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=ASBANGEXPR
7+
// RUN: %target-swift-frontend -DCATCHIS -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=CATCHIS
8+
// RUN: %target-swift-frontend -DCATCHAS -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=CATCHAS
9+
// RUN: %target-swift-frontend -DGENERICONLY -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=GENERICONLY
10+
11+
// RUN: not %target-swift-frontend -DEXHAUSTIVE -emit-sil %s -import-objc-header %S/Inputs/enum-error.h 2>&1 | %FileCheck %s -check-prefix=EXHAUSTIVE
1212
// RUN: %target-swift-frontend -typecheck %s -import-objc-header %S/Inputs/enum-error.h -DERRORS -verify
1313

1414
// RUN: echo '#include "enum-error.h"' > %t.m

test/IRGen/class_resilience.sil

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct %S/../Inputs/resilient_struct.swift
3+
// RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_class.swiftmodule -module-name=resilient_class %S/../Inputs/resilient_class.swift -I %t
4+
// RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience %s | %FileCheck %s
5+
// RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience -O %s
6+
7+
// REQUIRES: CPU=x86_64
8+
9+
sil_stage canonical
10+
11+
import Builtin
12+
import Swift
13+
import SwiftShims
14+
15+
import resilient_class
16+
17+
// Make sure that an alloc_ref of a resilient class loads the size and alignment
18+
// of the instance from metadata.
19+
//
20+
// Perhaps we should not serialize allocating initializers, then this would not
21+
// be an issue.
22+
23+
// CHECK-LABEL: define {{(protected )?}}swiftcc void @allocResilientOutsideParent()
24+
// CHECK: [[META:%.*]] = call %swift.type* @_T015resilient_class22ResilientOutsideParentCMa()
25+
// CHECK-NEXT: [[META_ADDR:%.*]] = bitcast %swift.type* [[META]] to i8*
26+
// CHECK-NEXT: [[SIZE_ADDR:%.*]] = getelementptr inbounds i8, i8* [[META_ADDR]], i32 48
27+
// CHECK-NEXT: [[SIZE_PTR:%.*]] = bitcast i8* [[SIZE_ADDR]] to i32*
28+
// CHECK-NEXT: [[SIZE_2:%.*]] = load i32, i32* [[SIZE_PTR]], align 8
29+
// CHECK-NEXT: [[SIZE:%.*]] = zext i32 [[SIZE_2]] to i64
30+
// CHECK-NEXT: [[ALIGN_ADDR:%.*]] = getelementptr inbounds i8, i8* [[META_ADDR]], i32 52
31+
// CHECK-NEXT: [[ALIGN_PTR:%.*]] = bitcast i8* [[ALIGN_ADDR]] to i16*
32+
// CHECK-NEXT: [[ALIGN_2:%.*]] = load i16, i16* [[ALIGN_PTR]], align 4
33+
// CHECK-NEXT: [[ALIGN:%.*]] = zext i16 [[ALIGN_2]] to i64
34+
// CHECK-NEXT: call noalias %swift.refcounted* @swift_rt_swift_allocObject(%swift.type* [[META]], i64 [[SIZE]], i64 [[ALIGN]])
35+
36+
sil @allocResilientOutsideParent : $@convention(thin) () -> () {
37+
bb0:
38+
%c = alloc_ref $ResilientOutsideParent
39+
dealloc_ref %c : $ResilientOutsideParent
40+
%result = tuple ()
41+
return %result : $()
42+
}

test/SILGen/SILDeclRef.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -emit-sil -sil-serialize-witness-tables %s | %FileCheck %s
2-
// RUN: %target-swift-frontend -emit-sil -sil-serialize-witness-tables %s | %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -module-name="SILDeclRef" - | %FileCheck %s
1+
// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
2+
// RUN: %target-swift-frontend -emit-sil %s | %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -module-name="SILDeclRef" - | %FileCheck %s
33

44
// Check that all SILDeclRefs are represented in the text form with a signature.
55
// This allows to avoid ambiguities which sometimes arise e.g. when a
@@ -62,7 +62,7 @@ public func testBase(b: Base) -> Int32 {
6262
// CHECK-NEXT: #Base.deinit!deallocator: _T010SILDeclRef4BaseCfD // Base.__deallocating_deinit
6363
// CHECK-NEXT: }
6464

65-
// CHECK:sil_witness_table [serialized] Base: P module SILDeclRef {
65+
// CHECK:sil_witness_table Base: P module SILDeclRef {
6666
// CHECK-NEXT: method #P.foo!1: <Self where Self : P> (Self) -> () -> Int32 : @_T010SILDeclRef4BaseCAA1PA2aDP3foos5Int32VyFTW // protocol witness for P.foo()
6767
// CHECK-NEXT: method #P.foo!1: <Self where Self : P> (Self) -> (Int32) -> () : @_T010SILDeclRef4BaseCAA1PA2aDP3fooys5Int32V1n_tFTW // protocol witness for P.foo(n:) in conformance Base
6868
// CHECK-NEXT: }

test/SILGen/external-associated-type-conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-silgen -sil-serialize-witness-tables -import-objc-header %S/Inputs/external-associated-type-conformance.h %s -enable-sil-ownership | %FileCheck %s
1+
// RUN: %target-swift-frontend -emit-silgen -import-objc-header %S/Inputs/external-associated-type-conformance.h %s -enable-sil-ownership | %FileCheck %s
22
// REQUIRES: objc_interop
33

44
extension BadError: LocalizedError {}

test/SILGen/guaranteed_self.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -sil-serialize-witness-tables %s -disable-objc-attr-requires-foundation-module -enable-sil-ownership | %FileCheck %s
1+
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s -disable-objc-attr-requires-foundation-module -enable-sil-ownership | %FileCheck %s
22

33
protocol Fooable {
44
init()
@@ -417,7 +417,7 @@ func AO_curryThunk<T>(_ ao: AO<T>) -> ((AO<T>) -> (Int) -> ()/*, Int -> ()*/) {
417417
// correctly if we are asked to.
418418
// ----------------------------------------------------------------------------
419419

420-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @_T015guaranteed_self9FakeArrayVAA8SequenceA2aDP17_constrainElement{{[_0-9a-zA-Z]*}}FTW : $@convention(witness_method) (@in FakeElement, @in_guaranteed FakeArray) -> () {
420+
// CHECK-LABEL: sil private [transparent] [thunk] @_T015guaranteed_self9FakeArrayVAA8SequenceA2aDP17_constrainElement{{[_0-9a-zA-Z]*}}FTW : $@convention(witness_method) (@in FakeElement, @in_guaranteed FakeArray) -> () {
421421
// CHECK: bb0([[ARG0_PTR:%.*]] : @trivial $*FakeElement, [[ARG1_PTR:%.*]] : @trivial $*FakeArray):
422422
// CHECK: [[GUARANTEED_COPY_STACK_SLOT:%.*]] = alloc_stack $FakeArray
423423
// CHECK: copy_addr [[ARG1_PTR]] to [initialization] [[GUARANTEED_COPY_STACK_SLOT]]

test/SILGen/objc_bridging_any.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xllvm -sil-print-debuginfo -emit-silgen -sil-serialize-witness-tables %s | %FileCheck %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xllvm -sil-print-debuginfo -emit-silgen %s | %FileCheck %s
22
// REQUIRES: objc_interop
33

44
import Foundation

test/SILGen/objc_enum.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -enable-sil-ownership -sil-serialize-witness-tables > %t.out
1+
// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -enable-sil-ownership > %t.out
22
// RUN: %FileCheck -check-prefix=CHECK -check-prefix=CHECK-%target-ptrsize %s < %t.out
33
// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.out
44

test/SILGen/objc_imported_generic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -sil-serialize-witness-tables %s -enable-sil-ownership | %FileCheck %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s -enable-sil-ownership | %FileCheck %s
22
// For integration testing, ensure we get through IRGen too.
33
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -verify -DIRGEN_INTEGRATION_TEST %s
44

test/SILGen/objc_witnesses.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -enable-sil-ownership -emit-silgen -sil-serialize-witness-tables -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -enable-sil-ownership -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
22

33
// REQUIRES: objc_interop
44

@@ -94,7 +94,7 @@ public class Positron : Lepton {
9494
public dynamic var spin: Float = 0.5
9595
}
9696

97-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @_T014objc_witnesses8PositronCAA6LeptonA2aDP4spinSfvgTW
97+
// CHECK-LABEL: sil private [transparent] [thunk] @_T014objc_witnesses8PositronCAA6LeptonA2aDP4spinSfvgTW
9898
// CHECK-LABEL: sil shared [transparent] [serializable] [thunk] @_T014objc_witnesses8PositronC4spinSfvgTD
9999

100100
// Override of property defined in @objc extension

test/SILGen/shared.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -sil-serialize-witness-tables %s -disable-objc-attr-requires-foundation-module -enable-sil-ownership | %FileCheck %s
1+
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s -disable-objc-attr-requires-foundation-module -enable-sil-ownership | %FileCheck %s
22

33
class RefAggregate {}
44
struct ValueAggregate { let x = RefAggregate() }

test/SILGen/testable-multifile.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// RUN: %empty-directory(%t)
44
// RUN: %target-swift-frontend -emit-module %S/Inputs/TestableMultifileHelper.swift -enable-testing -enable-sil-ownership -o %t
55

6-
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership -sil-serialize-witness-tables -I %t %s %S/testable-multifile-other.swift -module-name main | %FileCheck %s
7-
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership -sil-serialize-witness-tables -I %t %S/testable-multifile-other.swift %s -module-name main | %FileCheck %s
8-
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership -sil-serialize-witness-tables -I %t -primary-file %s %S/testable-multifile-other.swift -module-name main | %FileCheck %s
6+
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership -I %t %s %S/testable-multifile-other.swift -module-name main | %FileCheck %s
7+
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership -I %t %S/testable-multifile-other.swift %s -module-name main | %FileCheck %s
8+
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership -I %t -primary-file %s %S/testable-multifile-other.swift -module-name main | %FileCheck %s
99

1010
// Just make sure we don't crash later on.
1111
// RUN: %target-swift-frontend -enable-sil-ownership -emit-ir -I %t -primary-file %s %S/testable-multifile-other.swift -module-name main -o /dev/null
@@ -62,6 +62,6 @@ public class PublicSub: Base {
6262
// CHECK-NEXT: method #Fooable.foo!1: {{.*}} : @_T04main7FooImplVAA7FooableA2aDP3fooyyFTW
6363
// CHECK-NEXT: }
6464

65-
// CHECK-LABEL: sil_witness_table [serialized] PublicFooImpl: Fooable module main {
65+
// CHECK-LABEL: sil_witness_table PublicFooImpl: Fooable module main {
6666
// CHECK-NEXT: method #Fooable.foo!1: {{.*}} : @_T04main13PublicFooImplVAA7FooableA2aDP3fooyyFTW
6767
// CHECK-NEXT: }

test/SILGen/witness_accessibility.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -sil-serialize-witness-tables -enable-sil-ownership %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -enable-sil-ownership %s | %FileCheck %s
22

33
public protocol P {
44
func publicRequirement()
@@ -39,4 +39,4 @@ public struct S : R {}
3939
// the use of the 'public' keyword inside an extension of 'R'
4040
// should generate a warning, since it has no effect.
4141

42-
// CHECK-LABEL: sil [transparent] [thunk] @_T021witness_accessibility1SVAA1PA2aDP17publicRequirementyyFTW
42+
// CHECK-LABEL: sil private [transparent] [thunk] @_T021witness_accessibility1SVAA1PA2aDP17publicRequirementyyFTW

test/SILGen/witness_same_type.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-silgen -sil-serialize-witness-tables -enable-sil-ownership %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership %s | %FileCheck %s
22
// RUN: %target-swift-frontend -enable-sil-ownership -emit-ir %s
33

44
protocol Fooable {
@@ -19,7 +19,7 @@ struct Foo: Fooable {
1919
}
2020

2121
// rdar://problem/19049566
22-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @_T017witness_same_type14LazySequenceOfVyxq_Gs0E0AAsAERz7ElementQzRs_r0_lsAEP12makeIterator0I0QzyFTW : $@convention(witness_method) <τ_0_0, τ_0_1 where τ_0_0 : Sequence, τ_0_1 == τ_0_0.Element> (@in_guaranteed LazySequenceOf<τ_0_0, τ_0_1>) -> @out AnyIterator<τ_0_1>
22+
// CHECK-LABEL: sil private [transparent] [thunk] @_T017witness_same_type14LazySequenceOfVyxq_Gs0E0AAsAERz7ElementQzRs_r0_lsAEP12makeIterator0I0QzyFTW : $@convention(witness_method) <τ_0_0, τ_0_1 where τ_0_0 : Sequence, τ_0_1 == τ_0_0.Element> (@in_guaranteed LazySequenceOf<τ_0_0, τ_0_1>) -> @out AnyIterator<τ_0_1>
2323
public struct LazySequenceOf<SS : Sequence, A where SS.Iterator.Element == A> : Sequence {
2424
public func makeIterator() -> AnyIterator<A> {
2525
var opt: AnyIterator<A>?

0 commit comments

Comments
 (0)