diff --git a/include/swift/SIL/TypeLowering.h b/include/swift/SIL/TypeLowering.h index e8ef10e0f457d..eeea1c847d8c6 100644 --- a/include/swift/SIL/TypeLowering.h +++ b/include/swift/SIL/TypeLowering.h @@ -561,8 +561,6 @@ enum class CaptureKind { StorageAddress, /// A local value captured as a constant. Constant, - /// A let constant captured as a pointer to storage - Immutable }; diff --git a/include/swift/SILOptimizer/Utils/InstOptUtils.h b/include/swift/SILOptimizer/Utils/InstOptUtils.h index ed59cefe2ed01..516ff7d0d5e13 100644 --- a/include/swift/SILOptimizer/Utils/InstOptUtils.h +++ b/include/swift/SILOptimizer/Utils/InstOptUtils.h @@ -364,19 +364,12 @@ void releasePartialApplyCapturedArg( SILParameterInfo paramInfo, InstModCallbacks callbacks = InstModCallbacks()); -void deallocPartialApplyCapturedArg( - SILBuilder &builder, SILLocation loc, SILValue arg, - SILParameterInfo paramInfo); - /// Insert destroys of captured arguments of partial_apply [stack]. void insertDestroyOfCapturedArguments( PartialApplyInst *pai, SILBuilder &builder, llvm::function_ref shouldInsertDestroy = [](SILValue arg) -> bool { return true; }); -void insertDeallocOfCapturedArguments( - PartialApplyInst *pai, SILBuilder &builder); - /// This iterator 'looks through' one level of builtin expect users exposing all /// users of the looked through builtin expect instruction i.e it presents a /// view that shows all users as if there were no builtin expect instructions diff --git a/lib/IRGen/GenFunc.cpp b/lib/IRGen/GenFunc.cpp index 2e45641d48167..5888b9b65a874 100644 --- a/lib/IRGen/GenFunc.cpp +++ b/lib/IRGen/GenFunc.cpp @@ -1319,25 +1319,9 @@ Optional irgen::emitFunctionPartialApplication( SmallVector argValTypes; SmallVector argConventions; - // Go over the params and check if any of them can cause the HeapLayout to be non-fixed - // This is needed because we should not consider parameters of kind ClassPointer and Metadata sources - // If not, we may end up with missing TypeMetadata for a type dependent generic parameter - // while generating code for destructor of HeapLayout. - bool considerParameterSources = true; - for (auto param : params) { - SILType argType = IGF.IGM.silConv.getSILType(param, origType); - auto argLoweringTy = getArgumentLoweringType(argType.getASTType(), param); - auto &ti = IGF.getTypeInfoForLowered(argLoweringTy); - - if (!isa(ti)) { - considerParameterSources = false; - break; - } - } - // Reserve space for polymorphic bindings. auto bindings = - NecessaryBindings::forPartialApplyForwarder(IGF.IGM, origType, subs, considerParameterSources); + NecessaryBindings::forPartialApplyForwarder(IGF.IGM, origType, subs); if (!bindings.empty()) { hasSingleSwiftRefcountedContext = No; @@ -1540,7 +1524,7 @@ Optional irgen::emitFunctionPartialApplication( HeapNonFixedOffsets offsets(IGF, layout); if (outType->isNoEscape()) { stackAddr = IGF.emitDynamicAlloca( - IGF.IGM.Int8Ty, layout.isFixedLayout() ? layout.emitSize(IGF.IGM) : offsets.getSize() , Alignment(16)); + IGF.IGM.Int8Ty, layout.emitSize(IGF.IGM), Alignment(16)); stackAddr = stackAddr->withAddress(IGF.Builder.CreateBitCast( stackAddr->getAddress(), IGF.IGM.OpaquePtrTy)); data = stackAddr->getAddress().getAddress(); diff --git a/lib/IRGen/GenProto.cpp b/lib/IRGen/GenProto.cpp index 5efb062f41077..cea7b553f7cfb 100644 --- a/lib/IRGen/GenProto.cpp +++ b/lib/IRGen/GenProto.cpp @@ -112,7 +112,7 @@ class PolymorphicConvention { } public: - PolymorphicConvention(IRGenModule &IGM, CanSILFunctionType fnType, bool considerParameterSources); + PolymorphicConvention(IRGenModule &IGM, CanSILFunctionType fnType); ArrayRef getSources() const { return Sources; } @@ -179,9 +179,8 @@ class PolymorphicConvention { } // end anonymous namespace PolymorphicConvention::PolymorphicConvention(IRGenModule &IGM, - CanSILFunctionType fnType, - bool considerParameterSources = true) - : IGM(IGM), M(*IGM.getSwiftModule()), FnType(fnType){ + CanSILFunctionType fnType) + : IGM(IGM), M(*IGM.getSwiftModule()), FnType(fnType) { initGenerics(); auto rep = fnType->getRepresentation(); @@ -213,18 +212,16 @@ PolymorphicConvention::PolymorphicConvention(IRGenModule &IGM, unsigned selfIndex = ~0U; auto params = fnType->getParameters(); - if (considerParameterSources) { - // Consider 'self' first. - if (fnType->hasSelfParam()) { - selfIndex = params.size() - 1; - considerParameter(params[selfIndex], selfIndex, true); - } + // Consider 'self' first. + if (fnType->hasSelfParam()) { + selfIndex = params.size() - 1; + considerParameter(params[selfIndex], selfIndex, true); + } - // Now consider the rest of the parameters. - for (auto index : indices(params)) { - if (index != selfIndex) - considerParameter(params[index], index, false); - } + // Now consider the rest of the parameters. + for (auto index : indices(params)) { + if (index != selfIndex) + considerParameter(params[index], index, false); } } } @@ -3003,16 +3000,14 @@ NecessaryBindings::forFunctionInvocations(IRGenModule &IGM, NecessaryBindings NecessaryBindings::forPartialApplyForwarder(IRGenModule &IGM, CanSILFunctionType origType, - SubstitutionMap subs, - bool considerParameterSources) { + SubstitutionMap subs) { return computeBindings(IGM, origType, subs, - true /*forPartialApplyForwarder*/, - considerParameterSources); + true /*forPartialApplyForwarder*/); } NecessaryBindings NecessaryBindings::computeBindings( IRGenModule &IGM, CanSILFunctionType origType, SubstitutionMap subs, - bool forPartialApplyForwarder, bool considerParameterSources) { + bool forPartialApplyForwarder) { NecessaryBindings bindings; bindings.forPartialApply = forPartialApplyForwarder; @@ -3022,7 +3017,7 @@ NecessaryBindings NecessaryBindings::computeBindings( return bindings; // Figure out what we're actually required to pass: - PolymorphicConvention convention(IGM, origType, considerParameterSources); + PolymorphicConvention convention(IGM, origType); // - unfulfilled requirements convention.enumerateUnfulfilledRequirements( diff --git a/lib/IRGen/NecessaryBindings.h b/lib/IRGen/NecessaryBindings.h index b4ad8200bbd12..f7745af199268 100644 --- a/lib/IRGen/NecessaryBindings.h +++ b/lib/IRGen/NecessaryBindings.h @@ -59,8 +59,7 @@ class NecessaryBindings { SubstitutionMap subs); static NecessaryBindings forPartialApplyForwarder(IRGenModule &IGM, CanSILFunctionType origType, - SubstitutionMap subs, - bool considerParameterSources = true); + SubstitutionMap subs); /// Add whatever information is necessary to reconstruct type metadata /// for the given type. @@ -99,8 +98,7 @@ class NecessaryBindings { static NecessaryBindings computeBindings(IRGenModule &IGM, CanSILFunctionType origType, SubstitutionMap subs, - bool forPartialApplyForwarder, - bool considerParameterSources = true); + bool forPartialApplyForwarder); }; } // end namespace irgen diff --git a/lib/SIL/SILFunctionType.cpp b/lib/SIL/SILFunctionType.cpp index a4b1c6c7807c8..4923efd947e43 100644 --- a/lib/SIL/SILFunctionType.cpp +++ b/lib/SIL/SILFunctionType.cpp @@ -1460,8 +1460,9 @@ lowerCaptureContextParameters(TypeConverter &TC, SILDeclRef function, case CaptureKind::Constant: { // Constants are captured by value. ParameterConvention convention; - assert (!loweredTL.isAddressOnly()); - if (loweredTL.isTrivial()) { + if (loweredTL.isAddressOnly()) { + convention = ParameterConvention::Indirect_In_Guaranteed; + } else if (loweredTL.isTrivial()) { convention = ParameterConvention::Direct_Unowned; } else { convention = ParameterConvention::Direct_Guaranteed; @@ -1494,16 +1495,6 @@ lowerCaptureContextParameters(TypeConverter &TC, SILDeclRef function, inputs.push_back(param); break; } - case CaptureKind::Immutable: { - // 'let' constants that are address-only are captured as the address of the value - // and will be consumed by the closure. - SILType ty = loweredTy.getAddressType(); - auto param = - SILParameterInfo(ty.getASTType(), - ParameterConvention::Indirect_In_Guaranteed); - inputs.push_back(param); - break; - } } } } diff --git a/lib/SIL/SILVerifier.cpp b/lib/SIL/SILVerifier.cpp index d7660d79bf4c8..454651a34aae3 100644 --- a/lib/SIL/SILVerifier.cpp +++ b/lib/SIL/SILVerifier.cpp @@ -1117,7 +1117,7 @@ class SILVerifier : public SILVerifierBase { if (VarInfo) if (unsigned ArgNo = VarInfo->ArgNo) { // It is a function argument. - if (ArgNo < DebugVars.size() && !DebugVars[ArgNo].empty() && !VarInfo->Name.empty()) { + if (ArgNo < DebugVars.size() && !DebugVars[ArgNo].empty()) { require( DebugVars[ArgNo] == VarInfo->Name, "Scope contains conflicting debug variables for one function " diff --git a/lib/SIL/TypeLowering.cpp b/lib/SIL/TypeLowering.cpp index c19b9f5f39a71..916e3db4e4e33 100644 --- a/lib/SIL/TypeLowering.cpp +++ b/lib/SIL/TypeLowering.cpp @@ -126,11 +126,6 @@ CaptureKind TypeConverter::getDeclCaptureKind(CapturedValue capture, return CaptureKind::Box; } - // For 'let' constants - if (!var->supportsMutation()) { - return CaptureKind::Immutable; - } - // If we're capturing into a non-escaping closure, we can generally just // capture the address of the value as no-escape. return (capture.isNoEscape() diff --git a/lib/SILGen/SILGenFunction.cpp b/lib/SILGen/SILGenFunction.cpp index a2b53d51c1e6d..53b9621c685bf 100644 --- a/lib/SILGen/SILGenFunction.cpp +++ b/lib/SILGen/SILGenFunction.cpp @@ -262,7 +262,6 @@ void SILGenFunction::emitCaptures(SILLocation loc, case CaptureKind::Constant: capturedArgs.push_back(emitUndef(getLoweredType(type))); break; - case CaptureKind::Immutable: case CaptureKind::StorageAddress: capturedArgs.push_back(emitUndef(getLoweredType(type).getAddressType())); break; @@ -334,23 +333,7 @@ void SILGenFunction::emitCaptures(SILLocation loc, capturedArgs.push_back(emitManagedRValueWithCleanup(Val)); break; } - case CaptureKind::Immutable: { - if (canGuarantee) { - auto entryValue = getAddressValue(Entry.value); - // No-escaping stored declarations are captured as the - // address of the value. - assert(entryValue->getType().isAddress() && "no address for captured var!"); - capturedArgs.push_back(ManagedValue::forLValue(entryValue)); - } - else { - auto entryValue = getAddressValue(Entry.value); - auto addr = emitTemporaryAllocation(vd, entryValue->getType()); - auto val = B.createCopyAddr(loc, entryValue, addr, IsNotTake, - IsInitialization); - capturedArgs.push_back(ManagedValue::forLValue(addr)); - } - break; - } + case CaptureKind::StorageAddress: { auto entryValue = getAddressValue(Entry.value); // No-escaping stored declarations are captured as the diff --git a/lib/SILGen/SILGenProlog.cpp b/lib/SILGen/SILGenProlog.cpp index cd184e7e014bc..e4d94aae962c4 100644 --- a/lib/SILGen/SILGenProlog.cpp +++ b/lib/SILGen/SILGenProlog.cpp @@ -420,7 +420,6 @@ static void emitCaptureArguments(SILGenFunction &SGF, SGF.B.createDebugValueAddr(Loc, addr, DbgVar); break; } - case CaptureKind::Immutable: case CaptureKind::StorageAddress: { // Non-escaping stored decls are captured as the address of the value. auto type = getVarTypeInCaptureContext(); diff --git a/lib/SILOptimizer/Mandatory/ClosureLifetimeFixup.cpp b/lib/SILOptimizer/Mandatory/ClosureLifetimeFixup.cpp index 5c41fd7fc24dd..d65bf58cf58e9 100644 --- a/lib/SILOptimizer/Mandatory/ClosureLifetimeFixup.cpp +++ b/lib/SILOptimizer/Mandatory/ClosureLifetimeFixup.cpp @@ -459,27 +459,6 @@ static bool tryRewriteToPartialApplyStack( saveDeleteInst(convertOrPartialApply); saveDeleteInst(origPA); - ApplySite site(newPA); - SILFunctionConventions calleeConv(site.getSubstCalleeType(), - newPA->getModule()); - - // Since we create temporary allocation for in_guaranteed captures during SILGen, - // the dealloc_stack of it can occur before the apply due to conversion scopes. - // When we insert destroy_addr of the in_guaranteed capture after the apply, - // we may end up with a situation when the dealloc_stack occurs before the destroy_addr. - // The code below proactively removes the dealloc_stack of in_guaranteed capture, - // so that it can be reinserted at the correct place after the destroy_addr below. - for (auto &arg : newPA->getArgumentOperands()) { - unsigned calleeArgumentIndex = site.getCalleeArgIndex(arg); - assert(calleeArgumentIndex >= calleeConv.getSILArgIndexOfFirstParam()); - auto paramInfo = calleeConv.getParamInfoForSILArg(calleeArgumentIndex); - if (paramInfo.getConvention() == ParameterConvention::Indirect_In_Guaranteed) - // go over all the dealloc_stack, remove it - for (auto *use : arg.get()->getUses()) - if (auto *deallocInst = dyn_cast(use->getUser())) - deallocInst->eraseFromParent(); - } - // Insert destroys of arguments after the apply and the dealloc_stack. if (auto *apply = dyn_cast(singleApplyUser)) { auto insertPt = std::next(SILBasicBlock::iterator(apply)); @@ -489,15 +468,11 @@ static bool tryRewriteToPartialApplyStack( SILBuilderWithScope b3(insertPt); b3.createDeallocStack(loc, newPA); insertDestroyOfCapturedArguments(newPA, b3); - // dealloc_stack of the in_guaranteed capture is inserted - insertDeallocOfCapturedArguments(newPA, b3); } else if (auto *tai = dyn_cast(singleApplyUser)) { for (auto *succBB : tai->getSuccessorBlocks()) { SILBuilderWithScope b3(succBB->begin()); b3.createDeallocStack(loc, newPA); insertDestroyOfCapturedArguments(newPA, b3); - // dealloc_stack of the in_guaranteed capture is inserted - insertDeallocOfCapturedArguments(newPA, b3); } } else { llvm_unreachable("Unknown FullApplySite instruction kind"); diff --git a/lib/SILOptimizer/Transforms/TempRValueElimination.cpp b/lib/SILOptimizer/Transforms/TempRValueElimination.cpp index 88b3ef52bd4cb..7bd20bd71d5f4 100644 --- a/lib/SILOptimizer/Transforms/TempRValueElimination.cpp +++ b/lib/SILOptimizer/Transforms/TempRValueElimination.cpp @@ -147,23 +147,11 @@ bool TempRValueOptPass::collectLoads( LLVM_DEBUG(llvm::dbgs() << " Temp use may write/destroy its source" << *user); return false; + case SILInstructionKind::BeginAccessInst: return cast(user)->getAccessKind() == SILAccessKind::Read; - case SILInstructionKind::MarkDependenceInst: { - auto mdi = cast(user); - if (mdi->getBase() == address) { - return true; - } - for (auto *mdiUseOper : mdi->getUses()) { - if (!collectLoads(mdiUseOper, mdiUseOper->getUser(), mdi, srcAddr, - loadInsts)) - return false; - } - return true; - } case SILInstructionKind::ApplyInst: - case SILInstructionKind::PartialApplyInst: case SILInstructionKind::TryApplyInst: { ApplySite apply(user); @@ -662,14 +650,7 @@ TempRValueOptPass::tryOptimizeStoreIntoTemp(StoreInst *si) { toDelete.push_back(fli); break; } - case SILInstructionKind::MarkDependenceInst: { - SILBuilderWithScope builder(user); - auto mdi = cast(user); - auto newInst = builder.createMarkDependence(user->getLoc(), mdi->getValue(), si->getSrc()); - mdi->replaceAllUsesWith(newInst); - toDelete.push_back(user); - break; - } + // ASSUMPTION: no operations that may be handled by this default clause can // destroy tempObj. This includes operations that load the value from memory // and release it. diff --git a/lib/SILOptimizer/Utils/InstOptUtils.cpp b/lib/SILOptimizer/Utils/InstOptUtils.cpp index d67c5aeb741fb..9fc39ea3eecbc 100644 --- a/lib/SILOptimizer/Utils/InstOptUtils.cpp +++ b/lib/SILOptimizer/Utils/InstOptUtils.cpp @@ -1372,15 +1372,6 @@ void swift::releasePartialApplyCapturedArg(SILBuilder &builder, SILLocation loc, callbacks.createdNewInst(u.get()); } -void swift::deallocPartialApplyCapturedArg(SILBuilder &builder, SILLocation loc, - SILValue arg, - SILParameterInfo paramInfo) { - if (!paramInfo.isIndirectInGuaranteed()) - return; - - builder.createDeallocStack(loc, arg); -} - static bool deadMarkDependenceUser(SILInstruction *inst, SmallVectorImpl &deleteInsts) { @@ -1946,22 +1937,6 @@ void swift::insertDestroyOfCapturedArguments( } } -void swift::insertDeallocOfCapturedArguments( - PartialApplyInst *pai, SILBuilder &builder) { - assert(pai->isOnStack()); - - ApplySite site(pai); - SILFunctionConventions calleeConv(site.getSubstCalleeType(), - pai->getModule()); - auto loc = RegularLocation::getAutoGeneratedLocation(); - for (auto &arg : pai->getArgumentOperands()) { - unsigned calleeArgumentIndex = site.getCalleeArgIndex(arg); - assert(calleeArgumentIndex >= calleeConv.getSILArgIndexOfFirstParam()); - auto paramInfo = calleeConv.getParamInfoForSILArg(calleeArgumentIndex); - deallocPartialApplyCapturedArg(builder, loc, arg.get(), paramInfo); - } -} - AbstractFunctionDecl *swift::getBaseMethod(AbstractFunctionDecl *FD) { while (FD->getOverriddenDecl()) { FD = FD->getOverriddenDecl(); diff --git a/test/IRGen/closure.swift b/test/IRGen/closure.swift index ce0c397b5ac82..bcdb8441b0ca3 100644 --- a/test/IRGen/closure.swift +++ b/test/IRGen/closure.swift @@ -31,19 +31,21 @@ func b(seq seq: T) -> (Int) -> Int { // CHECK: } // -- Closure entry point -// CHECK: define internal swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, %swift.opaque* noalias nocapture %1, %swift.type* %T, i8** %T.Ordinable) {{.*}} { +// CHECK: define internal swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, %swift.refcounted* %1, %swift.type* %T, i8** %T.Ordinable) {{.*}} { // -- partial_apply stub // CHECK: define internal swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_TA"(i64 %0, %swift.refcounted* swiftself %1) {{.*}} { // CHECK: entry: -// CHECK: [[CONTEXT:%.*]] = bitcast %swift.refcounted* %1 to <{ %swift.refcounted, [16 x i8] }>* -// CHECK: [[BINDINGSADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted, [16 x i8] }>, <{ %swift.refcounted, [16 x i8] }>* [[CONTEXT]], i32 0, i32 1 +// CHECK: [[CONTEXT:%.*]] = bitcast %swift.refcounted* %1 to <{ %swift.refcounted, [16 x i8], %swift.refcounted* }>* +// CHECK: [[BINDINGSADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted, [16 x i8], %swift.refcounted* }>, <{ %swift.refcounted, [16 x i8], %swift.refcounted* }>* [[CONTEXT]], i32 0, i32 1 // CHECK: [[TYPEADDR:%.*]] = bitcast [16 x i8]* [[BINDINGSADDR]] // CHECK: [[TYPE:%.*]] = load %swift.type*, %swift.type** [[TYPEADDR]], align 8 // CHECK: [[WITNESSADDR_0:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[TYPEADDR]], i32 1 // CHECK: [[WITNESSADDR:%.*]] = bitcast %swift.type** [[WITNESSADDR_0]] // CHECK: [[WITNESS:%.*]] = load i8**, i8*** [[WITNESSADDR]], align 8 -// CHECK: [[RES:%.*]] = tail call swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, %swift.opaque* noalias nocapture {{.*}}, %swift.type* [[TYPE]], i8** [[WITNESS]]) +// CHECK: [[BOXADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted, [16 x i8], %swift.refcounted* }>, <{ %swift.refcounted, [16 x i8], %swift.refcounted* }>* [[CONTEXT]], i32 0, i32 2 +// CHECK: [[BOX:%.*]] = load %swift.refcounted*, %swift.refcounted** [[BOXADDR]], align 8 +// CHECK: [[RES:%.*]] = tail call swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, %swift.refcounted* [[BOX]], %swift.type* [[TYPE]], i8** [[WITNESS]]) // CHECK: ret i64 [[RES]] // CHECK: } @@ -53,7 +55,9 @@ func captures_tuple(x x: (T, U)) -> () -> (T, U) { // CHECK: [[T0:%.*]] = call swiftcc %swift.metadata_response @swift_getTupleTypeMetadata2(i64 0, %swift.type* %T, %swift.type* %U, i8* null, i8** null) // CHECK-NEXT: [[METADATA:%.*]] = extractvalue %swift.metadata_response [[T0]], 0 // CHECK-NOT: @swift_getTupleTypeMetadata2 - // CHECK: ret + // CHECK: [[BOX:%.*]] = call swiftcc { %swift.refcounted*, %swift.opaque* } @swift_allocBox(%swift.type* [[METADATA]]) + // CHECK: [[ADDR:%.*]] = extractvalue { %swift.refcounted*, %swift.opaque* } [[BOX]], 1 + // CHECK: bitcast %swift.opaque* [[ADDR]] to <{}>* return {x} } diff --git a/test/Reflection/typeref_decoding.swift b/test/Reflection/typeref_decoding.swift index 1cf6ffeba7208..96fbc3dda53e5 100644 --- a/test/Reflection/typeref_decoding.swift +++ b/test/Reflection/typeref_decoding.swift @@ -719,7 +719,7 @@ // CHECK: CAPTURE DESCRIPTORS: // CHECK: ==================== // CHECK: - Capture types: -//CHECK: (generic_type_parameter depth=0 index=0) +// CHECK: (builtin Builtin.NativeObject) // CHECK: - Metadata sources: // CHECK: (generic_type_parameter depth=0 index=0) // CHECK: (closure_binding index=0) diff --git a/test/Reflection/typeref_decoding_asan.swift b/test/Reflection/typeref_decoding_asan.swift index 57a186df27dba..21985b1205c5d 100644 --- a/test/Reflection/typeref_decoding_asan.swift +++ b/test/Reflection/typeref_decoding_asan.swift @@ -708,7 +708,7 @@ // CHECK: CAPTURE DESCRIPTORS: // CHECK: ==================== // CHECK: - Capture types: -// CHECK: (generic_type_parameter depth=0 index=0) +// CHECK: (builtin Builtin.NativeObject) // CHECK: - Metadata sources: // CHECK: (generic_type_parameter depth=0 index=0) // CHECK: (closure_binding index=0) diff --git a/test/SILGen/capture_resilience.swift b/test/SILGen/capture_resilience.swift index 72007fdb694eb..36d9db99ac16d 100644 --- a/test/SILGen/capture_resilience.swift +++ b/test/SILGen/capture_resilience.swift @@ -29,7 +29,7 @@ public func hasClosureVar() -> () -> ResilientStruct { @inlinable public func hasInlinableClosureLet() -> () -> ResilientStruct { let s = ResilientStruct() - // CHECK_LABEL: sil shared [serialized] [ossa] @$s18capture_resilience22hasInlinableClosureLetAA15ResilientStructVycyFADycfU_ : $@convention(thin) (@in_guaranteed ResilientStruct) -> @out ResilientStruct + // CHECK-LABEL: sil shared [serialized] [ossa] @$s18capture_resilience22hasInlinableClosureLetAA15ResilientStructVycyFADycfU_ : $@convention(thin) (@guaranteed { var ResilientStruct }) -> @out ResilientStruct return { s } } @@ -63,7 +63,7 @@ public func hasNoEscapeClosureVar() { @inlinable public func hasInlinableNoEscapeClosureLet() { let s = ResilientStruct() - // CHECK-LABEL: sil shared [serialized] [ossa] @$s18capture_resilience30hasInlinableNoEscapeClosureLetyyFAA15ResilientStructVyXEfU_ : $@convention(thin) (@in_guaranteed ResilientStruct) -> @out ResilientStruct + // CHECK-LABEL: sil shared [serialized] [ossa] @$s18capture_resilience30hasInlinableNoEscapeClosureLetyyFAA15ResilientStructVyXEfU_ : $@convention(thin) (@inout_aliasable ResilientStruct) -> @out ResilientStruct consume { s } } diff --git a/test/SILGen/default_arguments_local.swift b/test/SILGen/default_arguments_local.swift index faf8df999103c..c650cee4b4d02 100644 --- a/test/SILGen/default_arguments_local.swift +++ b/test/SILGen/default_arguments_local.swift @@ -22,13 +22,25 @@ func outer(x: Int, y: AnyObject, z: Any, w: T) { // CHECK: destroy_value [[ARG]] : $AnyObject local2() - // CHECK: [[FN1:%.*]] = function_ref @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlFfA_ : $@convention(thin) (@in_guaranteed Any) -> @out Any + // CHECK: [[BOX:%.*]] = alloc_box ${ var Any } + // CHECK: [[BOX_ADDR:%.*]] = project_box [[BOX]] : ${ var Any }, 0 + // CHECK: copy_addr %2 to [initialization] [[BOX_ADDR]] : $*Any + // CHECK: [[BOX_BORROW:%.*]] = begin_borrow [[BOX]] : ${ var Any } + // CHECK: [[FN:%.*]] = function_ref @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlFfA_ : $@convention(thin) (@guaranteed { var Any }) -> @out Any // CHECK: [[STACK:%.*]] = alloc_stack $Any - // CHECK: apply [[FN1]]([[STACK]], %2) : $@convention(thin) (@in_guaranteed Any) -> @out Any - // CHECK: [[FN2:%.*]] = function_ref @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlF : $@convention(thin) (@in_guaranteed Any, @in_guaranteed Any) -> () - // CHECK: apply [[FN2]]([[STACK]], %2) : $@convention(thin) (@in_guaranteed Any, @in_guaranteed Any) -> () + // CHECK: [[BOX2:%.*]] = alloc_box ${ var Any } + // CHECK: [[BOX2_ADDR:%.*]] = project_box [[BOX2]] : ${ var Any }, 0 + // CHECK: copy_addr %2 to [initialization] [[BOX2_ADDR]] : $*Any + // CHECK: [[BOX2_BORROW:%.*]] = begin_borrow [[BOX2]] : ${ var Any } + // CHECK: apply [[FN]]([[STACK]], [[BOX2_BORROW]]) : $@convention(thin) (@guaranteed { var Any }) -> @out Any + // CHECK: end_borrow [[BOX2_BORROW]] : ${ var Any } + // CHECK: destroy_value [[BOX2]] : ${ var Any } + // CHECK: %30 = function_ref @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlF : $@convention(thin) (@in_guaranteed Any, @guaranteed { var Any }) -> () + // CHECK: apply %30([[STACK]], [[BOX_BORROW]]) : $@convention(thin) (@in_guaranteed Any, @guaranteed { var Any }) -> () // CHECK: destroy_addr [[STACK]] : $*Any // CHECK: dealloc_stack [[STACK]] : $*Any + // CHECK: end_borrow [[BOX_BORROW]] : ${ var Any } + // CHECK: destroy_value [[BOX]] : ${ var Any } local3() local4() @@ -40,10 +52,10 @@ func outer(x: Int, y: AnyObject, z: Any, w: T) { // CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local1L_ACySi_tlF : $@convention(thin) (Int, Int) -> () // CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local2L_ADyyXl_tlFfA_ : $@convention(thin) (@guaranteed AnyObject) -> @owned AnyObject // CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local2L_ADyyXl_tlF : $@convention(thin) (@guaranteed AnyObject, @guaranteed AnyObject) -> () -// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlFfA_ : $@convention(thin) (@in_guaranteed Any) -> @out Any -// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlF : $@convention(thin) (@in_guaranteed Any, @in_guaranteed Any) -> () -// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local4L_AFyx_tlF : $@convention(thin) (@in_guaranteed T, @in_guaranteed T) -> () -// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local5L_1uAFyqd___xtr__lFfA0_ : $@convention(thin) (@in_guaranteed T) -> @out T +// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlFfA_ : $@convention(thin) (@guaranteed { var Any }) -> @out Any +// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local3L_AEyyp_tlF : $@convention(thin) (@in_guaranteed Any, @guaranteed { var Any }) -> () +// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local4L_AFyx_tlF : $@convention(thin) (@in_guaranteed T, @guaranteed <τ_0_0> { var τ_0_0 } ) -> () +// CHECK-LABEL: sil private [ossa] @$s23default_arguments_local5outer1x1y1z1wySi_yXlypxtlF6local5L_1uAFyqd___xtr__lFfA0_ : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } ) -> @out T class ArtClass { // CHECK-LABEL: sil hidden [ossa] @$s23default_arguments_local8ArtClassC10selfMethod1uyqd___tlF : $@convention(method) (@in_guaranteed U, @guaranteed ArtClass) -> () diff --git a/test/SILGen/generic_closures.swift b/test/SILGen/generic_closures.swift index 93430405723bf..d208874ecaf8a 100644 --- a/test/SILGen/generic_closures.swift +++ b/test/SILGen/generic_closures.swift @@ -88,13 +88,13 @@ func generic_nocapture_existential(_ x: T, y: Concept) -> Bool { func generic_dependent_context(_ x: T, y: Int) -> T { func foo() -> T { return x } - // CHECK: [[FOO:%.*]] = function_ref @$s16generic_closures0A18_dependent_context{{.*}} : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out τ_0_0 + // CHECK: [[FOO:%.*]] = function_ref @$s16generic_closures0A18_dependent_context{{.*}} : $@convention(thin) <τ_0_0> (@guaranteed <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 // CHECK: [[FOO_CLOSURE:%.*]] = partial_apply [callee_guaranteed] [[FOO]]([[BOX:%.*]]) // CHECK: [[FOO_CLOSURE_CONV:%.*]] = convert_function [[FOO_CLOSURE]] // CHECK: destroy_value [[FOO_CLOSURE_CONV]] let _ = foo - // CHECK: [[FOO:%.*]] = function_ref @$s16generic_closures0A18_dependent_context{{.*}} : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out τ_0_0 + // CHECK: [[FOO:%.*]] = function_ref @$s16generic_closures0A18_dependent_context{{.*}} : $@convention(thin) <τ_0_0> (@guaranteed <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 // CHECK: [[FOO_CLOSURE:%.*]] = apply [[FOO]] // CHECK: return @@ -145,9 +145,9 @@ class NestedGeneric { // CHECK: sil hidden [ossa] @$s16generic_closures018nested_closure_in_A0yxxlF : $@convention(thin) (@in_guaranteed T) -> @out T // CHECK: function_ref [[OUTER_CLOSURE:@\$s16generic_closures018nested_closure_in_A0yxxlFxyXEfU_]] -// CHECK: sil private [ossa] [[OUTER_CLOSURE]] : $@convention(thin) (@in_guaranteed T) -> @out T +// CHECK: sil private [ossa] [[OUTER_CLOSURE]] : $@convention(thin) (@inout_aliasable T) -> @out T // CHECK: function_ref [[INNER_CLOSURE:@\$s16generic_closures018nested_closure_in_A0yxxlFxyXEfU_xyXEfU_]] -// CHECK: sil private [ossa] [[INNER_CLOSURE]] : $@convention(thin) (@in_guaranteed T) -> @out T { +// CHECK: sil private [ossa] [[INNER_CLOSURE]] : $@convention(thin) (@inout_aliasable T) -> @out T { func nested_closure_in_generic(_ x:T) -> T { return { { x }() }() } @@ -255,16 +255,16 @@ func outer_generic(t: T, i: Int) { // CHECK: [[RESULT:%.*]] = apply [[FN]]({{.*}}) : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, Int) -> Int _ = inner_generic1(u: t) - // CHECK: [[FN:%.*]] = function_ref @$s16generic_closures06outer_A01t1iyx_SitlF14inner_generic2L_1uxqd___tr__lF : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @in_guaranteed τ_0_0) -> @out τ_0_0 - // CHECK: [[CLOSURE:%.*]] = partial_apply [callee_guaranteed] [[FN]]([[ARG:%.*]]) : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @in_guaranteed τ_0_0) -> @out τ_0_0 + // CHECK: [[FN:%.*]] = function_ref @$s16generic_closures06outer_A01t1iyx_SitlF14inner_generic2L_1uxqd___tr__lF : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @guaranteed <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 + // CHECK: [[CLOSURE:%.*]] = partial_apply [callee_guaranteed] [[FN]]([[ARG:%.*]]) : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @guaranteed <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 // CHECK: [[THUNK:%.*]] = function_ref @$sytxIegnr_xIegr_lTR // CHECK: [[THUNK_CLOSURE:%.*]] = partial_apply [callee_guaranteed] [[THUNK]]([[CLOSURE]]) // CHECK: [[THUNK_CLOSURE_CONV:%.*]] = convert_function [[THUNK_CLOSURE]] // CHECK: destroy_value [[THUNK_CLOSURE_CONV]] let _: (()) -> T = inner_generic2 - // CHECK: [[FN:%.*]] = function_ref @$s16generic_closures06outer_A01t1iyx_SitlF14inner_generic2L_1uxqd___tr__lF : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @in_guaranteed τ_0_0) -> @out τ_0_0 - // CHECK: [[RESULT:%.*]] = apply [[FN]]({{.*}}) : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @in_guaranteed τ_0_0) -> @out τ_0_0 + // CHECK: [[FN:%.*]] = function_ref @$s16generic_closures06outer_A01t1iyx_SitlF14inner_generic2L_1uxqd___tr__lF : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @guaranteed <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 + // CHECK: [[RESULT:%.*]] = apply [[FN]]({{.*}}) : $@convention(thin) <τ_0_0><τ_1_0> (@in_guaranteed τ_1_0, @guaranteed <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 _ = inner_generic2(u: t) } @@ -317,7 +317,7 @@ func mixed_generic_nongeneric_nesting(t: T) { // CHECK-LABEL: sil private [ossa] @$s16generic_closures06mixed_A19_nongeneric_nesting1tyx_tlF5outerL_yylF : $@convention(thin) () -> () // CHECK-LABEL: sil private [ossa] @$s16generic_closures06mixed_A19_nongeneric_nesting1tyx_tlF5outerL_yylF6middleL_1uyqd___tr__lF : $@convention(thin) (@in_guaranteed U) -> () -// CHECK-LABEL: sil private [ossa] @$s16generic_closures06mixed_A19_nongeneric_nesting1tyx_tlF5outerL_yylF6middleL_1uyqd___tr__lF5innerL_qd__yr__lF : $@convention(thin) (@in_guaranteed U) -> @out U +// CHECK-LABEL: sil private [ossa] @$s16generic_closures06mixed_A19_nongeneric_nesting1tyx_tlF5outerL_yylF6middleL_1uyqd___tr__lF5innerL_qd__yr__lF : $@convention(thin) (@guaranteed <τ_0_0><τ_1_0> { var τ_1_0 } ) -> @out U protocol Doge { associatedtype Nose : NoseProtocol diff --git a/test/SILGen/guaranteed_closure_context.swift b/test/SILGen/guaranteed_closure_context.swift index 5cf3aa1391644..ef64306c2e40c 100644 --- a/test/SILGen/guaranteed_closure_context.swift +++ b/test/SILGen/guaranteed_closure_context.swift @@ -38,11 +38,15 @@ func guaranteed_captures() { // CHECK: [[B_MUTABLE_RETAINABLE_BOX:%.*]] = begin_borrow [[MUTABLE_RETAINABLE_BOX]] : ${ var C } // CHECK: [[B_MUTABLE_ADDRESS_ONLY_BOX:%.*]] = begin_borrow [[MUTABLE_ADDRESS_ONLY_BOX]] : ${ var P } // CHECK: [[B_IMMUTABLE_RETAINABLE:%.*]] = begin_borrow [[IMMUTABLE_RETAINABLE]] : $C + // CHECK: [[IMMUTABLE_AO_BOX:%.*]] = alloc_box ${ var P } + // CHECK: [[B_IMMUTABLE_AO_BOX:%.*]] = begin_borrow [[IMMUTABLE_AO_BOX]] : ${ var P } // CHECK: [[FN:%.*]] = function_ref [[FN_NAME:@\$s26guaranteed_closure_context0A9_capturesyyF17captureEverythingL_yyF]] - // CHECK: apply [[FN]]([[B_MUTABLE_TRIVIAL_BOX]], [[B_MUTABLE_RETAINABLE_BOX]], [[B_MUTABLE_ADDRESS_ONLY_BOX]], [[IMMUTABLE_TRIVIAL]], [[B_IMMUTABLE_RETAINABLE]], [[IMMUTABLE_ADDRESS_ONLY]]) + // CHECK: apply [[FN]]([[B_MUTABLE_TRIVIAL_BOX]], [[B_MUTABLE_RETAINABLE_BOX]], [[B_MUTABLE_ADDRESS_ONLY_BOX]], [[IMMUTABLE_TRIVIAL]], [[B_IMMUTABLE_RETAINABLE]], [[B_IMMUTABLE_AO_BOX]]) captureEverything() + // CHECK: destroy_value [[IMMUTABLE_AO_BOX]] + // CHECK-NOT: copy_value [[MUTABLE_TRIVIAL_BOX]] // CHECK-NOT: copy_value [[MUTABLE_RETAINABLE_BOX]] // CHECK-NOT: copy_value [[MUTABLE_ADDRESS_ONLY_BOX]] @@ -54,8 +58,8 @@ func guaranteed_captures() { // CHECK: [[MUTABLE_RETAINABLE_BOX_COPY:%.*]] = copy_value [[MUTABLE_RETAINABLE_BOX]] // CHECK: [[MUTABLE_ADDRESS_ONLY_BOX_COPY:%.*]] = copy_value [[MUTABLE_ADDRESS_ONLY_BOX]] // CHECK: [[IMMUTABLE_RETAINABLE_COPY:%.*]] = copy_value [[IMMUTABLE_RETAINABLE]] - // CHECK: [[IMMUTABLE_ADDRESS:%.*]] = alloc_stack $P - // CHECK: [[CLOSURE:%.*]] = partial_apply {{.*}}([[MUTABLE_TRIVIAL_BOX_COPY]], [[MUTABLE_RETAINABLE_BOX_COPY]], [[MUTABLE_ADDRESS_ONLY_BOX_COPY]], [[IMMUTABLE_TRIVIAL]], [[IMMUTABLE_RETAINABLE_COPY]], [[IMMUTABLE_ADDRESS]]) + // CHECK: [[IMMUTABLE_AO_BOX:%.*]] = alloc_box ${ var P } + // CHECK: [[CLOSURE:%.*]] = partial_apply {{.*}}([[MUTABLE_TRIVIAL_BOX_COPY]], [[MUTABLE_RETAINABLE_BOX_COPY]], [[MUTABLE_ADDRESS_ONLY_BOX_COPY]], [[IMMUTABLE_TRIVIAL]], [[IMMUTABLE_RETAINABLE_COPY]], [[IMMUTABLE_AO_BOX]]) // CHECK: [[CONVERT:%.*]] = convert_escape_to_noescape [not_guaranteed] [[CLOSURE]] // CHECK: apply {{.*}}[[CONVERT]] @@ -68,4 +72,4 @@ func guaranteed_captures() { escape(captureEverything) } -// CHECK: sil private [ossa] [[FN_NAME]] : $@convention(thin) (@guaranteed { var S }, @guaranteed { var C }, @guaranteed { var P }, S, @guaranteed C, @in_guaranteed P) +// CHECK: sil private [ossa] [[FN_NAME]] : $@convention(thin) (@guaranteed { var S }, @guaranteed { var C }, @guaranteed { var P }, S, @guaranteed C, @guaranteed { var P }) diff --git a/test/SILGen/struct_resilience.swift b/test/SILGen/struct_resilience.swift index 877773a590641..d2edf42b274ea 100644 --- a/test/SILGen/struct_resilience.swift +++ b/test/SILGen/struct_resilience.swift @@ -178,7 +178,7 @@ public func functionWithMyResilientTypes(_ s: MySize, f: (MySize) -> MySize) -> // CHECK-LABEL: sil [transparent] [serialized] [ossa] @$s17struct_resilience30publicTransparentLocalFunctionySiycAA6MySizeVF : $@convention(thin) (@in_guaranteed MySize) -> @owned @callee_guaranteed () -> Int @_transparent public func publicTransparentLocalFunction(_ s: MySize) -> () -> Int { -// CHECK-LABEL: sil shared [serialized] [ossa] @$s17struct_resilience30publicTransparentLocalFunctionySiycAA6MySizeVFSiycfU_ : $@convention(thin) (@in_guaranteed MySize) -> Int +// CHECK-LABEL: sil shared [serialized] [ossa] @$s17struct_resilience30publicTransparentLocalFunctionySiycAA6MySizeVFSiycfU_ : $@convention(thin) (@guaranteed { var MySize }) -> Int // CHECK: function_ref @$s17struct_resilience6MySizeV1wSivg : $@convention(method) (@in_guaranteed MySize) -> Int // CHECK: return {{.*}} : $Int diff --git a/test/SILOptimizer/specialize_partial_apply.swift b/test/SILOptimizer/specialize_partial_apply.swift index 0a6e13a30cdd4..d4b866a6d4ac2 100644 --- a/test/SILOptimizer/specialize_partial_apply.swift +++ b/test/SILOptimizer/specialize_partial_apply.swift @@ -174,12 +174,11 @@ func testit3_throwing(_ b: Bool) -> Int { } } -// CHECK-LABEL: sil shared [transparent] [thunk] @$s4test16generic_get_funcyxxcx_SbtlF0B0L_yxxlFSi_TG5 : $@convention(thin) (@in_guaranteed Int, Bool, @in_guaranteed Int) -> @out Int { -// CHECK: bb0(%0 : $*Int, %1 : $*Int, %2 : $Bool, %3 : $*Int): -// CHECK: [[LD1:%[0-9]+]] = load %1 : $*Int -// CHECK: [[LD2:%[0-9]+]] = load %3 : $*Int -// CHECK: [[F:%[0-9]+]] = function_ref @$s4test16generic_get_funcyxxcx_SbtlF0B0L_yxxlFSi_Tg5 : $@convention(thin) (Int, Bool, Int) -> Int -// CHECK: [[RET:%[0-9]+]] = apply [[F]]([[LD1]], %2, [[LD2]]) +// CHECK-LABEL: sil shared [transparent] [thunk] @$s4test16generic_get_funcyxxcx_SbtlF0B0L_yxxlFSi_TG5 : $@convention(thin) (@in_guaranteed Int, Bool, @guaranteed <τ_0_0> { var τ_0_0 } ) -> @out Int { +// CHECK: bb0(%0 : $*Int, %1 : $*Int, %2 : $Bool, %3 : $<τ_0_0> { var τ_0_0 } ): +// CHECK: [[LD:%[0-9]+]] = load %1 : $*Int +// CHECK: [[F:%[0-9]+]] = function_ref @$s4test16generic_get_funcyxxcx_SbtlF0B0L_yxxlFSi_Tg5 : $@convention(thin) (Int, Bool, @guaranteed <τ_0_0> { var τ_0_0 } ) -> Int +// CHECK: [[RET:%[0-9]+]] = apply [[F]]([[LD]], %2, %3) // CHECK: store [[RET]] to %0 : $*Int // CHECK: return %{{[0-9]*}} : $() diff --git a/validation-test/Reflection/functions.swift b/validation-test/Reflection/functions.swift index 55ad96f7befe8..ba7a9582d67b4 100644 --- a/validation-test/Reflection/functions.swift +++ b/validation-test/Reflection/functions.swift @@ -106,66 +106,22 @@ func generic(x: T, y: U, z: V, i: Int) { // CHECK-NEXT: (builtin Builtin.NativeObject) // CHECK-32: Type info: -// CHECK-32-NEXT:(closure_context size=44 alignment=4 stride=44 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field offset=24 -// CHECK-32-NEXT: (struct size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_value offset=0 -// CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-32-NEXT: (field offset=28 -// CHECK-32-NEXT: (struct size=12 alignment=4 stride=12 num_extra_inhabitants=253 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_guts offset=0 -// CHECK-32-NEXT: (struct size=12 alignment=4 stride=12 num_extra_inhabitants=253 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_object offset=0 -// CHECK-32-NEXT: (struct size=12 alignment=4 stride=12 num_extra_inhabitants=253 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_count offset=0 -// CHECK-32-NEXT: (struct size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_value offset=0 -// CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-32-NEXT: (field name=_variant offset=4 -// CHECK-32-NEXT: (multi_payload_enum size=5 alignment=4 stride=8 num_extra_inhabitants=253 bitwise_takable=1 -// CHECK-32-NEXT: (case name=immortal index=0 offset=0 -// CHECK-32-NEXT: (struct size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_value offset=0 -// CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-32-NEXT: (case name=native index=1 offset=0 -// CHECK-32-NEXT: (class_existential size=4 alignment=4 stride=4 num_extra_inhabitants=4096 bitwise_takable=1 -// CHECK-32-NEXT: (field name=object offset=0 -// CHECK-32-NEXT: (reference kind=strong refcounting=unknown)))) -// CHECK-32-NEXT: (case name=bridged index=2 offset=0 -// CHECK-32-NEXT: (class_existential size=4 alignment=4 stride=4 num_extra_inhabitants=4096 bitwise_takable=1 -// CHECK-32-NEXT: (field name=object offset=0 -// CHECK-32-NEXT: (reference kind=strong refcounting=unknown)))))) -// CHECK-32-NEXT: (field name=_discriminator offset=9 -// CHECK-32-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_value offset=0 -// CHECK-32-NEXT: (builtin size=1 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-32-NEXT: (field name=_flags offset=10 -// CHECK-32-NEXT: (struct size=2 alignment=2 stride=2 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field name=_value offset=0 -// CHECK-32-NEXT: (builtin size=2 alignment=2 stride=2 num_extra_inhabitants=0 bitwise_takable=1)))))))))) -// CHECK-32-NEXT: (field offset=40 -// CHECK-32-NEXT: (reference kind=strong refcounting=native))) +// CHECK-32-NEXT: (closure_context size=36 alignment=4 stride=36 num_extra_inhabitants=0 bitwise_takable=1 +// CHECK-32-NEXT: (field offset=24 +// CHECK-32-NEXT: (reference kind=strong refcounting=native)) +// CHECK-32-NEXT: (field offset=28 +// CHECK-32-NEXT: (reference kind=strong refcounting=native)) +// CHECK-32-NEXT: (field offset=32 +// CHECK-32-NEXT: (reference kind=strong refcounting=native))) // CHECK-64: Type info: -// CHECK-64-NEXT:(closure_context size=80 alignment=8 stride=80 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-64-NEXT: (field offset=48 -// CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-64-NEXT: (field name=_value offset=0 -// CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-64-NEXT: (field offset=56 -// CHECK-64-NEXT: (struct size=16 alignment=8 stride=16 num_extra_inhabitants=2147483647 bitwise_takable=1 -// CHECK-64-NEXT: (field name=_guts offset=0 -// CHECK-64-NEXT: (struct size=16 alignment=8 stride=16 num_extra_inhabitants=2147483647 bitwise_takable=1 -// CHECK-64-NEXT: (field name=_object offset=0 -// CHECK-64-NEXT: (struct size=16 alignment=8 stride=16 num_extra_inhabitants=2147483647 bitwise_takable=1 -// CHECK-64-NEXT: (field name=_countAndFlagsBits offset=0 -// CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-64-NEXT: (field name=_value offset=0 -// CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-64-NEXT: (field name=_object offset=8 -// CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=2147483647 bitwise_takable=1)))))))) -// CHECK-64-NEXT: (field offset=72 -// CHECK-64-NEXT: (reference kind=strong refcounting=native))) +// CHECK-64-NEXT: (closure_context size=72 alignment=8 stride=72 num_extra_inhabitants=0 bitwise_takable=1 +// CHECK-64-NEXT: (field offset=48 +// CHECK-64-NEXT: (reference kind=strong refcounting=native)) +// CHECK-64-NEXT: (field offset=56 +// CHECK-64-NEXT: (reference kind=strong refcounting=native)) +// CHECK-64-NEXT: (field offset=64 +// CHECK-64-NEXT: (reference kind=strong refcounting=native))) } generic(x: 10, y: "", z: C(), i: 101) @@ -179,46 +135,26 @@ func genericWithSources(a: A, b: B, c: C, gc: GC) { // CHECK-NEXT: (builtin Builtin.NativeObject) // CHECK-32: Type info: -// CHECK-32-NEXT:(closure_context size=24 alignment=4 stride=24 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field offset=20 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-32-NEXT: (field offset=20 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field offset=0 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-32-NEXT: (field offset=0 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-32-NEXT: (field offset=20 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-32-NEXT: (field offset=0 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-32-NEXT: (field offset=0 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-32-NEXT: (field offset=0 -// CHECK-32-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-32-NEXT: (field offset=20 -// CHECK-32-NEXT: (reference kind=strong refcounting=native))) +// CHECK-32-NEXT: (closure_context size=24 alignment=4 stride=24 +// CHECK-32-NEXT: (field offset=8 +// CHECK-32-NEXT: (reference kind=strong refcounting=native)) +// CHECK-32-NEXT: (field offset=12 +// CHECK-32-NEXT: (reference kind=strong refcounting=native)) +// CHECK-32-NEXT: (field offset=16 +// CHECK-32-NEXT: (reference kind=strong refcounting=native)) +// CHECK-32-NEXT: (field offset=20 +// CHECK-32-NEXT: (reference kind=strong refcounting=native))) // CHECK-64: Type info: -// CHECK-64-NEXT:(closure_context size=48 alignment=8 stride=48 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-64-NEXT: (field offset=40 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-64-NEXT: (field offset=40 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-64-NEXT: (field offset=0 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-64-NEXT: (field offset=0 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-64-NEXT: (field offset=40 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1 -// CHECK-64-NEXT: (field offset=0 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-64-NEXT: (field offset=0 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)) -// CHECK-64-NEXT: (field offset=0 -// CHECK-64-NEXT: (tuple size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1)))) -// CHECK-64-NEXT: (field offset=40 -// CHECK-64-NEXT: (reference kind=strong refcounting=native))) +// CHECK-64-NEXT: (closure_context size=48 alignment=8 stride=48 +// CHECK-64-NEXT: (field offset=16 +// CHECK-64-NEXT: (reference kind=strong refcounting=native)) +// CHECK-64-NEXT: (field offset=24 +// CHECK-64-NEXT: (reference kind=strong refcounting=native)) +// CHECK-64-NEXT: (field offset=32 +// CHECK-64-NEXT: (reference kind=strong refcounting=native)) +// CHECK-64-NEXT: (field offset=40 +// CHECK-64-NEXT: (reference kind=strong refcounting=native))) } genericWithSources(a: (), b: ((), ()), c: ((), (), ()), gc: GC<(), ((), ()), ((), (), ())>())