diff --git a/docs/ABI/Mangling.rst b/docs/ABI/Mangling.rst index 6f956ffd9ecf6..323ee2cc83702 100644 --- a/docs/ABI/Mangling.rst +++ b/docs/ABI/Mangling.rst @@ -570,19 +570,19 @@ Types // they are mangled separately as part of the entity. params-type ::= empty-list // shortcut for no parameters - sendable ::= 'J' // @Sendable on function types - async ::= 'Y' // 'async' annotation on function types + async ::= 'Ya' // 'async' annotation on function types + sendable ::= 'Yb' // @Sendable on function types throws ::= 'K' // 'throws' annotation on function types - differentiable ::= 'jf' // @differentiable(_forward) on function type - differentiable ::= 'jr' // @differentiable(reverse) on function type - differentiable ::= 'jd' // @differentiable on function type - differentiable ::= 'jl' // @differentiable(_linear) on function type + differentiable ::= 'Yjf' // @differentiable(_forward) on function type + differentiable ::= 'Yjr' // @differentiable(reverse) on function type + differentiable ::= 'Yjd' // @differentiable on function type + differentiable ::= 'Yjl' // @differentiable(_linear) on function type type-list ::= list-type '_' list-type* // list of types type-list ::= empty-list // FIXME: Consider replacing 'h' with a two-char code - list-type ::= type identifier? 'z'? 'h'? 'n'? 'd'? // type with optional label, inout convention, shared convention, owned convention, and variadic specifier + list-type ::= type identifier? 'Yk'? 'z'? 'h'? 'n'? 'd'? // type with optional label, '@noDerivative', inout convention, shared convention, owned convention, and variadic specifier METATYPE-REPR ::= 't' // Thin metatype representation METATYPE-REPR ::= 'T' // Thick metatype representation @@ -666,7 +666,7 @@ mangled in to disambiguate. COROUTINE-KIND ::= 'A' // yield-once coroutine COROUTINE-KIND ::= 'G' // yield-many coroutine - SENDABLE ::= 'h' // @Sendable + SENDABLE ::= 'h' // @Sendable ASYNC ::= 'H' // @async PARAM-CONVENTION ::= 'i' // indirect in diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h index 62b4db5456487..585d55f275c03 100644 --- a/include/swift/AST/Attr.h +++ b/include/swift/AST/Attr.h @@ -2324,8 +2324,6 @@ class TypeAttributes { Optional ConventionArguments; - // Indicates whether the type's '@differentiable' attribute has a 'linear' - // argument. DifferentiabilityKind differentiabilityKind = DifferentiabilityKind::NonDifferentiable; diff --git a/include/swift/AST/GenericSignatureBuilder.h b/include/swift/AST/GenericSignatureBuilder.h index 71e7daa8276d6..c4f7bbf0cec88 100644 --- a/include/swift/AST/GenericSignatureBuilder.h +++ b/include/swift/AST/GenericSignatureBuilder.h @@ -654,7 +654,7 @@ class GenericSignatureBuilder { class ExplicitRequirement; - bool isRedundantExplicitRequirement(ExplicitRequirement req) const; + bool isRedundantExplicitRequirement(const ExplicitRequirement &req) const; private: void computeRedundantRequirements(); diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index 7449ccb9522b1..807fb1f216ffa 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -1929,7 +1929,7 @@ class ParameterTypeFlags { NonEphemeral = 1 << 2, OwnershipShift = 3, Ownership = 7 << OwnershipShift, - NoDerivative = 1 << 7, + NoDerivative = 1 << 6, NumBits = 7 }; OptionSet value; diff --git a/include/swift/Demangling/DemangleNodes.def b/include/swift/Demangling/DemangleNodes.def index 2bf10807aecc2..8a02f3972f799 100644 --- a/include/swift/Demangling/DemangleNodes.def +++ b/include/swift/Demangling/DemangleNodes.def @@ -312,6 +312,7 @@ NODE(AutoDiffSelfReorderingReabstractionThunk) NODE(AutoDiffSubsetParametersThunk) NODE(AutoDiffDerivativeVTableThunk) NODE(DifferentiabilityWitness) +NODE(NoDerivative) NODE(IndexSubset) NODE(AsyncAwaitResumePartialFunction) NODE(AsyncSuspendResumePartialFunction) diff --git a/include/swift/Demangling/Demangler.h b/include/swift/Demangling/Demangler.h index cf450918210c1..eb0b4cfba92da 100644 --- a/include/swift/Demangling/Demangler.h +++ b/include/swift/Demangling/Demangler.h @@ -569,6 +569,8 @@ class Demangler : public NodeFactory { NodePointer demangleTypeMangling(); NodePointer demangleSymbolicReference(unsigned char rawKind); + NodePointer demangleTypeAnnotation(); + NodePointer demangleAutoDiffFunctionOrSimpleThunk(Node::Kind nodeKind); NodePointer demangleAutoDiffFunctionKind(); NodePointer demangleAutoDiffSubsetParametersThunk(); diff --git a/include/swift/Demangling/TypeDecoder.h b/include/swift/Demangling/TypeDecoder.h index 2d2523122ec40..b2f88e6645090 100644 --- a/include/swift/Demangling/TypeDecoder.h +++ b/include/swift/Demangling/TypeDecoder.h @@ -72,6 +72,7 @@ class FunctionParam { void setValueOwnership(ValueOwnership ownership) { Flags = Flags.withValueOwnership(ownership); } + void setNoDerivative() { Flags = Flags.withNoDerivative(true); } void setFlags(ParameterFlags flags) { Flags = flags; }; FunctionParam withLabel(StringRef label) const { @@ -737,27 +738,6 @@ class TypeDecoder { ++firstChildIdx; } - bool isThrow = false; - if (Node->getChild(firstChildIdx)->getKind() - == NodeKind::ThrowsAnnotation) { - isThrow = true; - ++firstChildIdx; - } - - bool isSendable = false; - if (Node->getChild(firstChildIdx)->getKind() - == NodeKind::ConcurrentFunctionType) { - isSendable = true; - ++firstChildIdx; - } - - bool isAsync = false; - if (Node->getChild(firstChildIdx)->getKind() - == NodeKind::AsyncAnnotation) { - isAsync = true; - ++firstChildIdx; - } - FunctionMetadataDifferentiabilityKind diffKind; if (Node->getChild(firstChildIdx)->getKind() == NodeKind::DifferentiableFunctionType) { @@ -783,6 +763,27 @@ class TypeDecoder { ++firstChildIdx; } + bool isThrow = false; + if (Node->getChild(firstChildIdx)->getKind() + == NodeKind::ThrowsAnnotation) { + isThrow = true; + ++firstChildIdx; + } + + bool isSendable = false; + if (Node->getChild(firstChildIdx)->getKind() + == NodeKind::ConcurrentFunctionType) { + isSendable = true; + ++firstChildIdx; + } + + bool isAsync = false; + if (Node->getChild(firstChildIdx)->getKind() + == NodeKind::AsyncAnnotation) { + isAsync = true; + ++firstChildIdx; + } + flags = flags.withConcurrent(isSendable) .withAsync(isAsync).withThrows(isThrow) .withDifferentiable(diffKind.isDifferentiable()); @@ -1370,33 +1371,44 @@ class TypeDecoder { FunctionParam ¶m) -> bool { Demangle::NodePointer node = typeNode; - auto setOwnership = [&](ValueOwnership ownership) { - param.setValueOwnership(ownership); - node = node->getFirstChild(); - hasParamFlags = true; - }; - switch (node->getKind()) { - case NodeKind::InOut: - setOwnership(ValueOwnership::InOut); - break; + bool recurse = true; + while (recurse) { + switch (node->getKind()) { + case NodeKind::InOut: + param.setValueOwnership(ValueOwnership::InOut); + node = node->getFirstChild(); + hasParamFlags = true; + break; - case NodeKind::Shared: - setOwnership(ValueOwnership::Shared); - break; + case NodeKind::Shared: + param.setValueOwnership(ValueOwnership::Shared); + node = node->getFirstChild(); + hasParamFlags = true; + break; - case NodeKind::Owned: - setOwnership(ValueOwnership::Owned); - break; + case NodeKind::Owned: + param.setValueOwnership(ValueOwnership::Owned); + node = node->getFirstChild(); + hasParamFlags = true; + break; - case NodeKind::AutoClosureType: - case NodeKind::EscapingAutoClosureType: { - param.setAutoClosure(); - hasParamFlags = true; - break; - } + case NodeKind::NoDerivative: + param.setNoDerivative(); + node = node->getFirstChild(); + hasParamFlags = true; + break; - default: - break; + case NodeKind::AutoClosureType: + case NodeKind::EscapingAutoClosureType: + param.setAutoClosure(); + hasParamFlags = true; + recurse = false; + break; + + default: + recurse = false; + break; + } } auto paramType = decodeMangledType(node); diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index b80040b645534..0f8db0081013c 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -204,6 +204,12 @@ class CompilerInvocation { void setRuntimeResourcePath(StringRef Path); + /// Compute the default prebuilt module cache path for a given resource path + /// and SDK version. This function is also used by LLDB. + static std::string + computePrebuiltCachePath(StringRef RuntimeResourcePath, llvm::Triple target, + Optional sdkVer); + /// If we haven't explicitly passed -prebuilt-module-cache-path, set it to /// the default value of //prebuilt-modules. /// @note This should be called once, after search path options and frontend diff --git a/lib/AST/ASTMangler.cpp b/lib/AST/ASTMangler.cpp index c6db98cb5de93..9ba25632e7510 100644 --- a/lib/AST/ASTMangler.cpp +++ b/lib/AST/ASTMangler.cpp @@ -2448,25 +2448,25 @@ void ASTMangler::appendFunctionSignature(AnyFunctionType *fn, appendFunctionResultType(fn->getResult(), forDecl); appendFunctionInputType(fn->getParams(), forDecl); if (fn->isAsync() || functionMangling == AsyncHandlerBodyMangling) - appendOperator("Y"); + appendOperator("Ya"); if (fn->isSendable()) - appendOperator("J"); + appendOperator("Yb"); if (fn->isThrowing()) appendOperator("K"); switch (auto diffKind = fn->getDifferentiabilityKind()) { case DifferentiabilityKind::NonDifferentiable: break; case DifferentiabilityKind::Forward: - appendOperator("jf"); + appendOperator("Yjf"); break; case DifferentiabilityKind::Reverse: - appendOperator("jr"); + appendOperator("Yjr"); break; case DifferentiabilityKind::Normal: - appendOperator("jd"); + appendOperator("Yjd"); break; case DifferentiabilityKind::Linear: - appendOperator("jl"); + appendOperator("Yjl"); break; } } @@ -2541,6 +2541,9 @@ void ASTMangler::appendTypeListElement(Identifier name, Type elementType, else appendType(elementType, forDecl); + if (flags.isNoDerivative()) { + appendOperator("Yk"); + } switch (flags.getValueOwnership()) { case ValueOwnership::Default: /* nothing */ diff --git a/lib/AST/GenericSignatureBuilder.cpp b/lib/AST/GenericSignatureBuilder.cpp index 29b10bb6be169..171cc4f60462c 100644 --- a/lib/AST/GenericSignatureBuilder.cpp +++ b/lib/AST/GenericSignatureBuilder.cpp @@ -730,6 +730,8 @@ struct GenericSignatureBuilder::Implementation { std::vector ConflictingConcreteTypeRequirements; + llvm::DenseSet ExplicitConformancesImpliedByConcrete; + #ifndef NDEBUG /// Whether we've already computed redundant requiremnts. bool computedRedundantRequirements = false; @@ -1094,12 +1096,14 @@ const RequirementSource *RequirementSource::getMinimalConformanceSource( ArchetypeResolutionKind::WellFormed); assert(parentEquivClass && "Not a well-formed type?"); - if (parentEquivClass->concreteType) - derivedViaConcrete = true; - else if (parentEquivClass->superclass && - builder.lookupConformance(parentEquivClass->superclass, - source->getProtocolDecl())) - derivedViaConcrete = true; + if (requirementSignatureSelfProto) { + if (parentEquivClass->concreteType) + derivedViaConcrete = true; + else if (parentEquivClass->superclass && + builder.lookupConformance(parentEquivClass->superclass, + source->getProtocolDecl())) + derivedViaConcrete = true; + } // The parent potential archetype must conform to the protocol in which // this requirement resides. Add this constraint. @@ -6256,6 +6260,20 @@ static bool typeConflictsWithLayoutConstraint(Type t, LayoutConstraint layout) { return false; } +static bool isConcreteConformance(const EquivalenceClass &equivClass, + ProtocolDecl *proto, + GenericSignatureBuilder &builder) { + if (equivClass.concreteType && + builder.lookupConformance(equivClass.concreteType, proto)) { + return true; + } else if (equivClass.superclass && + builder.lookupConformance(equivClass.superclass, proto)) { + return true; + } + + return false; +} + void GenericSignatureBuilder::computeRedundantRequirements() { assert(!Impl->computedRedundantRequirements && "Already computed redundant requirements"); @@ -6289,6 +6307,14 @@ void GenericSignatureBuilder::computeRedundantRequirements() { // FIXME: Check for a conflict via the concrete type. exact.push_back(constraint); + + if (!source->isDerivedRequirement()) { + if (isConcreteConformance(equivClass, entry.first, *this)) { + Impl->ExplicitConformancesImpliedByConcrete.insert( + ExplicitRequirement::fromExplicitConstraint( + RequirementKind::Conformance, constraint)); + } + } } graph.addConstraintsFromEquivClass(RequirementKind::Conformance, @@ -7176,6 +7202,9 @@ void GenericSignatureBuilder::diagnoseRedundantRequirements() const { for (auto otherReq : found->second) { auto *otherSource = otherReq.getSource(); + if (otherSource->isInferredRequirement()) + continue; + auto otherLoc = otherSource->getLoc(); if (otherLoc.isInvalid()) continue; @@ -7213,6 +7242,9 @@ void GenericSignatureBuilder::diagnoseRedundantRequirements() const { for (auto otherReq : found->second) { auto *otherSource = otherReq.getSource(); + if (otherSource->isInferredRequirement()) + continue; + auto otherLoc = otherSource->getLoc(); if (otherLoc.isInvalid()) continue; @@ -7252,6 +7284,9 @@ void GenericSignatureBuilder::diagnoseRedundantRequirements() const { for (auto otherReq : found->second) { auto *otherSource = otherReq.getSource(); + if (otherSource->isInferredRequirement()) + continue; + auto otherLoc = otherSource->getLoc(); if (otherLoc.isInvalid()) continue; @@ -8159,7 +8194,7 @@ void GenericSignatureBuilder::checkLayoutConstraints( } bool GenericSignatureBuilder::isRedundantExplicitRequirement( - ExplicitRequirement req) const { + const ExplicitRequirement &req) const { assert(Impl->computedRedundantRequirements && "Must ensure computeRedundantRequirements() is called first"); auto &redundantReqs = Impl->RedundantRequirements; @@ -8466,23 +8501,6 @@ static void checkGenericSignature(CanGenericSignature canSig, } #endif -bool GenericSignatureBuilder::hasExplicitConformancesImpliedByConcrete() const { - for (auto pair : Impl->RedundantRequirements) { - if (pair.first.getKind() != RequirementKind::Conformance) - continue; - - for (auto impliedByReq : pair.second) { - if (impliedByReq.getKind() == RequirementKind::Superclass) - return true; - - if (impliedByReq.getKind() == RequirementKind::SameType) - return true; - } - } - - return false; -} - static Type stripBoundDependentMemberTypes(Type t) { if (auto *depMemTy = t->getAs()) { return DependentMemberType::get( @@ -8532,7 +8550,8 @@ GenericSignature GenericSignatureBuilder::rebuildSignatureWithoutRedundantRequir assert(req.getKind() != RequirementKind::SameType && "Should not see same-type requirement here"); - if (isRedundantExplicitRequirement(req)) + if (isRedundantExplicitRequirement(req) && + Impl->ExplicitConformancesImpliedByConcrete.count(req)) continue; auto subjectType = req.getSource()->getStoredType(); @@ -8618,8 +8637,12 @@ GenericSignature GenericSignatureBuilder::computeGenericSignature( assert(!Impl->HadAnyError && "Rebuilt signature had errors"); - assert(!hasExplicitConformancesImpliedByConcrete() && - "Rebuilt signature still had redundant conformance requirements"); +#ifndef NDEBUG + for (const auto &req : Impl->ExplicitConformancesImpliedByConcrete) { + assert(!isRedundantExplicitRequirement(req) && + "Rebuilt signature still had redundant conformance requirements"); + } +#endif } // If any of our explicit conformance requirements were implied by @@ -8634,7 +8657,7 @@ GenericSignature GenericSignatureBuilder::computeGenericSignature( if (!rebuildingWithoutRedundantConformances && !buildingRequirementSignature && !Impl->HadAnyError && - hasExplicitConformancesImpliedByConcrete()) { + !Impl->ExplicitConformancesImpliedByConcrete.empty()) { return std::move(*this).rebuildSignatureWithoutRedundantRequirements( allowConcreteGenericParams, buildingRequirementSignature); diff --git a/lib/Demangling/Demangler.cpp b/lib/Demangling/Demangler.cpp index 809d0b6f86f77..875d7ed23dc34 100644 --- a/lib/Demangling/Demangler.cpp +++ b/lib/Demangling/Demangler.cpp @@ -730,6 +730,22 @@ NodePointer Demangler::demangleSymbolicReference(unsigned char rawKind) { return resolved; } +NodePointer Demangler::demangleTypeAnnotation() { + switch (char c2 = nextChar()) { + case 'a': + return createNode(Node::Kind::AsyncAnnotation); + case 'b': + return createNode(Node::Kind::ConcurrentFunctionType); + case 'j': + return demangleDifferentiableFunctionType(); + case 'k': + return createType( + createWithChild(Node::Kind::NoDerivative, popTypeAndGetChild())); + default: + return nullptr; + } +} + NodePointer Demangler::demangleOperator() { recur: switch (unsigned char c = nextChar()) { @@ -767,7 +783,6 @@ NodePointer Demangler::demangleOperator() { } case 'I': return demangleImplFunctionType(); - case 'J': return createNode(Node::Kind::ConcurrentFunctionType); case 'K': return createNode(Node::Kind::ThrowsAnnotation); case 'L': return demangleLocalIdentifier(); case 'M': return demangleMetatype(); @@ -782,7 +797,7 @@ NodePointer Demangler::demangleOperator() { case 'V': return demangleAnyGenericType(Node::Kind::Structure); case 'W': return demangleWitness(); case 'X': return demangleSpecialType(); - case 'Y': return createNode(Node::Kind::AsyncAnnotation); + case 'Y': return demangleTypeAnnotation(); case 'Z': return createWithChild(Node::Kind::Static, popNode(isEntity)); case 'a': return demangleAnyGenericType(Node::Kind::TypeAlias); case 'c': return popFunctionType(Node::Kind::FunctionType); @@ -792,7 +807,6 @@ NodePointer Demangler::demangleOperator() { case 'h': return createType(createWithChild(Node::Kind::Shared, popTypeAndGetChild())); case 'i': return demangleSubscript(); - case 'j': return demangleDifferentiableFunctionType(); case 'l': return demangleGenericSignature(/*hasParamCounts*/ false); case 'm': return createType(createWithChild(Node::Kind::Metatype, popNode(Node::Kind::Type))); @@ -1254,10 +1268,10 @@ NodePointer Demangler::popFunctionType(Node::Kind kind, bool hasClangType) { ClangType = demangleClangType(); } addChild(FuncType, ClangType); + addChild(FuncType, popNode(Node::Kind::DifferentiableFunctionType)); addChild(FuncType, popNode(Node::Kind::ThrowsAnnotation)); addChild(FuncType, popNode(Node::Kind::ConcurrentFunctionType)); addChild(FuncType, popNode(Node::Kind::AsyncAnnotation)); - addChild(FuncType, popNode(Node::Kind::DifferentiableFunctionType)); FuncType = addChild(FuncType, popFunctionParams(Node::Kind::ArgumentTuple)); FuncType = addChild(FuncType, popFunctionParams(Node::Kind::ReturnType)); @@ -1290,6 +1304,9 @@ NodePointer Demangler::popFunctionParamLabels(NodePointer Type) { return nullptr; unsigned FirstChildIdx = 0; + if (FuncType->getChild(FirstChildIdx)->getKind() + == Node::Kind::DifferentiableFunctionType) + ++FirstChildIdx; if (FuncType->getChild(FirstChildIdx)->getKind() == Node::Kind::ThrowsAnnotation) ++FirstChildIdx; @@ -1299,9 +1316,6 @@ NodePointer Demangler::popFunctionParamLabels(NodePointer Type) { if (FuncType->getChild(FirstChildIdx)->getKind() == Node::Kind::AsyncAnnotation) ++FirstChildIdx; - if (FuncType->getChild(FirstChildIdx)->getKind() - == Node::Kind::DifferentiableFunctionType) - ++FirstChildIdx; auto ParameterType = FuncType->getChild(FirstChildIdx); assert(ParameterType->getKind() == Node::Kind::ArgumentTuple); diff --git a/lib/Demangling/NodePrinter.cpp b/lib/Demangling/NodePrinter.cpp index 52a7885cc125e..669e92882687e 100644 --- a/lib/Demangling/NodePrinter.cpp +++ b/lib/Demangling/NodePrinter.cpp @@ -569,6 +569,7 @@ class NodePrinter { case Node::Kind::AutoDiffSubsetParametersThunk: case Node::Kind::AutoDiffFunctionKind: case Node::Kind::DifferentiabilityWitness: + case Node::Kind::NoDerivative: case Node::Kind::IndexSubset: case Node::Kind::AsyncAwaitResumePartialFunction: case Node::Kind::AsyncSuspendResumePartialFunction: @@ -808,6 +809,12 @@ class NodePrinter { unsigned startIndex = 0; bool isSendable = false, isAsync = false, isThrows = false; auto diffKind = MangledDifferentiabilityKind::NonDifferentiable; + if (node->getChild(startIndex)->getKind() == + Node::Kind::DifferentiableFunctionType) { + diffKind = + (MangledDifferentiabilityKind)node->getChild(startIndex)->getIndex(); + ++startIndex; + } if (node->getChild(startIndex)->getKind() == Node::Kind::ClangType) { // handled earlier ++startIndex; @@ -825,12 +832,6 @@ class NodePrinter { ++startIndex; isAsync = true; } - if (node->getChild(startIndex)->getKind() == - Node::Kind::DifferentiableFunctionType) { - diffKind = - (MangledDifferentiabilityKind)node->getChild(startIndex)->getIndex(); - ++startIndex; - } switch (diffKind) { case MangledDifferentiabilityKind::Forward: @@ -1421,6 +1422,10 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) { Printer << "__owned "; print(Node->getChild(0)); return nullptr; + case Node::Kind::NoDerivative: + Printer << "@noDerivative "; + print(Node->getChild(0)); + return nullptr; case Node::Kind::NonObjCAttribute: Printer << "@nonobjc "; return nullptr; diff --git a/lib/Demangling/OldDemangler.cpp b/lib/Demangling/OldDemangler.cpp index c22e74ddb6975..7e8336f569636 100644 --- a/lib/Demangling/OldDemangler.cpp +++ b/lib/Demangling/OldDemangler.cpp @@ -2063,6 +2063,14 @@ class OldDemangler { inout->addChild(type, Factory); return inout; } + if (c == 'k') { + auto noDerivative = Factory.createNode(Node::Kind::NoDerivative); + auto type = demangleTypeImpl(); + if (!type) + return nullptr; + noDerivative->addChild(type, Factory); + return noDerivative; + } if (c == 'S') { return demangleSubstitutionIndex(); } diff --git a/lib/Demangling/OldRemangler.cpp b/lib/Demangling/OldRemangler.cpp index acf06387b9f61..5b1bab9f6bd47 100644 --- a/lib/Demangling/OldRemangler.cpp +++ b/lib/Demangling/OldRemangler.cpp @@ -1485,6 +1485,11 @@ void Remangler::mangleInOut(Node *node) { mangleSingleChildNode(node); // type } +void Remangler::mangleNoDerivative(Node *node) { + Buffer << 'k'; + mangleSingleChildNode(node); // type +} + void Remangler::mangleTuple(Node *node) { size_t NumElems = node->getNumChildren(); if (NumElems > 0 && diff --git a/lib/Demangling/Remangler.cpp b/lib/Demangling/Remangler.cpp index 91178f8eeaac9..9b68beecff0ce 100644 --- a/lib/Demangling/Remangler.cpp +++ b/lib/Demangling/Remangler.cpp @@ -1676,6 +1676,11 @@ void Remangler::mangleOwned(Node *node) { Buffer << 'n'; } +void Remangler::mangleNoDerivative(Node *node) { + mangleSingleChildNode(node); + Buffer << "Yk"; +} + void Remangler::mangleInfixOperator(Node *node) { mangleIdentifierImpl(node, /*isOperator*/ true); Buffer << "oi"; @@ -2460,15 +2465,15 @@ void Remangler::mangleFullObjCResilientClassStub(Node *node) { } void Remangler::mangleConcurrentFunctionType(Node *node) { - Buffer << 'J'; + Buffer << "Yb"; } void Remangler::mangleAsyncAnnotation(Node *node) { - Buffer << 'Y'; + Buffer << "Ya"; } void Remangler::mangleDifferentiableFunctionType(Node *node) { - Buffer << 'j' << (char)node->getIndex(); // differentiability kind + Buffer << "Yj" << (char)node->getIndex(); // differentiability kind } void Remangler::mangleThrowsAnnotation(Node *node) { diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index bb4e2912fa68b..d3115f29d3d41 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -101,28 +101,34 @@ getVersionedPrebuiltModulePath(Optional sdkVer, } while(true); } -void CompilerInvocation::setDefaultPrebuiltCacheIfNecessary() { - - if (!FrontendOpts.PrebuiltModuleCachePath.empty()) - return; - if (SearchPathOpts.RuntimeResourcePath.empty()) - return; - - SmallString<64> defaultPrebuiltPath{SearchPathOpts.RuntimeResourcePath}; +std::string CompilerInvocation::computePrebuiltCachePath( + StringRef RuntimeResourcePath, llvm::Triple target, + Optional sdkVer) { + SmallString<64> defaultPrebuiltPath{RuntimeResourcePath}; StringRef platform; - if (tripleIsMacCatalystEnvironment(LangOpts.Target)) { - // The prebuilt cache for macCatalyst is the same as the one for macOS, not iOS - // or a separate location of its own. + if (tripleIsMacCatalystEnvironment(target)) { + // The prebuilt cache for macCatalyst is the same as the one for macOS, not + // iOS or a separate location of its own. platform = "macosx"; } else { - platform = getPlatformNameForTriple(LangOpts.Target); + platform = getPlatformNameForTriple(target); } llvm::sys::path::append(defaultPrebuiltPath, platform, "prebuilt-modules"); // If the SDK version is given, we should check if SDK-versioned prebuilt // module cache is available and use it if so. - FrontendOpts.PrebuiltModuleCachePath = - getVersionedPrebuiltModulePath(LangOpts.SDKVersion, defaultPrebuiltPath); + return getVersionedPrebuiltModulePath(sdkVer, defaultPrebuiltPath); +} + +void CompilerInvocation::setDefaultPrebuiltCacheIfNecessary() { + + if (!FrontendOpts.PrebuiltModuleCachePath.empty()) + return; + if (SearchPathOpts.RuntimeResourcePath.empty()) + return; + + FrontendOpts.PrebuiltModuleCachePath = computePrebuiltCachePath( + SearchPathOpts.RuntimeResourcePath, LangOpts.Target, LangOpts.SDKVersion); } static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts, diff --git a/lib/IRGen/Callee.h b/lib/IRGen/Callee.h index 126aa3290fdbd..8e081cd206b40 100644 --- a/lib/IRGen/Callee.h +++ b/lib/IRGen/Callee.h @@ -234,6 +234,12 @@ namespace irgen { /// The actual pointer, either to the function or to its descriptor. llvm::Value *Value; + /// An additional value whose meaning varies by the FunctionPointer's Kind: + /// - Kind::AsyncFunctionPointer -> pointer to the corresponding function + /// if the FunctionPointer was created via + /// forDirect; nullptr otherwise. + llvm::Value *SecondaryValue; + PointerAuthInfo AuthInfo; Signature Sig; @@ -243,9 +249,11 @@ namespace irgen { /// We may add more arguments to this; try to use the other /// constructors/factories if possible. explicit FunctionPointer(Kind kind, llvm::Value *value, + llvm::Value *secondaryValue, PointerAuthInfo authInfo, const Signature &signature) - : kind(kind), Value(value), AuthInfo(authInfo), Sig(signature) { + : kind(kind), Value(value), SecondaryValue(secondaryValue), + AuthInfo(authInfo), Sig(signature) { // The function pointer should have function type. assert(value->getType()->getPointerElementType()->isFunctionTy()); // TODO: maybe assert similarity to signature.getType()? @@ -258,18 +266,25 @@ namespace irgen { } } + explicit FunctionPointer(Kind kind, llvm::Value *value, + PointerAuthInfo authInfo, + const Signature &signature) + : FunctionPointer(kind, value, nullptr, authInfo, signature){}; + // Temporary only! explicit FunctionPointer(Kind kind, llvm::Value *value, const Signature &signature) : FunctionPointer(kind, value, PointerAuthInfo(), signature) {} - static FunctionPointer forDirect(IRGenModule &IGM, - llvm::Constant *value, + static FunctionPointer forDirect(IRGenModule &IGM, llvm::Constant *value, + llvm::Constant *secondaryValue, CanSILFunctionType fnType); static FunctionPointer forDirect(Kind kind, llvm::Constant *value, + llvm::Constant *secondaryValue, const Signature &signature) { - return FunctionPointer(kind, value, PointerAuthInfo(), signature); + return FunctionPointer(kind, value, secondaryValue, PointerAuthInfo(), + signature); } static FunctionPointer forExplosionValue(IRGenFunction &IGF, @@ -295,6 +310,13 @@ namespace irgen { /// Return the actual function pointer. llvm::Value *getRawPointer() const { return Value; } + /// Assuming that the receiver is of kind AsyncFunctionPointer, returns the + /// pointer to the corresponding function if available. + llvm::Value *getRawAsyncFunction() const { + assert(kind.isAsyncFunctionPointer()); + return SecondaryValue; + } + /// Given that this value is known to have been constructed from /// a direct function, return the function pointer. llvm::Constant *getDirectPointer() const { diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index 4c4969430a655..7ff5616313b7e 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -1985,18 +1985,33 @@ std::pair irgen::getAsyncFunctionAndSize( assert(functionPointer.getKind() != FunctionPointer::Kind::Function); bool emitFunction = values.first; bool emitSize = values.second; - auto *ptr = functionPointer.getRawPointer(); - if (auto authInfo = functionPointer.getAuthInfo()) { - ptr = emitPointerAuthAuth(IGF, ptr, authInfo); - } - auto *afpPtr = - IGF.Builder.CreateBitCast(ptr, IGF.IGM.AsyncFunctionPointerPtrTy); + // Ensure that the AsyncFunctionPointer is not auth'd if it is not used and + // that it is not auth'd more than once if it is needed. + // + // The AsyncFunctionPointer is not needed in the case where only the function + // is being loaded and the FunctionPointer was created from a function_ref + // instruction. + llvm::Optional afpPtrValue = llvm::None; + auto getAFPPtr = [&]() { + if (!afpPtrValue) { + auto *ptr = functionPointer.getRawPointer(); + if (auto authInfo = functionPointer.getAuthInfo()) { + ptr = emitPointerAuthAuth(IGF, ptr, authInfo); + } + auto *afpPtr = + IGF.Builder.CreateBitCast(ptr, IGF.IGM.AsyncFunctionPointerPtrTy); + afpPtrValue = afpPtr; + } + return *afpPtrValue; + }; llvm::Value *fn = nullptr; if (emitFunction) { if (functionPointer.useStaticContextSize()) { fn = functionPointer.getRawPointer(); + } else if (auto *function = functionPointer.getRawAsyncFunction()) { + fn = function; } else { - llvm::Value *addrPtr = IGF.Builder.CreateStructGEP(afpPtr, 0); + llvm::Value *addrPtr = IGF.Builder.CreateStructGEP(getAFPPtr(), 0); fn = IGF.emitLoadOfRelativePointer( Address(addrPtr, IGF.IGM.getPointerAlignment()), /*isFar*/ false, /*expectedType*/ functionPointer.getFunctionType()->getPointerTo()); @@ -2014,7 +2029,7 @@ std::pair irgen::getAsyncFunctionAndSize( initialContextSize.getValue()); } else { assert(!functionPointer.useStaticContextSize()); - auto *sizePtr = IGF.Builder.CreateStructGEP(afpPtr, 1); + auto *sizePtr = IGF.Builder.CreateStructGEP(getAFPPtr(), 1); size = IGF.Builder.CreateLoad(sizePtr, IGF.IGM.getPointerAlignment()); } } @@ -4667,8 +4682,9 @@ Callee irgen::getCFunctionPointerCallee(IRGenFunction &IGF, FunctionPointer FunctionPointer::forDirect(IRGenModule &IGM, llvm::Constant *fnPtr, + llvm::Constant *secondaryValue, CanSILFunctionType fnType) { - return forDirect(fnType, fnPtr, IGM.getSignature(fnType)); + return forDirect(fnType, fnPtr, secondaryValue, IGM.getSignature(fnType)); } StringRef FunctionPointer::getName(IRGenModule &IGM) const { @@ -4690,6 +4706,14 @@ llvm::Value *FunctionPointer::getPointer(IRGenFunction &IGF) const { case BasicKind::Function: return Value; case BasicKind::AsyncFunctionPointer: { + if (auto *rawFunction = getRawAsyncFunction()) { + // If the pointer to the underlying function is available, it means that + // this FunctionPointer instance was created via + // FunctionPointer::forDirect and as such has no AuthInfo. + assert(!AuthInfo && "have PointerAuthInfo for an async FunctionPointer " + "for which the raw function is known"); + return rawFunction; + } auto *fnPtr = Value; if (auto authInfo = AuthInfo) { fnPtr = emitPointerAuthAuth(IGF, fnPtr, authInfo); diff --git a/lib/IRGen/GenClass.cpp b/lib/IRGen/GenClass.cpp index 6cd356ec1081d..d996f530fad9b 100644 --- a/lib/IRGen/GenClass.cpp +++ b/lib/IRGen/GenClass.cpp @@ -2653,7 +2653,15 @@ FunctionPointer irgen::emitVirtualMethodValue(IRGenFunction &IGF, case ClassMetadataLayout::MethodInfo::Kind::DirectImpl: { auto fnPtr = llvm::ConstantExpr::getBitCast(methodInfo.getDirectImpl(), signature.getType()->getPointerTo()); - return FunctionPointer::forDirect(methodType, fnPtr, signature); + llvm::Constant *secondaryValue = nullptr; + if (cast(method.getDecl())->hasAsync()) { + auto *silFn = IGF.IGM.getSILFunctionForAsyncFunctionPointer( + methodInfo.getDirectImpl()); + secondaryValue = cast( + IGF.IGM.getAddrOfSILFunction(silFn, NotForDefinition)); + } + return FunctionPointer::forDirect(methodType, fnPtr, secondaryValue, + signature); } } diff --git a/lib/IRGen/GenKeyPath.cpp b/lib/IRGen/GenKeyPath.cpp index d1bb530f32c26..01d0973d1bbd1 100644 --- a/lib/IRGen/GenKeyPath.cpp +++ b/lib/IRGen/GenKeyPath.cpp @@ -252,8 +252,9 @@ getAccessorForComputedComponent(IRGenModule &IGM, &ignoreWitnessMetadata, forwardedArgs); } - auto fnPtr = FunctionPointer::forDirect(IGM, accessorFn, - accessor->getLoweredFunctionType()); + auto fnPtr = + FunctionPointer::forDirect(IGM, accessorFn, /*secondaryValue*/ nullptr, + accessor->getLoweredFunctionType()); auto call = IGF.Builder.CreateCall(fnPtr, forwardedArgs.claimAll()); if (call->getType()->isVoidTy()) diff --git a/lib/IRGen/GenObjC.cpp b/lib/IRGen/GenObjC.cpp index 38dcb2b3ebbaf..0284f790f9a65 100644 --- a/lib/IRGen/GenObjC.cpp +++ b/lib/IRGen/GenObjC.cpp @@ -658,8 +658,9 @@ Callee irgen::getObjCMethodCallee(IRGenFunction &IGF, Selector selector(method); llvm::Value *selectorValue = IGF.emitObjCSelectorRefLoad(selector.str()); - auto fn = FunctionPointer::forDirect(FunctionPointer::Kind::Function, - messenger, sig); + auto fn = + FunctionPointer::forDirect(FunctionPointer::Kind::Function, messenger, + /*secondaryValue*/ nullptr, sig); return Callee(std::move(info), fn, receiverValue, selectorValue); } diff --git a/lib/IRGen/IRGenModule.cpp b/lib/IRGen/IRGenModule.cpp index 2a03941f2fd96..0d61f1f907e15 100644 --- a/lib/IRGen/IRGenModule.cpp +++ b/lib/IRGen/IRGenModule.cpp @@ -899,9 +899,8 @@ llvm::Constant *swift::getRuntimeFn(llvm::Module &Module, } llvm::Constant *IRGenModule::getDeletedAsyncMethodErrorAsyncFunctionPointer() { - return getAddrOfLLVMVariable( - LinkEntity::forKnownAsyncFunctionPointer("swift_deletedAsyncMethodError"), - ConstantInit(), DebugTypeInfo()); + return getAddrOfLLVMVariableOrGOTEquivalent( + LinkEntity::forKnownAsyncFunctionPointer("swift_deletedAsyncMethodError")).getValue(); } #define QUOTE(...) __VA_ARGS__ diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index 7b6be95b827e8..88272ec723758 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -2526,13 +2526,17 @@ void IRGenSILFunction::visitFunctionRefBaseInst(FunctionRefBaseInst *i) { fn, NotForDefinition, false /*isDynamicallyReplaceableImplementation*/, isa(i)); llvm::Constant *value; + llvm::Constant *secondaryValue; if (fpKind.isAsyncFunctionPointer()) { value = IGM.getAddrOfAsyncFunctionPointer(fn); value = llvm::ConstantExpr::getBitCast(value, fnPtr->getType()); + secondaryValue = IGM.getAddrOfSILFunction(fn, NotForDefinition); } else { value = fnPtr; + secondaryValue = nullptr; } - FunctionPointer fp = FunctionPointer(fpKind, value, sig); + FunctionPointer fp = + FunctionPointer::forDirect(fpKind, value, secondaryValue, sig); // Store the function as a FunctionPointer so we can avoid bitcasting // or thunking if we don't need to. @@ -6134,6 +6138,11 @@ void IRGenSILFunction::visitCheckedCastAddrBranchInst( } void IRGenSILFunction::visitHopToExecutorInst(HopToExecutorInst *i) { + if (!i->getFunction()->isAsync()) { + // This should never occur. + assert(false && "The hop_to_executor should have been eliminated"); + return; + } assert(i->getTargetExecutor()->getType().is()); llvm::Value *resumeFn = Builder.CreateIntrinsicCall( llvm::Intrinsic::coro_async_resume, {}); @@ -6525,8 +6534,10 @@ void IRGenSILFunction::visitWitnessMethodInst(swift::WitnessMethodInst *i) { if (IGM.isResilient(conformance.getRequirement(), ResilienceExpansion::Maximal)) { llvm::Constant *fnPtr = IGM.getAddrOfDispatchThunk(member, NotForDefinition); + llvm::Constant *secondaryValue = nullptr; if (fnType->isAsync()) { + secondaryValue = fnPtr; auto *fnPtrType = fnPtr->getType(); fnPtr = IGM.getAddrOfAsyncFunctionPointer( LinkEntity::forDispatchThunk(member)); @@ -6534,7 +6545,7 @@ void IRGenSILFunction::visitWitnessMethodInst(swift::WitnessMethodInst *i) { } auto sig = IGM.getSignature(fnType); - auto fn = FunctionPointer::forDirect(fnType, fnPtr, sig); + auto fn = FunctionPointer::forDirect(fnType, fnPtr, secondaryValue, sig); setLoweredFunctionPointer(i, fn); return; diff --git a/lib/SILGen/SILGenBridging.cpp b/lib/SILGen/SILGenBridging.cpp index 9127d6a841799..4932e7a6e7895 100644 --- a/lib/SILGen/SILGenBridging.cpp +++ b/lib/SILGen/SILGenBridging.cpp @@ -1484,7 +1484,7 @@ SILFunction *SILGenFunction::emitNativeAsyncToForeignThunk(SILDeclRef thunk) { assert(thunkSuffix[1] == 'T' && thunkSuffix[0] == 'o' && "not an objc thunk?"); - closureName += "yyYcfU_"; // closure with type () async -> () + closureName += "yyYacfU_"; // closure with type () async -> () closureName.push_back(thunkSuffix[1]); closureName.push_back(thunkSuffix[0]); diff --git a/lib/SILOptimizer/Mandatory/DiagnoseLifetimeIssues.cpp b/lib/SILOptimizer/Mandatory/DiagnoseLifetimeIssues.cpp index f96d0c72e1444..a6faf6061f6bc 100644 --- a/lib/SILOptimizer/Mandatory/DiagnoseLifetimeIssues.cpp +++ b/lib/SILOptimizer/Mandatory/DiagnoseLifetimeIssues.cpp @@ -36,6 +36,7 @@ #include "swift/SILOptimizer/PassManager/Transforms.h" #include "swift/SILOptimizer/Utils/PrunedLiveness.h" #include "swift/Demangling/Demangler.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/Support/Debug.h" #include "clang/AST/DeclObjC.h" @@ -45,14 +46,41 @@ namespace { /// Performs the analysis and prints the warnings. class DiagnoseLifetimeIssues { + enum State { + /// There are no hidden uses which could keep the object alive. + DoesNotEscape, + + /// For example, in case the object is stored somewhere. + CanEscape, + + /// The object is stored to a weak reference field. + /// Implies ``DoesNotEscape``. + IsStoredWeakly + }; + + /// To avoid quadratic complexity in the rare corener case of very deep + /// callgraphs, with pass down references. + static constexpr int maxCallDepth = 8; + + /// The liveness of the object in question, computed in visitUses. PrunedLiveness liveness; - /// Reuse a general worklist for def-use traversal. - SmallSetVector defUseWorklist; + /// All weak stores of the object, which are found in visitUses. + llvm::SmallVector weakStores; - bool computeCanonicalLiveness(SILValue def); + /// A cache for function argument states of called functions. + /// + /// We could also cache this information in an Analysis, so that it persists + /// over runs of this pass for different functions. But computing the state + /// is very cheap and we avoid worst case scenarios with maxCallDepth. So it's + /// propably not worth doing it. + llvm::DenseMap argumentStates; - void reportDeadStore(SILInstruction *storeInst, SILValue src); + State visitUses(SILValue def, bool updateLivenessAndWeakStores, int callDepth); + + State getArgumentState(ApplySite ai, Operand *applyOperand, int callDepth); + + void reportDeadStore(SILInstruction *allocationInst); public: DiagnoseLifetimeIssues() {} @@ -61,15 +89,19 @@ class DiagnoseLifetimeIssues { }; /// Returns true if def is an owned value resulting from an object allocation. -static bool isAllocation(SILValue def) { - if (def.getOwnershipKind() != OwnershipKind::Owned) +static bool isAllocation(SILInstruction *inst) { + auto *svi = dyn_cast(inst); + if (!svi) return false; - if (isa(def)) + if (svi->getOwnershipKind() != OwnershipKind::Owned) + return false; + + if (isa(svi)) return true; // Check if it's a call to an allocating initializer. - if (auto *applyInst = dyn_cast(def)) { + if (auto *applyInst = dyn_cast(svi)) { SILFunction *callee = applyInst->getReferencedFunctionOrNull(); if (!callee) return false; @@ -83,25 +115,82 @@ static bool isAllocation(SILValue def) { return false; } -/// Computes the canoncial lifetime of \p def, like the copy-propagation pass -/// would do. -/// The only difference is that we are treating enum instructions (taking a -/// payload) like copies. Enums are important because the operand of a -/// store_weak is always an Optional. -bool DiagnoseLifetimeIssues::computeCanonicalLiveness(SILValue def) { - defUseWorklist.clear(); +/// Returns true if \p inst is a call of an ObjC setter to a weak property. +static bool isStoreObjcWeak(SILInstruction *inst, Operand *op) { + auto *apply = dyn_cast(inst); + if (!apply || apply->getNumArguments() < 1) + return false; + + if (&apply->getArgumentOperands()[0] != op) + return false; + + auto *method = dyn_cast(apply->getCallee()); + if (!method) + return false; + + Decl *decl = method->getMember().getDecl(); + auto *accessor = dyn_cast(decl); + if (!accessor) + return false; + + auto *var = dyn_cast(accessor->getStorage()); + if (!var) + return false; + + ClangNode clangNode = var->getClangNode(); + if (!clangNode) + return false; + + auto *objcDecl = dyn_cast_or_null(clangNode.getAsDecl()); + if (!objcDecl) + return false; + + return objcDecl->getSetterKind() == clang::ObjCPropertyDecl::Weak; +} + +/// Transitively iterates over all uses of \p def and and - if \p +/// updateLivenessAndWeakStores is true - adds them to self.liveness. +/// If any weak stores are seen, add them to self.weakStores (also only if +/// \p updateLivenessAndWeakStores is true). +/// +/// Returns the state of \p def. See DiagnoseLifetimeIssues::State. +DiagnoseLifetimeIssues::State DiagnoseLifetimeIssues:: +visitUses(SILValue def, bool updateLivenessAndWeakStores, int callDepth) { + SmallSetVector defUseWorklist; defUseWorklist.insert(def); + bool foundWeakStore = false; while (!defUseWorklist.empty()) { SILValue value = defUseWorklist.pop_back_val(); for (Operand *use : value->getUses()) { auto *user = use->getUser(); - // Recurse through copies and enums. + // Recurse through copies and enums. Enums are important because the + // operand of a store_weak is always an Optional. if (isa(user) || isa(user) || isa(user)) { defUseWorklist.insert(cast(user)); continue; } + if (isa(user) || isStoreObjcWeak(user, use)) { + if (updateLivenessAndWeakStores) + weakStores.push_back(user); + foundWeakStore = true; + continue; + } + if (ApplySite ai = ApplySite::isa(user)) { + // Try to get information from the called function. + switch (getArgumentState(ai, use, callDepth)) { + case DoesNotEscape: + break; + case CanEscape: + return CanEscape; + case IsStoredWeakly: + if (updateLivenessAndWeakStores) + weakStores.push_back(user); + foundWeakStore = true; + } + continue; + } switch (use->getOperandOwnership()) { case OperandOwnership::NonUse: break; @@ -112,77 +201,74 @@ bool DiagnoseLifetimeIssues::computeCanonicalLiveness(SILValue def) { // escape. Is it legal to canonicalize ForwardingUnowned? case OperandOwnership::ForwardingUnowned: case OperandOwnership::PointerEscape: - return false; + return CanEscape; case OperandOwnership::InstantaneousUse: case OperandOwnership::UnownedInstantaneousUse: case OperandOwnership::BitwiseEscape: - liveness.updateForUse(user, /*lifetimeEnding*/ false); + if (updateLivenessAndWeakStores) + liveness.updateForUse(user, /*lifetimeEnding*/ false); break; case OperandOwnership::ForwardingConsume: // TODO: handle forwarding instructions, e.g. casts. - return false; + return CanEscape; case OperandOwnership::DestroyingConsume: // destroy_value does not force pruned liveness (but store etc. does). if (!isa(user)) - return false; + return CanEscape; break; case OperandOwnership::Borrow: - if (!liveness.updateForBorrowingOperand(use)) - return false; + if (updateLivenessAndWeakStores && + !liveness.updateForBorrowingOperand(use)) + return CanEscape; break; case OperandOwnership::InteriorPointer: case OperandOwnership::ForwardingBorrow: case OperandOwnership::EndBorrow: case OperandOwnership::Reborrow: - llvm_unreachable("operand kind cannot take an owned value"); + return CanEscape; } } } - return true; + return foundWeakStore ? IsStoredWeakly : DoesNotEscape; } -/// Gets the underlying definition of \p val, looking through copy_value and -/// enum instructions. -static SILValue getCanonicalDef(SILValue val) { - while (true) { - if (auto *copyInst = dyn_cast(val)) { - SILValue copySrc = copyInst->getOperand(); - if (copySrc.getOwnershipKind() != OwnershipKind::Owned) - return val; - val = copySrc; - continue; - } - if (auto *enumInst = dyn_cast(val)) { - if (enumInst->hasOperand()) { - val = enumInst->getOperand(); - continue; - } - } - if (auto *initExRef = dyn_cast(val)) { - val = initExRef->getOperand(); - continue; - } - return val; - } -} +/// Visits uses of an apply argument in the called function. +DiagnoseLifetimeIssues::State DiagnoseLifetimeIssues:: +getArgumentState(ApplySite ai, Operand *applyOperand, int callDepth) { + if (callDepth >= maxCallDepth) + return CanEscape; -/// Reports a warning if the stored object \p storedObj is never loaded within -/// the lifetime of the stored object. -void DiagnoseLifetimeIssues::reportDeadStore(SILInstruction *storeInst, - SILValue storedObj) { - SILValue storedDef = getCanonicalDef(storedObj); + if (!FullApplySite::isa(ai.getInstruction())) + return CanEscape; - // Only for allocations we know that a destroy will actually deallocate the - // object. Otherwise the object could be kept alive by other references and - // we would issue a false alarm. - if (!isAllocation(storedDef)) - return; + SILFunction *callee = ai.getReferencedFunctionOrNull(); + if (!callee || callee->empty()) + return CanEscape; + + if (!ai.isArgumentOperand(*applyOperand)) + return CanEscape; - liveness.clear(); - liveness.initializeDefBlock(storedDef->getParentBlock()); - if (!computeCanonicalLiveness(storedDef)) - return; + SILBasicBlock *entryBlock = callee->getEntryBlock(); + unsigned calleeIdx = ai.getCalleeArgIndex(*applyOperand); + auto *arg = cast(entryBlock->getArgument(calleeIdx)); + // Check if we already cached the analysis result. + auto iter = argumentStates.find(arg); + if (iter != argumentStates.end()) + return iter->second; + + // Before we continue with the recursion, already set a (conservative) state. + // This avoids infinite recursion in case of a cycle in the callgraph. + argumentStates[arg] = CanEscape; + + State argState = visitUses(arg, /*updateLivenessAndWeakStores*/ false, + callDepth + 1); + argumentStates[arg] = argState; + return argState; +} + +/// Returns true if \p inst is outside the the pruned \p liveness. +static bool isOutOfLifetime(SILInstruction *inst, PrunedLiveness &liveness) { // Check if the lifetime of the stored object ends at the store_weak. // // A more sophisticated analysis would be to check if there are no @@ -193,70 +279,65 @@ void DiagnoseLifetimeIssues::reportDeadStore(SILInstruction *storeInst, // always see a potential load if the lifetime of the object goes beyond the // store_weak. - SILBasicBlock *storeBlock = storeInst->getParent(); - if (liveness.getBlockLiveness(storeBlock) != PrunedLiveBlocks::LiveWithin) - return; + SILBasicBlock *block = inst->getParent(); + if (liveness.getBlockLiveness(block) != PrunedLiveBlocks::LiveWithin) + return false; // If there are any uses after the store_weak, it means that the liferange of // the object goes beyond the store_weak. - for (SILInstruction &inst : make_range(std::next(storeInst->getIterator()), - storeBlock->end())) { + for (SILInstruction &inst : make_range(std::next(inst->getIterator()), + block->end())) { switch (liveness.isInterestingUser(&inst)) { case PrunedLiveness::NonUser: break; case PrunedLiveness::NonLifetimeEndingUse: case PrunedLiveness::LifetimeEndingUse: - return; + return false; } } - - // Issue the warning. - storeInst->getModule().getASTContext().Diags.diagnose( - storeInst->getLoc().getSourceLoc(), diag::warn_dead_weak_store); + return true; } -/// Returns true if \p inst is a call of an ObjC setter to a weak property. -static bool isStoreObjcWeak(SILInstruction *inst) { - auto *apply = dyn_cast(inst); - if (!apply || apply->getNumArguments() < 1) - return false; - - auto *method = dyn_cast(apply->getCallee()); - if (!method) - return false; - - Decl *decl = method->getMember().getDecl(); - auto *accessor = dyn_cast(decl); - if (!accessor) - return false; +/// Reports a warning if the stored object \p storedObj is never loaded within +/// the lifetime of the stored object. +void DiagnoseLifetimeIssues::reportDeadStore(SILInstruction *allocationInst) { + liveness.clear(); + weakStores.clear(); - auto *var = dyn_cast(accessor->getStorage()); - if (!var) - return false; + SILValue storedDef = cast(allocationInst); + liveness.initializeDefBlock(storedDef->getParentBlock()); - ClangNode clangNode = var->getClangNode(); - if (!clangNode) - return false; - - auto *objcDecl = dyn_cast_or_null(clangNode.getAsDecl()); - if (!objcDecl) - return false; + // Compute the canoncial lifetime of storedDef, like the copy-propagation pass + // would do. + State state = visitUses(storedDef, /*updateLivenessAndWeakStores*/ true, + /*callDepth*/ 0); - return objcDecl->getSetterKind() == clang::ObjCPropertyDecl::Weak; + // If the allocation escapes (e.g. it is stored somewhere), we should not + // give a warning, becuase it can be a false alarm. The allocation could be + // kept alive by references we don't see. + if (state == CanEscape) + return; + + assert((state == IsStoredWeakly) == !weakStores.empty()); + + for (SILInstruction *storeInst : weakStores) { + if (isOutOfLifetime(storeInst, liveness)) { + // Issue the warning. + storeInst->getModule().getASTContext().Diags.diagnose( + storeInst->getLoc().getSourceLoc(), diag::warn_dead_weak_store); + } + } } /// Prints warnings for dead weak stores in \p function. void DiagnoseLifetimeIssues::diagnose(SILFunction *function) { for (SILBasicBlock &block : *function) { for (SILInstruction &inst : block) { - if (auto *stWeak = dyn_cast(&inst)) { - reportDeadStore(stWeak, stWeak->getSrc()); - continue; - } - if (isStoreObjcWeak(&inst)) { - reportDeadStore(&inst, cast(&inst)->getArgument(0)); - continue; - } + // Only for allocations we know that a destroy will actually deallocate + // the object. Otherwise the object could be kept alive by other + // references and we would issue a false alarm. + if (isAllocation(&inst)) + reportDeadStore(&inst); } } } diff --git a/lib/SILOptimizer/Utils/SILInliner.cpp b/lib/SILOptimizer/Utils/SILInliner.cpp index 789e1c2ad58f1..a2abc68fde806 100644 --- a/lib/SILOptimizer/Utils/SILInliner.cpp +++ b/lib/SILOptimizer/Utils/SILInliner.cpp @@ -288,6 +288,7 @@ class SILInlineCloner void visitDebugValueInst(DebugValueInst *Inst); void visitDebugValueAddrInst(DebugValueAddrInst *Inst); + void visitHopToExecutorInst(HopToExecutorInst *Inst); void visitTerminator(SILBasicBlock *BB); @@ -620,7 +621,15 @@ void SILInlineCloner::visitDebugValueAddrInst(DebugValueAddrInst *Inst) { return SILCloner::visitDebugValueAddrInst(Inst); } +void SILInlineCloner::visitHopToExecutorInst(HopToExecutorInst *Inst) { + // Drop hop_to_executor in non async functions. + if (!Apply.getFunction()->isAsync()) { + assert(Apply.isNonAsync()); + return; + } + return SILCloner::visitHopToExecutorInst(Inst); +} const SILDebugScope * SILInlineCloner::getOrCreateInlineScope(const SILDebugScope *CalleeScope) { if (!CalleeScope) diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 0a8ca7ac702d2..1b1012e8bace6 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -6216,8 +6216,11 @@ static CheckedCastKind getCheckedCastKind(ConstraintSystem *cs, static bool isCastToExpressibleByNilLiteral(ConstraintSystem &cs, Type fromType, Type toType) { auto &ctx = cs.getASTContext(); - auto *nilLiteral = - ctx.getProtocol(KnownProtocolKind::ExpressibleByNilLiteral); + auto *nilLiteral = TypeChecker::getProtocol( + ctx, SourceLoc(), KnownProtocolKind::ExpressibleByNilLiteral); + if (!nilLiteral) + return false; + return toType->isEqual(nilLiteral->getDeclaredType()) && fromType->getOptionalObjectType(); } diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp index 5c6b1d44e7d07..15c10e58637b7 100644 --- a/lib/Sema/TypeCheckType.cpp +++ b/lib/Sema/TypeCheckType.cpp @@ -2524,10 +2524,12 @@ TypeResolver::resolveAttributedType(TypeAttributes &attrs, TypeRepr *repr, } if (attrs.has(TAK_noDerivative)) { - // @noDerivative is only valid on function parameters, or on function - // results in SIL. + // @noDerivative is valid on function parameters (AST and SIL) or on + // function results (SIL-only). bool isNoDerivativeAllowed = - isParam || (isResult && (options & TypeResolutionFlags::SILType)); + isParam || + options.is(TypeResolverContext::InoutFunctionInput) || + (isResult && (options & TypeResolutionFlags::SILType)); auto *SF = getDeclContext()->getParentSourceFile(); if (SF && !isDifferentiableProgrammingEnabled(*SF)) { diagnose( @@ -2645,7 +2647,7 @@ TypeResolver::resolveASTFunctionTypeParams(TupleTypeRepr *inputRepr, if (auto *ATR = dyn_cast(eltTypeRepr)) autoclosure = ATR->getAttrs().has(TAK_autoclosure); - ValueOwnership ownership; + ValueOwnership ownership = ValueOwnership::Default; auto *nestedRepr = eltTypeRepr; @@ -2657,31 +2659,35 @@ TypeResolver::resolveASTFunctionTypeParams(TupleTypeRepr *inputRepr, nestedRepr = tupleRepr->getElementType(0); } - switch (nestedRepr->getKind()) { - case TypeReprKind::Shared: - ownership = ValueOwnership::Shared; - break; - case TypeReprKind::InOut: - ownership = ValueOwnership::InOut; - break; - case TypeReprKind::Owned: - ownership = ValueOwnership::Owned; - break; - default: - ownership = ValueOwnership::Default; - break; + if (auto *specifierRepr = dyn_cast(nestedRepr)) { + switch (specifierRepr->getKind()) { + case TypeReprKind::Shared: + ownership = ValueOwnership::Shared; + nestedRepr = specifierRepr->getBase(); + break; + case TypeReprKind::InOut: + ownership = ValueOwnership::InOut; + nestedRepr = specifierRepr->getBase(); + break; + case TypeReprKind::Owned: + ownership = ValueOwnership::Owned; + nestedRepr = specifierRepr->getBase(); + break; + default: + break; + } } bool noDerivative = false; - if (auto *attrTypeRepr = dyn_cast(eltTypeRepr)) { + if (auto *attrTypeRepr = dyn_cast(nestedRepr)) { if (attrTypeRepr->getAttrs().has(TAK_noDerivative)) { if (diffKind == DifferentiabilityKind::NonDifferentiable && isDifferentiableProgrammingEnabled( *getDeclContext()->getParentSourceFile())) - diagnose(eltTypeRepr->getLoc(), + diagnose(nestedRepr->getLoc(), diag::attr_only_on_parameters_of_differentiable, "@noDerivative") - .highlight(eltTypeRepr->getSourceRange()); + .highlight(nestedRepr->getSourceRange()); else noDerivative = true; } @@ -3476,7 +3482,7 @@ TypeResolver::resolveSpecifierTypeRepr(SpecifierTypeRepr *repr, if (isa(repr) && !isa(repr->getBase())) { // Anything within an inout isn't a parameter anymore. - options.setContext(None); + options.setContext(TypeResolverContext::InoutFunctionInput); } return resolveType(repr->getBase(), options); @@ -3554,6 +3560,7 @@ NeverNullType TypeResolver::resolveImplicitlyUnwrappedOptionalType( bool doDiag = false; switch (options.getContext()) { case TypeResolverContext::None: + case TypeResolverContext::InoutFunctionInput: if (!isDirect || !(options & allowIUO)) doDiag = true; break; diff --git a/lib/Sema/TypeCheckType.h b/lib/Sema/TypeCheckType.h index 63986c1dab42c..0bd0e802048e9 100644 --- a/lib/Sema/TypeCheckType.h +++ b/lib/Sema/TypeCheckType.h @@ -85,6 +85,9 @@ enum class TypeResolverContext : uint8_t { /// Whether this is a variadic function input. VariadicFunctionInput, + /// Whether this is an 'inout' function input. + InoutFunctionInput, + /// Whether we are in the result type of a function, including multi-level /// tuple return values. See also: TypeResolutionFlags::Direct FunctionResult, @@ -198,6 +201,7 @@ class TypeResolutionOptions { case Context::None: case Context::FunctionInput: case Context::VariadicFunctionInput: + case Context::InoutFunctionInput: case Context::FunctionResult: case Context::ExtensionBinding: case Context::SubscriptDecl: diff --git a/stdlib/public/Concurrency/CMakeLists.txt b/stdlib/public/Concurrency/CMakeLists.txt index 637d4b1f8c525..3313f56c8a60b 100644 --- a/stdlib/public/Concurrency/CMakeLists.txt +++ b/stdlib/public/Concurrency/CMakeLists.txt @@ -69,6 +69,7 @@ add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I TaskLocal.swift ThreadSanitizer.cpp Mutex.cpp + YieldingContinuation.swift ${swift_concurrency_objc_sources} SWIFT_MODULE_DEPENDS_LINUX Glibc diff --git a/stdlib/public/Concurrency/YieldingContinuation.swift b/stdlib/public/Concurrency/YieldingContinuation.swift new file mode 100644 index 0000000000000..dd4c39da2cb48 --- /dev/null +++ b/stdlib/public/Concurrency/YieldingContinuation.swift @@ -0,0 +1,193 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2020-2021 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import Swift + +internal final class _YieldingContinuationStorage: UnsafeSendable { + var continuation: Builtin.RawUnsafeContinuation? +} + +@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) +public struct YieldingContinuation: Sendable { + let storage = _YieldingContinuationStorage() + + /// Construct a YieldingContinuation. + /// + /// This continuation type can be called more than once, unlike the unsafe and + /// checked counterparts. Each call to the yielding functions will resume any + /// awaiter on the next function. This type is inherently sendable and can + /// safely be used and stored in multiple task contexts. + public init() { } + + /// Construct a YieldingContinuation with specific types including a failure. + /// + /// This continuation type can be called more than once, unlike the unsafe and + /// checked counterparts. Each call to the yielding functions will resume any + /// awaiter on the next function. This type is inherently sendable and can + /// safely be used and stored in multiple task contexts. + public init(yielding: Element.Type, throwing: Failure.Type) { } + + internal func _extract() -> UnsafeContinuation? { + let raw = Builtin.atomicrmw_xchg_acqrel_Word( + Builtin.addressof(&storage.continuation), + UInt(bitPattern: 0)._builtinWordValue) + return unsafeBitCast(raw, to: UnsafeContinuation?.self) + } + + internal func _inject( + _ continuation: UnsafeContinuation + ) -> UnsafeContinuation? { + let rawContinuation = unsafeBitCast(continuation, to: Builtin.Word.self) + let raw = Builtin.atomicrmw_xchg_acqrel_Word( + Builtin.addressof(&storage.continuation), rawContinuation) + return unsafeBitCast(raw, to: UnsafeContinuation?.self) + } + + /// Resume the task awaiting next by having it return normally from its + /// suspension point. + /// + /// - Parameter value: The value to return from an awaiting call to next. + /// + /// Unlike other continuations `YieldingContinuation` may resume more than + /// once. However if there are no potential awaiting calls to `next` this + /// function will return false, indicating that the caller needs to decide how + /// the behavior should be handled. + public func yield(_ value: __owned Element) -> Bool { + if let continuation = _extract() { + continuation.resume(returning: value) + return true + } + return false + } + + /// Resume the task awaiting the continuation by having it throw an error + /// from its suspension point. + /// + /// - Parameter error: The error to throw from an awaiting call to next. + /// + /// Unlike other continuations `YieldingContinuation` may resume more than + /// once. However if there are no potential awaiting calls to `next` this + /// function will return false, indicating that the caller needs to decide how + /// the behavior should be handled. + public func yield(throwing error: __owned Failure) -> Bool { + if let continuation = _extract() { + continuation.resume(throwing: error) + return true + } + return false + } +} + +@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) +extension YieldingContinuation where Failure == Error { + /// Await a resume from a call to a yielding function. + /// + /// - Return: The element that was yielded or a error that was thrown. + /// + /// When multiple calls are awaiting a produced value from next any call to + /// yield will resume all awaiting calls to next with that value. + public func next() async throws -> Element { + var existing: UnsafeContinuation? + do { + let result = try await withUnsafeThrowingContinuation { + (continuation: UnsafeContinuation) in + existing = _inject(continuation) + } + existing?.resume(returning: result) + return result + } catch { + existing?.resume(throwing: error) + throw error + } + } +} + +@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) +extension YieldingContinuation where Failure == Never { + /// Construct a YieldingContinuation with a specific Element type. + /// + /// This continuation type can be called more than once, unlike the unsafe and + /// checked counterparts. Each call to the yielding functions will resume any + /// awaiter on the next function. This type is inherently sendable and can + /// safely be used and stored in multiple task contexts. + public init(yielding: Element.Type) { } + + /// Await a resume from a call to a yielding function. + /// + /// - Return: The element that was yielded. + public func next() async -> Element { + var existing: UnsafeContinuation? + let result = try! await withUnsafeThrowingContinuation { + (continuation: UnsafeContinuation) in + existing = _inject(continuation) + } + existing?.resume(returning: result) + return result + } +} + +@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) +extension YieldingContinuation { + /// Resume the task awaiting the continuation by having it either + /// return normally or throw an error based on the state of the given + /// `Result` value. + /// + /// - Parameter result: A value to either return or throw from the + /// continuation. + /// + /// Unlike other continuations `YieldingContinuation` may resume more than + /// once. However if there are no potential awaiting calls to `next` this + /// function will return false, indicating that the caller needs to decide how + /// the behavior should be handled. + public func yield( + with result: Result + ) -> Bool where Failure == Error { + switch result { + case .success(let val): + return self.yield(val) + case .failure(let err): + return self.yield(throwing: err) + } + } + + /// Resume the task awaiting the continuation by having it either + /// return normally or throw an error based on the state of the given + /// `Result` value. + /// + /// - Parameter result: A value to either return or throw from the + /// continuation. + /// + /// Unlike other continuations `YieldingContinuation` may resume more than + /// once. However if there are no potential awaiting calls to `next` this + /// function will return false, indicating that the caller needs to decide how + /// the behavior should be handled. + public func yield(with result: Result) -> Bool { + switch result { + case .success(let val): + return self.yield(val) + case .failure(let err): + return self.yield(throwing: err) + } + } + + /// Resume the task awaiting the continuation by having it return normally + /// from its suspension point. + /// + /// Unlike other continuations `YieldingContinuation` may resume more than + /// once. However if there are no potential awaiting calls to `next` this + /// function will return false, indicating that the caller needs to decide how + /// the behavior should be handled. + public func yield() -> Bool where Element == Void { + return self.yield(()) + } +} + diff --git a/stdlib/public/Reflection/TypeRef.cpp b/stdlib/public/Reflection/TypeRef.cpp index 97fb64568690c..703fd9889f26a 100644 --- a/stdlib/public/Reflection/TypeRef.cpp +++ b/stdlib/public/Reflection/TypeRef.cpp @@ -582,6 +582,9 @@ class DemanglingForTypeRef parent->addChild(input, Dem); input = parent; }; + if (flags.isNoDerivative()) { + wrapInput(Node::Kind::NoDerivative); + } switch (flags.getValueOwnership()) { case ValueOwnership::Default: /* nothing */ diff --git a/stdlib/public/runtime/Demangle.cpp b/stdlib/public/runtime/Demangle.cpp index 60bfceddab79e..2b14ea7022765 100644 --- a/stdlib/public/runtime/Demangle.cpp +++ b/stdlib/public/runtime/Demangle.cpp @@ -482,6 +482,9 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type, parent->addChild(input, Dem); input = parent; }; + if (flags.isNoDerivative()) { + wrapInput(Node::Kind::NoDerivative); + } switch (flags.getValueOwnership()) { case ValueOwnership::Default: /* nothing */ @@ -561,15 +564,6 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type, result->addChild(resultTy, Dem); auto funcNode = Dem.createNode(kind); - if (func->isThrowing()) - funcNode->addChild(Dem.createNode(Node::Kind::ThrowsAnnotation), Dem); - if (func->isSendable()) { - funcNode->addChild( - Dem.createNode(Node::Kind::ConcurrentFunctionType), Dem); - } - if (func->isAsync()) - funcNode->addChild(Dem.createNode(Node::Kind::AsyncAnnotation), Dem); - switch (func->getDifferentiabilityKind().Value) { case FunctionMetadataDifferentiabilityKind::NonDifferentiable: break; @@ -594,6 +588,14 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type, (Node::IndexType)MangledDifferentiabilityKind::Linear), Dem); break; } + if (func->isThrowing()) + funcNode->addChild(Dem.createNode(Node::Kind::ThrowsAnnotation), Dem); + if (func->isSendable()) { + funcNode->addChild( + Dem.createNode(Node::Kind::ConcurrentFunctionType), Dem); + } + if (func->isAsync()) + funcNode->addChild(Dem.createNode(Node::Kind::AsyncAnnotation), Dem); funcNode->addChild(parameters, Dem); funcNode->addChild(result, Dem); diff --git a/test/AutoDiff/SILGen/mangling.swift b/test/AutoDiff/SILGen/mangling.swift index e3c7c1c65adc4..ed0e33073a2c6 100644 --- a/test/AutoDiff/SILGen/mangling.swift +++ b/test/AutoDiff/SILGen/mangling.swift @@ -7,17 +7,17 @@ import _Differentiation // CHECK-LABEL: sil hidden [ossa] @$s8mangling15nonescapingFunc2fnyS2fXE_tF : $@convention(thin) (@noescape @callee_guaranteed (Float) -> Float) -> () { func nonescapingFunc(fn: (Float) -> Float) {} -// CHECK-LABEL: sil hidden [ossa] @$s8mangling8diffFunc2fnyS2fjrXE_tF : $@convention(thin) (@differentiable(reverse) @noescape @callee_guaranteed (Float) -> Float) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s8mangling8diffFunc2fnyS2fYjrXE_tF : $@convention(thin) (@differentiable(reverse) @noescape @callee_guaranteed (Float) -> Float) -> () { func diffFunc(fn: @differentiable(reverse) (Float) -> Float) {} -// CHECK-LABEL: sil hidden [ossa] @$s8mangling10linearFunc2fnyS2fjlXE_tF : $@convention(thin) (@differentiable(_linear) @noescape @callee_guaranteed (Float) -> Float) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s8mangling10linearFunc2fnyS2fYjlXE_tF : $@convention(thin) (@differentiable(_linear) @noescape @callee_guaranteed (Float) -> Float) -> () { func linearFunc(fn: @differentiable(_linear) (Float) -> Float) {} // CHECK-LABEL: sil hidden [ossa] @$s8mangling12escapingFunc2fnS2fcS2fc_tF : $@convention(thin) (@guaranteed @callee_guaranteed (Float) -> Float) -> @owned @callee_guaranteed (Float) -> Float { func escapingFunc(fn: @escaping (Float) -> Float) -> (Float) -> Float { fn } -// CHECK-LABEL: sil hidden [ossa] @$s8mangling16diffEscapingFunc2fnS2fjrcS2fjrc_tF : $@convention(thin) (@guaranteed @differentiable(reverse) @callee_guaranteed (Float) -> Float) -> @owned @differentiable(reverse) @callee_guaranteed (Float) -> Float { +// CHECK-LABEL: sil hidden [ossa] @$s8mangling16diffEscapingFunc2fnS2fYjrcS2fYjrc_tF : $@convention(thin) (@guaranteed @differentiable(reverse) @callee_guaranteed (Float) -> Float) -> @owned @differentiable(reverse) @callee_guaranteed (Float) -> Float { func diffEscapingFunc(fn: @escaping @differentiable(reverse) (Float) -> Float) -> @differentiable(reverse) (Float) -> Float { fn } -// CHECK-LABEL: sil hidden [ossa] @$s8mangling18linearEscapingFunc2fnS2fjlcS2fjlc_tF : $@convention(thin) (@guaranteed @differentiable(_linear) @callee_guaranteed (Float) -> Float) -> @owned @differentiable(_linear) @callee_guaranteed (Float) -> Float { +// CHECK-LABEL: sil hidden [ossa] @$s8mangling18linearEscapingFunc2fnS2fYjlcS2fYjlc_tF : $@convention(thin) (@guaranteed @differentiable(_linear) @callee_guaranteed (Float) -> Float) -> @owned @differentiable(_linear) @callee_guaranteed (Float) -> Float { func linearEscapingFunc(fn: @escaping @differentiable(_linear) (Float) -> Float) -> @differentiable(_linear) (Float) -> Float { fn } diff --git a/test/AutoDiff/validation-test/function_type_metadata.swift b/test/AutoDiff/validation-test/function_type_metadata.swift index 329aa67e34975..460181ca7d27e 100644 --- a/test/AutoDiff/validation-test/function_type_metadata.swift +++ b/test/AutoDiff/validation-test/function_type_metadata.swift @@ -26,14 +26,38 @@ if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { Swift.Optional """, String(reflecting: (@differentiable(reverse) (Float?) -> Float?).self)) - // FIXME(rdar://75916833): Mangle '@noDerivative' in function types. - // expectEqual( - // """ - // @differentiable(reverse) (Swift.Optional, \ - // @noDerivative Swift.Int) -> Swift.Optional - // """, - // String(reflecting: ( - // @differentiable(reverse) (Float?, @noDerivative Int) -> Float?).self)) + expectEqual( + """ + @differentiable(reverse) (Swift.Optional, \ + @noDerivative Swift.Int) -> Swift.Optional + """, + String(reflecting: ( + @differentiable(reverse) + (Float?, @noDerivative Int) -> Float?).self)) + expectEqual( + """ + @differentiable(reverse) (Swift.Optional, \ + __owned @noDerivative Swift.Int) -> Swift.Optional + """, + String(reflecting: ( + @differentiable(reverse) + (Float?, __owned @noDerivative Int) -> Float?).self)) + expectEqual( + """ + @differentiable(reverse) (Swift.Optional, \ + inout @noDerivative Swift.Int) -> Swift.Optional + """, + String(reflecting: ( + @differentiable(reverse) + (Float?, inout @noDerivative Int) -> Float?).self)) + expectEqual( + """ + @differentiable(reverse) @Sendable (Swift.Optional, \ + inout @noDerivative Swift.Int) -> Swift.Optional + """, + String(reflecting: ( + @differentiable(reverse) @Sendable + (Float?, inout @noDerivative Int) -> Float?).self)) } } diff --git a/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift b/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift index 2e489b54b84c8..e9100a4b09379 100644 --- a/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift +++ b/test/Concurrency/Runtime/async_taskgroup_asynciterator_semantics.swift @@ -1,7 +1,7 @@ // RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input=always // REQUIRES: executable_test // REQUIRES: concurrency -// XFAIL: linux +// UNSUPPORTED: linux // XFAIL: windows struct Boom: Error {} diff --git a/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift b/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift index 51188816787be..8c5fc22090c29 100644 --- a/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift +++ b/test/Concurrency/Runtime/async_taskgroup_is_asyncsequence.swift @@ -6,7 +6,7 @@ // rdar://76038845 // UNSUPPORTED: use_os_stdlib -// XFAIL: linux +// UNSUPPORTED: linux // XFAIL: windows @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) diff --git a/test/Concurrency/Runtime/yielding_continuation.swift b/test/Concurrency/Runtime/yielding_continuation.swift new file mode 100644 index 0000000000000..87cb6847114fa --- /dev/null +++ b/test/Concurrency/Runtime/yielding_continuation.swift @@ -0,0 +1,250 @@ +// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) + +// REQUIRES: executable_test +// REQUIRES: concurrency + +import _Concurrency +import StdlibUnittest + + +struct SomeError: Error, Equatable { + var value = Int.random(in: 0..<100) +} + +let sleepInterval: UInt64 = 125_000_000 +var tests = TestSuite("YieldingContinuation") + +if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { + func forceBeingAsync() async -> Void { } + + tests.test("yield with no awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self) + expectFalse(continuation.yield("hello")) + await forceBeingAsync() + } + } + + tests.test("yield throwing with no awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self, throwing: Error.self) + expectFalse(continuation.yield(throwing: SomeError())) + await forceBeingAsync() + } + } + + tests.test("yield success result no awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self) + expectFalse(continuation.yield(with: .success("hello"))) + await forceBeingAsync() + } + } + + tests.test("yield failure result no awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self, throwing: Error.self) + expectFalse(continuation.yield(with: .failure(SomeError()))) + await forceBeingAsync() + } + } + + tests.test("yield with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self) + let t = detach { + let value = await continuation.next() + expectEqual(value, "hello") + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield("hello")) + await t.get() + } + } + + tests.test("yield result with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self) + let t = detach { + let value = await continuation.next() + expectEqual(value, "hello") + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(with: .success("hello"))) + await t.get() + } + } + + tests.test("yield throwing with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self, throwing: Error.self) + let failure = SomeError() + let t = detach { + do { + let value = try await continuation.next() + expectUnreachable() + } catch { + if let error = error as? SomeError { + expectEqual(error, failure) + } else { + expectUnreachable() + } + } + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(throwing: failure)) + await t.get() + } + } + + tests.test("yield failure with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self, throwing: Error.self) + let failure = SomeError() + let t = detach { + do { + let value = try await continuation.next() + expectUnreachable() + } catch { + if let error = error as? SomeError { + expectEqual(error, failure) + } else { + expectUnreachable() + } + } + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(with: .failure(failure))) + await t.get() + } + } + + tests.test("yield multiple times with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self) + let t = detach { + let value1 = await continuation.next() + expectEqual(value1, "hello") + let value2 = await continuation.next() + expectEqual(value2, "world") + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield("hello")) + await Task.sleep(sleepInterval) + expectTrue(continuation.yield("world")) + await t.get() + } + } + + tests.test("yield result multiple times with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self) + let t = detach { + let value1 = await continuation.next() + expectEqual(value1, "hello") + let value2 = await continuation.next() + expectEqual(value2, "world") + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(with: .success("hello"))) + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(with: .success("world"))) + await t.get() + } + } + + tests.test("yield throwing multiple times with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self, throwing: Error.self) + let failure1 = SomeError() + let failure2 = SomeError() + let t = detach { + do { + let value1 = try await continuation.next() + expectUnreachable() + } catch { + if let error = error as? SomeError { + expectEqual(error, failure1) + } else { + expectUnreachable() + } + } + do { + let value2 = try await continuation.next() + } catch { + if let error = error as? SomeError { + expectEqual(error, failure2) + } else { + expectUnreachable() + } + } + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(throwing: failure1)) + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(throwing: failure2)) + await t.get() + } + } + + tests.test("yield failure multiple times with awaiting next") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self, throwing: Error.self) + let failure1 = SomeError() + let failure2 = SomeError() + let t = detach { + do { + let value1 = try await continuation.next() + expectUnreachable() + } catch { + if let error = error as? SomeError { + expectEqual(error, failure1) + } else { + expectUnreachable() + } + } + do { + let value2 = try await continuation.next() + } catch { + if let error = error as? SomeError { + expectEqual(error, failure2) + } else { + expectUnreachable() + } + } + } + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(with: .failure(failure1))) + await Task.sleep(sleepInterval) + expectTrue(continuation.yield(with: .failure(failure2))) + await t.get() + } + } + + tests.test("concurrent value consumption") { + runAsyncAndBlock { + let continuation = YieldingContinuation(yielding: String.self) + let t1 = detach { + var result = await continuation.next() + expectEqual(result, "hello") + result = await continuation.next() + expectEqual(result, "world") + } + + let t2 = detach { + var result = await continuation.next() + expectEqual(result, "hello") + result = await continuation.next() + expectEqual(result, "world") + } + + await Task.sleep(sleepInterval) + continuation.yield("hello") + await Task.sleep(sleepInterval) + continuation.yield("world") + await t1.get() + await t2.get() + } + } +} +runAllTests() diff --git a/test/DebugInfo/async-args.swift b/test/DebugInfo/async-args.swift index c15b25d362ae5..8bc223b3e093c 100644 --- a/test/DebugInfo/async-args.swift +++ b/test/DebugInfo/async-args.swift @@ -9,7 +9,7 @@ func forceSplit() async { func withGenericArg(_ msg: T) async { // This odd debug info is part of a contract with CoroSplit/CoroFrame to fix // this up after coroutine splitting. - // CHECK-LABEL: {{^define .*}} @"$s1M14withGenericArgyyxYlF"(%swift.context* swiftasync %0 + // CHECK-LABEL: {{^define .*}} @"$s1M14withGenericArgyyxYalF"(%swift.context* swiftasync %0 // CHECK: call void @llvm.dbg.declare(metadata %swift.context* %0, // CHECK-SAME: metadata ![[MSG:[0-9]+]], metadata !DIExpression( // CHECK-SAME: DW_OP_plus_uconst, {{[0-9]+}}, DW_OP_deref)) @@ -18,7 +18,7 @@ func withGenericArg(_ msg: T) async { // CHECK-SAME: DW_OP_plus_uconst, {{[0-9]+}})) await forceSplit() - // CHECK-LABEL: {{^define .*}} @"$s1M14withGenericArgyyxYlFTQ0_"(i8* swiftasync %0) + // CHECK-LABEL: {{^define .*}} @"$s1M14withGenericArgyyxYalFTQ0_"(i8* swiftasync %0) // CHECK: call void @llvm.dbg.declare(metadata i8* %0, // CHECK-SAME: metadata ![[MSG_R:[0-9]+]], metadata !DIExpression(DW_OP_deref, // CHECK-SAME: DW_OP_plus_uconst, [[OFFSET:[0-9]+]], diff --git a/test/DebugInfo/async-let-await.swift b/test/DebugInfo/async-let-await.swift index edaeb07cec92c..97611bbba2a8e 100644 --- a/test/DebugInfo/async-let-await.swift +++ b/test/DebugInfo/async-let-await.swift @@ -8,7 +8,7 @@ public func getVegetables() async -> [String] { return ["leek", "carrot"] } -// CHECK: define {{.*}} @"$s1M14chopVegetablesSaySSGyYKFTQ0_" +// CHECK: define {{.*}} @"$s1M14chopVegetablesSaySSGyYaKFTQ0_" public func chopVegetables() async throws -> [String] { let veggies = await getVegetables() // CHECK-NOT: {{^define }} diff --git a/test/DebugInfo/async-lifetime-extension.swift b/test/DebugInfo/async-lifetime-extension.swift index 42e3044d06014..6a6b2c8bb898a 100644 --- a/test/DebugInfo/async-lifetime-extension.swift +++ b/test/DebugInfo/async-lifetime-extension.swift @@ -8,7 +8,7 @@ // Test that lifetime extension preserves a dbg.declare for "n" in the resume // funclet. -// CHECK-LABEL: define {{.*}} void @"$s1a4fiboyS2iYFTQ0_" +// CHECK-LABEL: define {{.*}} void @"$s1a4fiboyS2iYaFTQ0_" // CHECK-NEXT: entryresume.0: // CHECK-NEXT: call void @llvm.dbg.declare(metadata {{.*}}%0, metadata ![[RHS:[0-9]+]], {{.*}}!DIExpression(DW_OP // CHECK-NEXT: call void @llvm.dbg.declare(metadata {{.*}}%0, metadata ![[LHS:[0-9]+]], {{.*}}!DIExpression(DW_OP diff --git a/test/DebugInfo/async-local-var.swift b/test/DebugInfo/async-local-var.swift index 044d431a6d6ce..081054e0e03bb 100644 --- a/test/DebugInfo/async-local-var.swift +++ b/test/DebugInfo/async-local-var.swift @@ -15,7 +15,7 @@ public func makeDinner() async throws -> String { let local_constant = 5 let local = await getString() try await wait() -// CHECK-LABEL: define {{.*}} void @"$s1a10makeDinnerSSyYKFTQ0_" +// CHECK-LABEL: define {{.*}} void @"$s1a10makeDinnerSSyYaKFTQ0_" // CHECK-NEXT: entryresume.0: // CHECK-NOT: {{ ret }} // CHECK: call void @llvm.dbg.declare(metadata {{.*}}%0, metadata ![[LOCAL:[0-9]+]], {{.*}}!DIExpression(DW_OP_deref diff --git a/test/Demangle/Inputs/manglings.txt b/test/Demangle/Inputs/manglings.txt index a48ed3bc9c4fa..e4f2321e5acd2 100644 --- a/test/Demangle/Inputs/manglings.txt +++ b/test/Demangle/Inputs/manglings.txt @@ -370,15 +370,15 @@ $sS5fIertyyywddw_D ---> @escaping @differentiable(reverse) @convention(thin) (@u $syQo ---> $syQo $s0059xxxxxxxxxxxxxxx_ttttttttBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBee -> $s0059xxxxxxxxxxxxxxx_ttttttttBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBee $sx1td_t ---> (t: A...) -$s7example1fyyYF -> example.f() async -> () -$s7example1fyyYKF -> example.f() async throws -> () -s7example1fyyjfYKF -> example.f@differentiable(_forward) () async throws -> () -s7example1fyyjrYKF -> example.f@differentiable(reverse) () async throws -> () -s7example1fyyjdYKF -> example.f@differentiable () async throws -> () -s7example1fyyjlYKF -> example.f@differentiable(_linear) () async throws -> () +$s7example1fyyYaF -> example.f() async -> () +$s7example1fyyYaKF -> example.f() async throws -> () +s7example1fyyYjfYaKF -> example.f@differentiable(_forward) () async throws -> () +s7example1fyyYjrYaKF -> example.f@differentiable(reverse) () async throws -> () +s7example1fyyYjdYaKF -> example.f@differentiable () async throws -> () +s7example1fyyYjlYaKF -> example.f@differentiable(_linear) () async throws -> () $s4main20receiveInstantiationyySo34__CxxTemplateInst12MagicWrapperIiEVzF ---> main.receiveInstantiation(inout __C.__CxxTemplateInst12MagicWrapperIiE) -> () $s4main19returnInstantiationSo34__CxxTemplateInst12MagicWrapperIiEVyF ---> main.returnInstantiation() -> __C.__CxxTemplateInst12MagicWrapperIiE -$s4main6testityyYFTu ---> async function pointer to main.testit() async -> () +$s4main6testityyYaFTu ---> async function pointer to main.testit() async -> () $s13test_mangling3fooyS2f_S2ftFTJfUSSpSr ---> forward-mode derivative of test_mangling.foo(Swift.Float, Swift.Float, Swift.Float) -> Swift.Float with respect to parameters {1, 2} and results {0} $s13test_mangling4foo21xq_x_t16_Differentiation14DifferentiableR_AA1P13TangentVectorRp_r0_lFAdERzAdER_AafGRpzAafHRQr0_lTJrSpSr ---> reverse-mode derivative of test_mangling.foo2(x: A) -> B with respect to parameters {0} and results {0} with $s13test_mangling4foo21xq_x_t16_Differentiation14DifferentiableR_AA1P13TangentVectorRp_r0_lFAdERzAdER_AafGRpzAafHRQr0_lTJVrSpSr ---> vtable thunk for reverse-mode derivative of test_mangling.foo2(x: A) -> B with respect to parameters {0} and results {0} with @@ -392,10 +392,14 @@ $s39differentiation_subset_parameters_thunk19inoutIndirectCalleryq_x_q_q0_t16_Di $sS2f8mangling3FooV13TangentVectorVIegydd_SfAESfIegydd_TJOp ---> autodiff self-reordering reabstraction thunk for pullback from @escaping @callee_guaranteed (@unowned Swift.Float) -> (@unowned Swift.Float, @unowned mangling.Foo.TangentVector) to @escaping @callee_guaranteed (@unowned Swift.Float) -> (@unowned mangling.Foo.TangentVector, @unowned Swift.Float) $s13test_mangling3fooyS2f_S2ftFWJrSpSr ---> reverse-mode differentiability witness for test_mangling.foo(Swift.Float, Swift.Float, Swift.Float) -> Swift.Float with respect to parameters {0} and results {0} $s13test_mangling3fooyS2f_xq_t16_Differentiation14DifferentiableR_r0_lFAcDRzAcDR_r0_lWJrUSSpSr ---> reverse-mode differentiability witness for test_mangling.foo(Swift.Float, A, B) -> Swift.Float with respect to parameters {1, 2} and results {0} with -$s5async1hyyS2iJXEF ---> async.h(@Sendable (Swift.Int) -> Swift.Int) -> () -$s5Actor02MyA0C17testAsyncFunctionyyYKFTY0_ ---> (1) suspend resume partial function for Actor.MyActor.testAsyncFunction() async throws -> () -$s5Actor02MyA0C17testAsyncFunctionyyYKFTQ1_ ---> (2) await resume partial function for Actor.MyActor.testAsyncFunction() async throws -> () -$s4diff1hyyS2ijfXEF ---> diff.h(@differentiable(_forward) (Swift.Int) -> Swift.Int) -> () -$s4diff1hyyS2ijrXEF ---> diff.h(@differentiable(reverse) (Swift.Int) -> Swift.Int) -> () -$s4diff1hyyS2ijdXEF ---> diff.h(@differentiable (Swift.Int) -> Swift.Int) -> () -$s4diff1hyyS2ijlXEF ---> diff.h(@differentiable(_linear) (Swift.Int) -> Swift.Int) -> () +$s5async1hyyS2iYbXEF ---> async.h(@Sendable (Swift.Int) -> Swift.Int) -> () +$s5Actor02MyA0C17testAsyncFunctionyyYaKFTY0_ ---> (1) suspend resume partial function for Actor.MyActor.testAsyncFunction() async throws -> () +$s5Actor02MyA0C17testAsyncFunctionyyYaKFTQ1_ ---> (2) await resume partial function for Actor.MyActor.testAsyncFunction() async throws -> () +$s4diff1hyyS2iYjfXEF ---> diff.h(@differentiable(_forward) (Swift.Int) -> Swift.Int) -> () +$s4diff1hyyS2iYjrXEF ---> diff.h(@differentiable(reverse) (Swift.Int) -> Swift.Int) -> () +$s4diff1hyyS2iYjdXEF ---> diff.h(@differentiable (Swift.Int) -> Swift.Int) -> () +$s4diff1hyyS2iYjlXEF ---> diff.h(@differentiable(_linear) (Swift.Int) -> Swift.Int) -> () +$s4test3fooyyS2f_SfYkztYjrXEF ---> test.foo(@differentiable(reverse) (Swift.Float, inout @noDerivative Swift.Float) -> Swift.Float) -> () +$s4test3fooyyS2f_SfYkntYjrXEF ---> test.foo(@differentiable(reverse) (Swift.Float, __owned @noDerivative Swift.Float) -> Swift.Float) -> () +$s4test3fooyyS2f_SfYktYjrXEF ---> test.foo(@differentiable(reverse) (Swift.Float, @noDerivative Swift.Float) -> Swift.Float) -> () +$s4test3fooyyS2f_SfYktYaYbYjrXEF ---> test.foo(@differentiable(reverse) @Sendable (Swift.Float, @noDerivative Swift.Float) async -> Swift.Float) -> () diff --git a/test/Generics/protocol_superclass_cycle.swift b/test/Generics/protocol_superclass_cycle.swift new file mode 100644 index 0000000000000..529e898ba6a8a --- /dev/null +++ b/test/Generics/protocol_superclass_cycle.swift @@ -0,0 +1,8 @@ +// RUN: %target-typecheck-verify-swift +// RUN: %target-swift-frontend -typecheck -debug-generic-signatures %s 2>&1 | %FileCheck %s + +protocol P : C {} +final class C : P {} + +// CHECK: Generic signature: +func foo(_: T) {} diff --git a/test/Generics/rdar75656022.swift b/test/Generics/rdar75656022.swift index 2ab7f148b39b5..88160472487d3 100644 --- a/test/Generics/rdar75656022.swift +++ b/test/Generics/rdar75656022.swift @@ -49,7 +49,8 @@ struct OriginalExampleWithWarning where A : P2, B : P2, A.T == B.T { where C : P1, D : P1, // expected-warning {{redundant conformance constraint 'D' : 'P1'}} C.T : P1, // expected-warning {{redundant conformance constraint 'C.T' : 'P1'}} - A == S1>, + A == S1>, // expected-note {{conformance constraint 'D' : 'P1' implied here}} + // expected-note@-1 {{conformance constraint 'C.T' : 'P1' implied here}} C.T == D, E == D.T { } } @@ -71,6 +72,7 @@ struct WithoutBogusGenericParametersWithWarning where A : P2, B : P2, A.T where C : P1, C.T : P1, // expected-warning {{redundant conformance constraint 'C.T' : 'P1'}} A == S1> {} + // expected-note@-1 {{conformance constraint 'C.T' : 'P1' implied here}} } // Same as above but without unnecessary generic parameters diff --git a/test/IDE/complete_call_arg.swift b/test/IDE/complete_call_arg.swift index bf7e06aebc871..d2814dd3fcd91 100644 --- a/test/IDE/complete_call_arg.swift +++ b/test/IDE/complete_call_arg.swift @@ -1,12 +1,6 @@ // RUN: %empty-directory(%t) // RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_PARAM_WITH_INTERNAL_NAME | %FileCheck %s -check-prefix=CLOSURE_PARAM_WITH_INTERNAL_NAME -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_PARAM_WITH_PARENS | %FileCheck %s -check-prefix=CLOSURE_PARAM_WITH_PARENS -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONAL_CLOSURE_PARAM | %FileCheck %s -check-prefix=OPTIONAL_CLOSURE_PARAM -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ESCAPING_OPTIONAL_CLOSURE_PARAM | %FileCheck %s -check-prefix=ESCAPING_OPTIONAL_CLOSURE_PARAM -// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_CLOSURE_PARAM_WITHOUT_INTERNAL_NAMES | %FileCheck %s -check-prefix=COMPLETE_CLOSURE_PARAM_WITHOUT_INTERNAL_NAMES - var i1 = 1 var i2 = 2 var oi1 : Int? diff --git a/test/IRGen/async.swift b/test/IRGen/async.swift index 9820be15eb515..defb28677b10a 100644 --- a/test/IRGen/async.swift +++ b/test/IRGen/async.swift @@ -2,13 +2,13 @@ // REQUIRES: concurrency -// CHECK: "$s5async1fyyYF" +// CHECK: "$s5async1fyyYaF" public func f() async { } -// CHECK: "$s5async1gyyYKF" +// CHECK: "$s5async1gyyYaKF" public func g() async throws { } -// CHECK: "$s5async1hyyS2iJXEF" +// CHECK: "$s5async1hyyS2iYbXEF" public func h(_: @Sendable (Int) -> Int) { } public class SomeClass {} @@ -16,7 +16,7 @@ public class SomeClass {} @_silgen_name("swift_task_future_wait") public func task_future_wait(_ task: __owned SomeClass) async throws -> Int -// CHECK: define{{.*}} swift{{(tail)?}}cc void @"$s5async8testThisyyAA9SomeClassCnYF"(%swift.context* swiftasync %0{{.*}} +// CHECK: define{{.*}} swift{{(tail)?}}cc void @"$s5async8testThisyyAA9SomeClassCnYaF"(%swift.context* swiftasync %0{{.*}} // CHECK-64: call swiftcc i8* @swift_task_alloc(i64 48) // CHECK: {{(must)?}}tail call swift{{(tail)?}}cc void @swift_task_future_wait( public func testThis(_ task: __owned SomeClass) async { diff --git a/test/IRGen/async/Inputs/class_open-1instance-void_to_void.swift b/test/IRGen/async/Inputs/class_open-1instance-void_to_void.swift index 19529d79cef65..b740afa298845 100644 --- a/test/IRGen/async/Inputs/class_open-1instance-void_to_void.swift +++ b/test/IRGen/async/Inputs/class_open-1instance-void_to_void.swift @@ -3,11 +3,11 @@ import _Concurrency func printGeneric(_ t: T) { print(t) } -// CHECK-LL: @"$s4main6call_fyyAA1CCYFTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer -// CHECK-LL: @"$s4main1CC1fyyYFTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer +// CHECK-LL: @"$s4main6call_fyyAA1CCYaFTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer +// CHECK-LL: @"$s4main1CC1fyyYaFTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer -// CHECK-LL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s4main6call_fyyAA1CCYF"( -// CHECK-LL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s4main1CC1fyyYF"( +// CHECK-LL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s4main6call_fyyAA1CCYaF"( +// CHECK-LL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s4main1CC1fyyYaF"( public func call_f(_ c: C) async { print("entering call_f") await c.f() diff --git a/test/IRGen/async/class_resilience.swift b/test/IRGen/async/class_resilience.swift index 08a69f9873569..8cf4d668400ff 100644 --- a/test/IRGen/async/class_resilience.swift +++ b/test/IRGen/async/class_resilience.swift @@ -33,22 +33,22 @@ open class MyBaseClass { } } -// CHECK-LABEL: @"$s16class_resilience11MyBaseClassC4waitxyYFTjTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer +// CHECK-LABEL: @"$s16class_resilience11MyBaseClassC4waitxyYaFTjTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer // CHECK-LABEL: @"$s16class_resilience11MyBaseClassCMn" = {{(dllexport )?}}{{(protected )?}}constant -// CHECK-SAME: %swift.async_func_pointer* @"$s16class_resilience11MyBaseClassC4waitxyYFTu" +// CHECK-SAME: %swift.async_func_pointer* @"$s16class_resilience11MyBaseClassC4waitxyYaFTu" // CHECK-LABEL: @"$s16class_resilience9MyDerivedCMn" = hidden constant -// CHECK-SAME: %swift.async_func_pointer* @"$s16class_resilience9MyDerivedC4waitSiyYF010resilient_A09BaseClassCADxyYFTVTu" +// CHECK-SAME: %swift.async_func_pointer* @"$s16class_resilience9MyDerivedC4waitSiyYaF010resilient_A09BaseClassCADxyYaFTVTu" -// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s16class_resilience14callsAwaitableyx010resilient_A09BaseClassCyxGYlF"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1{{.*}}) -// CHECK: %swift.async_func_pointer* @"$s15resilient_class9BaseClassC4waitxyYFTjTu" +// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s16class_resilience14callsAwaitableyx010resilient_A09BaseClassCyxGYalF"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1{{.*}}) +// CHECK: %swift.async_func_pointer* @"$s15resilient_class9BaseClassC4waitxyYaFTjTu" // CHECK: ret void public func callsAwaitable(_ c: BaseClass) async -> T { return await c.wait() } -// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s16class_resilience11MyBaseClassC4waitxyYFTj"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1, %T16class_resilience11MyBaseClassC* swiftself %2) {{#([0-9]+)}} { +// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s16class_resilience11MyBaseClassC4waitxyYaFTj"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1, %T16class_resilience11MyBaseClassC* swiftself %2) {{#([0-9]+)}} { class MyDerived : BaseClass { override func wait() async -> Int { diff --git a/test/IRGen/async/debug.swift b/test/IRGen/async/debug.swift index b5487fc2b7a52..41be572af3dd4 100644 --- a/test/IRGen/async/debug.swift +++ b/test/IRGen/async/debug.swift @@ -2,7 +2,7 @@ // REQUIRES: concurrency // Don't assert on dynamically sized variables. -// CHECK: define{{( dllexport)?}}{{( protected)?}} swift{{(tail)?}}cc void @"$s5debug1fyxxYKlF" +// CHECK: define{{( dllexport)?}}{{( protected)?}} swift{{(tail)?}}cc void @"$s5debug1fyxxYaKlF" public func f(_ value: Success) async throws -> Success { switch Result.success(value) { diff --git a/test/IRGen/async/protocol_resilience.swift b/test/IRGen/async/protocol_resilience.swift index e811d93d693b1..c0e51b49e18e8 100644 --- a/test/IRGen/async/protocol_resilience.swift +++ b/test/IRGen/async/protocol_resilience.swift @@ -21,19 +21,19 @@ public protocol MyAwaitable { // func waitGenericThrows(_: T) async throws -> Result } -// CHECK-LABEL: @"$s19protocol_resilience11MyAwaitableP4wait6ResultQzyYFTjTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer +// CHECK-LABEL: @"$s19protocol_resilience11MyAwaitableP4wait6ResultQzyYaFTjTu" = {{(dllexport )?}}{{(protected )?}}global %swift.async_func_pointer // CHECK-LABEL: @"$s19protocol_resilience19ConformsToAwaitableVyxG010resilient_A00E0AAMc" = hidden constant -// CHECK-SAME: %swift.async_func_pointer* @"$s19protocol_resilience19ConformsToAwaitableVyxG010resilient_A00E0AaeFP4wait6ResultQzyYFTWTu" +// CHECK-SAME: %swift.async_func_pointer* @"$s19protocol_resilience19ConformsToAwaitableVyxG010resilient_A00E0AaeFP4wait6ResultQzyYaFTWTu" -// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s19protocol_resilience14callsAwaitabley6ResultQzxY010resilient_A00D0RzlF"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1, %swift.opaque* noalias nocapture %2, %swift.type* %T, i8** %T.Awaitable) -// CHECK: %swift.async_func_pointer* @"$s18resilient_protocol9AwaitableP4wait6ResultQzyYFTjTu" +// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s19protocol_resilience14callsAwaitabley6ResultQzxYa010resilient_A00D0RzlF"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1, %swift.opaque* noalias nocapture %2, %swift.type* %T, i8** %T.Awaitable) +// CHECK: %swift.async_func_pointer* @"$s18resilient_protocol9AwaitableP4wait6ResultQzyYaFTjTu" // CHECK: ret void public func callsAwaitable(_ t: T) async -> T.Result { return await t.wait() } -// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s19protocol_resilience11MyAwaitableP4wait6ResultQzyYFTj"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1, %swift.opaque* noalias nocapture swiftself %2, %swift.type* %3, i8** %4) +// CHECK-LABEL: define {{(dllexport )?}}{{(protected )?}}swift{{(tail)?}}cc void @"$s19protocol_resilience11MyAwaitableP4wait6ResultQzyYaFTj"(%swift.opaque* noalias nocapture %0, %swift.context* swiftasync %1, %swift.opaque* noalias nocapture swiftself %2, %swift.type* %3, i8** %4) struct ConformsToAwaitable : Awaitable { var value: T diff --git a/test/IRGen/async/run-call-class-witnessmethod-void-to-void.swift b/test/IRGen/async/run-call-class-witnessmethod-void-to-void.swift index 7a6b311f22411..b5337cf8dbb3d 100644 --- a/test/IRGen/async/run-call-class-witnessmethod-void-to-void.swift +++ b/test/IRGen/async/run-call-class-witnessmethod-void-to-void.swift @@ -26,12 +26,12 @@ protocol P { // CHECK: exiting f // CHECK: exiting call_f -// CHECK-LL: @"$s4main1PPAAE1fyyYFTu" = hidden global %swift.async_func_pointer -// CHECK-LL: @"$s4main6call_fyyxYAA1PRzlFTu" = hidden global %swift.async_func_pointer -// CHECK-LL: @"$s4main1XCAA1PA2aDP1fyyYFTWTu" = internal global %swift.async_func_pointer +// CHECK-LL: @"$s4main1PPAAE1fyyYaFTu" = hidden global %swift.async_func_pointer +// CHECK-LL: @"$s4main6call_fyyxYaAA1PRzlFTu" = hidden global %swift.async_func_pointer +// CHECK-LL: @"$s4main1XCAA1PA2aDP1fyyYaFTWTu" = internal global %swift.async_func_pointer extension P { - // CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main1PPAAE1fyyYF"( + // CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main1PPAAE1fyyYaF"( func f() async { print("entering f") printGeneric(Self.self) @@ -40,10 +40,10 @@ extension P { } } -// CHECK-LL: define internal swift{{(tail)?}}cc void @"$s4main1XCAA1PA2aDP1fyyYFTW"( +// CHECK-LL: define internal swift{{(tail)?}}cc void @"$s4main1XCAA1PA2aDP1fyyYaFTW"( extension X : P {} -// CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main6call_fyyxYAA1PRzlF"( +// CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main6call_fyyxYaAA1PRzlF"( func call_f(_ t: T) async { print("entering call_f") await t.f() diff --git a/test/IRGen/async/run-call-classinstance-int64-to-void.sil b/test/IRGen/async/run-call-classinstance-int64-to-void.sil index 033feefeb227b..3f2e104e189d4 100644 --- a/test/IRGen/async/run-call-classinstance-int64-to-void.sil +++ b/test/IRGen/async/run-call-classinstance-int64-to-void.sil @@ -102,7 +102,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -117,7 +117,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-classinstance-void-to-void.sil b/test/IRGen/async/run-call-classinstance-void-to-void.sil index 7fa1275ad1711..1339fe47f1025 100644 --- a/test/IRGen/async/run-call-classinstance-void-to-void.sil +++ b/test/IRGen/async/run-call-classinstance-void-to-void.sil @@ -100,7 +100,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -115,7 +115,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-existential-to-void.sil b/test/IRGen/async/run-call-existential-to-void.sil index 075ede460c888..ea01bc12c941a 100644 --- a/test/IRGen/async/run-call-existential-to-void.sil +++ b/test/IRGen/async/run-call-existential-to-void.sil @@ -78,7 +78,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -93,7 +93,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-generic-to-generic.sil b/test/IRGen/async/run-call-generic-to-generic.sil index 1dd31505de199..a4c90ca22b052 100644 --- a/test/IRGen/async/run-call-generic-to-generic.sil +++ b/test/IRGen/async/run-call-generic-to-generic.sil @@ -50,7 +50,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -65,7 +65,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-genericEquatable-x2-to-bool.sil b/test/IRGen/async/run-call-genericEquatable-x2-to-bool.sil index a59b1f1a22b53..4b953681e6f1a 100644 --- a/test/IRGen/async/run-call-genericEquatable-x2-to-bool.sil +++ b/test/IRGen/async/run-call-genericEquatable-x2-to-bool.sil @@ -58,7 +58,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): %void = apply %0() : $@async @callee_guaranteed () -> () @@ -72,7 +72,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-int64-and-int64-to-void.sil b/test/IRGen/async/run-call-int64-and-int64-to-void.sil index ea7f4dccd0cb6..686213b1eaa7c 100644 --- a/test/IRGen/async/run-call-int64-and-int64-to-void.sil +++ b/test/IRGen/async/run-call-int64-and-int64-to-void.sil @@ -43,7 +43,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -58,7 +58,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-int64-to-void.sil b/test/IRGen/async/run-call-int64-to-void.sil index 6bb522a1a3007..4840b66d26f87 100644 --- a/test/IRGen/async/run-call-int64-to-void.sil +++ b/test/IRGen/async/run-call-int64-to-void.sil @@ -40,7 +40,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -55,7 +55,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-protocolextension_instance-void-to-int64.sil b/test/IRGen/async/run-call-protocolextension_instance-void-to-int64.sil index 4376a3ceaf365..b63c1f0bd76f4 100644 --- a/test/IRGen/async/run-call-protocolextension_instance-void-to-int64.sil +++ b/test/IRGen/async/run-call-protocolextension_instance-void-to-int64.sil @@ -79,7 +79,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -94,7 +94,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-protocolwitness_instance-void-to-int64.sil b/test/IRGen/async/run-call-protocolwitness_instance-void-to-int64.sil index 5edb12faa4e66..956247624d25a 100644 --- a/test/IRGen/async/run-call-protocolwitness_instance-void-to-int64.sil +++ b/test/IRGen/async/run-call-protocolwitness_instance-void-to-int64.sil @@ -70,7 +70,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -85,7 +85,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-resilient-classinstance-void-to-void.sil b/test/IRGen/async/run-call-resilient-classinstance-void-to-void.sil index 671d1df31baa6..e46dbd75a24c7 100644 --- a/test/IRGen/async/run-call-resilient-classinstance-void-to-void.sil +++ b/test/IRGen/async/run-call-resilient-classinstance-void-to-void.sil @@ -37,7 +37,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -52,7 +52,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-resilient-protocolinstance-void-to-void.swift b/test/IRGen/async/run-call-resilient-protocolinstance-void-to-void.swift index fc04adb1e99eb..74ff7818b16b1 100644 --- a/test/IRGen/async/run-call-resilient-protocolinstance-void-to-void.swift +++ b/test/IRGen/async/run-call-resilient-protocolinstance-void-to-void.swift @@ -20,7 +20,7 @@ func call(_ t: T) async { await t.protocolinstanceVoidToVoid() } -// CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main4callyyxY17ResilientProtocol8ProtokolRzlF"( +// CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main4callyyxYa17ResilientProtocol8ProtokolRzlF"( func test_case() async { let impl = Impl() await call(impl) // CHECK: Impl() diff --git a/test/IRGen/async/run-call-struct-instance_generic-mutating-generic_1-to-generic_1.swift b/test/IRGen/async/run-call-struct-instance_generic-mutating-generic_1-to-generic_1.swift index 7ca3a5601e1ca..cb79b40f9b12e 100644 --- a/test/IRGen/async/run-call-struct-instance_generic-mutating-generic_1-to-generic_1.swift +++ b/test/IRGen/async/run-call-struct-instance_generic-mutating-generic_1-to-generic_1.swift @@ -12,8 +12,8 @@ import _Concurrency struct G { - // CHECK-LL: @"$s4main1GV19theMutatingFunctionyqd__qd__YlFTu" = hidden global %swift.async_func_pointer - // CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main1GV19theMutatingFunctionyqd__qd__YlF"( + // CHECK-LL: @"$s4main1GV19theMutatingFunctionyqd__qd__YalFTu" = hidden global %swift.async_func_pointer + // CHECK-LL: define hidden swift{{(tail)?}}cc void @"$s4main1GV19theMutatingFunctionyqd__qd__YalF"( mutating func theMutatingFunction(_ u: U) async -> U { return u } diff --git a/test/IRGen/async/run-call-struct_five_bools-to-void.sil b/test/IRGen/async/run-call-struct_five_bools-to-void.sil index b3a87b256a864..fdd666af8bc51 100644 --- a/test/IRGen/async/run-call-struct_five_bools-to-void.sil +++ b/test/IRGen/async/run-call-struct_five_bools-to-void.sil @@ -62,7 +62,7 @@ sil @test_case : $@async @convention(thin) () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -77,7 +77,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-structinstance-int64-to-void.sil b/test/IRGen/async/run-call-structinstance-int64-to-void.sil index 58eb252208dd8..1c5ef68869502 100644 --- a/test/IRGen/async/run-call-structinstance-int64-to-void.sil +++ b/test/IRGen/async/run-call-structinstance-int64-to-void.sil @@ -63,7 +63,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -78,7 +78,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-throws-to-int-throwing.sil b/test/IRGen/async/run-call-void-throws-to-int-throwing.sil index 48f7827e91000..d51edc5a98dc6 100644 --- a/test/IRGen/async/run-call-void-throws-to-int-throwing.sil +++ b/test/IRGen/async/run-call-void-throws-to-int-throwing.sil @@ -124,7 +124,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -139,7 +139,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-nothrow_call-sync-throw.sil b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-nothrow_call-sync-throw.sil index 02108298e7532..d2c486451b387 100644 --- a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-nothrow_call-sync-throw.sil +++ b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-nothrow_call-sync-throw.sil @@ -148,7 +148,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -163,7 +163,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-throw.sil b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-throw.sil index 27a67a001a713..688ddcc6d09d2 100644 --- a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-throw.sil +++ b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-throw.sil @@ -135,7 +135,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -150,7 +150,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-nothrow_call-async-throw.sil b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-nothrow_call-async-throw.sil index e8e19073c67ca..9bc4d30e6449d 100644 --- a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-nothrow_call-async-throw.sil +++ b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-nothrow_call-async-throw.sil @@ -149,7 +149,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -164,7 +164,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-throw.sil b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-throw.sil index 47e9fa0f9b58b..0c03f05b4463a 100644 --- a/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-throw.sil +++ b/test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-throw.sil @@ -135,7 +135,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -150,7 +150,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-to-existential.sil b/test/IRGen/async/run-call-void-to-existential.sil index c5c69a79e1bba..333cc04b583f0 100644 --- a/test/IRGen/async/run-call-void-to-existential.sil +++ b/test/IRGen/async/run-call-void-to-existential.sil @@ -82,7 +82,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -97,7 +97,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-to-int64-and-int64.sil b/test/IRGen/async/run-call-void-to-int64-and-int64.sil index 062c80fdadaed..5e141f681db65 100644 --- a/test/IRGen/async/run-call-void-to-int64-and-int64.sil +++ b/test/IRGen/async/run-call-void-to-int64-and-int64.sil @@ -45,7 +45,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -60,7 +60,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call-void-to-struct_large.sil b/test/IRGen/async/run-call-void-to-struct_large.sil index 0f355ea54c1d7..97ae19facf80f 100644 --- a/test/IRGen/async/run-call-void-to-struct_large.sil +++ b/test/IRGen/async/run-call-void-to-struct_large.sil @@ -133,7 +133,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -148,7 +148,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call_generic-protocolwitness_instance-generic-to-int64-and-generic.sil b/test/IRGen/async/run-call_generic-protocolwitness_instance-generic-to-int64-and-generic.sil index f0610e8f3d380..1b02374170bf5 100644 --- a/test/IRGen/async/run-call_generic-protocolwitness_instance-generic-to-int64-and-generic.sil +++ b/test/IRGen/async/run-call_generic-protocolwitness_instance-generic-to-int64-and-generic.sil @@ -92,7 +92,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -107,7 +107,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-call_generic-protocolwitness_instance-void-to-int64.sil b/test/IRGen/async/run-call_generic-protocolwitness_instance-void-to-int64.sil index 4de435ee79655..2a4334033b983 100644 --- a/test/IRGen/async/run-call_generic-protocolwitness_instance-void-to-int64.sil +++ b/test/IRGen/async/run-call_generic-protocolwitness_instance-void-to-int64.sil @@ -79,7 +79,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -94,7 +94,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-convertfunction-int64-to-void.sil b/test/IRGen/async/run-convertfunction-int64-to-void.sil index fff27702dd7fe..5f50463209830 100644 --- a/test/IRGen/async/run-convertfunction-int64-to-void.sil +++ b/test/IRGen/async/run-convertfunction-int64-to-void.sil @@ -51,7 +51,7 @@ failure(%error : $Error): } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -66,7 +66,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-class-to-void.sil b/test/IRGen/async/run-partialapply-capture-class-to-void.sil index 205749ea40fc2..fd1d145b2972b 100644 --- a/test/IRGen/async/run-partialapply-capture-class-to-void.sil +++ b/test/IRGen/async/run-partialapply-capture-class-to-void.sil @@ -93,7 +93,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -108,7 +108,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-classinstance-to-void.sil b/test/IRGen/async/run-partialapply-capture-classinstance-to-void.sil index b9df72932e95e..f38e4cb52bb91 100644 --- a/test/IRGen/async/run-partialapply-capture-classinstance-to-void.sil +++ b/test/IRGen/async/run-partialapply-capture-classinstance-to-void.sil @@ -87,7 +87,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -102,7 +102,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-classinstance_generic-and-int-to-string.sil b/test/IRGen/async/run-partialapply-capture-classinstance_generic-and-int-to-string.sil index 39d0845c84726..ae7abb9d95e7b 100644 --- a/test/IRGen/async/run-partialapply-capture-classinstance_generic-and-int-to-string.sil +++ b/test/IRGen/async/run-partialapply-capture-classinstance_generic-and-int-to-string.sil @@ -224,7 +224,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -239,7 +239,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-generic_conformer-and-generic-to-void.sil b/test/IRGen/async/run-partialapply-capture-generic_conformer-and-generic-to-void.sil index 6c2dbc397b6ca..5db0e8473f4ed 100644 --- a/test/IRGen/async/run-partialapply-capture-generic_conformer-and-generic-to-void.sil +++ b/test/IRGen/async/run-partialapply-capture-generic_conformer-and-generic-to-void.sil @@ -86,7 +86,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -101,7 +101,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-inout-generic-and-in-generic-to-generic.sil b/test/IRGen/async/run-partialapply-capture-inout-generic-and-in-generic-to-generic.sil index 075871eeae93d..623a645c8aacd 100644 --- a/test/IRGen/async/run-partialapply-capture-inout-generic-and-in-generic-to-generic.sil +++ b/test/IRGen/async/run-partialapply-capture-inout-generic-and-in-generic-to-generic.sil @@ -69,7 +69,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -84,7 +84,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-int64-int64-throws-to-int64.sil b/test/IRGen/async/run-partialapply-capture-int64-int64-throws-to-int64.sil index 25d97bb5f9911..3afaf60782a78 100644 --- a/test/IRGen/async/run-partialapply-capture-int64-int64-throws-to-int64.sil +++ b/test/IRGen/async/run-partialapply-capture-int64-int64-throws-to-int64.sil @@ -80,7 +80,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -95,7 +95,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-int64-int64-to-int64.sil b/test/IRGen/async/run-partialapply-capture-int64-int64-to-int64.sil index 6be47c3915a9c..237358d3e9f14 100644 --- a/test/IRGen/async/run-partialapply-capture-int64-int64-to-int64.sil +++ b/test/IRGen/async/run-partialapply-capture-int64-int64-to-int64.sil @@ -71,7 +71,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -86,7 +86,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-int64-to-generic.sil b/test/IRGen/async/run-partialapply-capture-int64-to-generic.sil index 2755bb72bfdca..83a7f31684bb8 100644 --- a/test/IRGen/async/run-partialapply-capture-int64-to-generic.sil +++ b/test/IRGen/async/run-partialapply-capture-int64-to-generic.sil @@ -62,7 +62,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -77,7 +77,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-struct_classinstance_classinstance-and-int64-to-int64.sil b/test/IRGen/async/run-partialapply-capture-struct_classinstance_classinstance-and-int64-to-int64.sil index 2178aeacb3541..8f68236a90331 100644 --- a/test/IRGen/async/run-partialapply-capture-struct_classinstance_classinstance-and-int64-to-int64.sil +++ b/test/IRGen/async/run-partialapply-capture-struct_classinstance_classinstance-and-int64-to-int64.sil @@ -106,7 +106,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -121,7 +121,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-structgeneric_classinstance_to_struct_and_error.sil b/test/IRGen/async/run-partialapply-capture-structgeneric_classinstance_to_struct_and_error.sil index 15b0f6b3ac73c..bcf4659bc252e 100644 --- a/test/IRGen/async/run-partialapply-capture-structgeneric_classinstance_to_struct_and_error.sil +++ b/test/IRGen/async/run-partialapply-capture-structgeneric_classinstance_to_struct_and_error.sil @@ -100,7 +100,7 @@ bb_finish: } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -115,7 +115,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-structgeneric_polymorphic_constrained-to-void.sil b/test/IRGen/async/run-partialapply-capture-structgeneric_polymorphic_constrained-to-void.sil index 75b6da68c7731..ead7e5910c927 100644 --- a/test/IRGen/async/run-partialapply-capture-structgeneric_polymorphic_constrained-to-void.sil +++ b/test/IRGen/async/run-partialapply-capture-structgeneric_polymorphic_constrained-to-void.sil @@ -68,7 +68,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -83,7 +83,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-type_structgeneric_polymorphic_constrained-to-void.sil b/test/IRGen/async/run-partialapply-capture-type_structgeneric_polymorphic_constrained-to-void.sil index fbca12d6ee6cb..14ee33ad3487d 100644 --- a/test/IRGen/async/run-partialapply-capture-type_structgeneric_polymorphic_constrained-to-void.sil +++ b/test/IRGen/async/run-partialapply-capture-type_structgeneric_polymorphic_constrained-to-void.sil @@ -73,7 +73,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -88,7 +88,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-partialapply-capture-type_thin-and-classinstance-to-void.sil b/test/IRGen/async/run-partialapply-capture-type_thin-and-classinstance-to-void.sil index a4c33f85a3b77..7d117bb853cda 100644 --- a/test/IRGen/async/run-partialapply-capture-type_thin-and-classinstance-to-void.sil +++ b/test/IRGen/async/run-partialapply-capture-type_thin-and-classinstance-to-void.sil @@ -102,7 +102,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -117,7 +117,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/IRGen/async/run-structinstance_generic-void-to-void-constrained.swift b/test/IRGen/async/run-structinstance_generic-void-to-void-constrained.swift index f9727152f6145..cb6d7c0b553ad 100644 --- a/test/IRGen/async/run-structinstance_generic-void-to-void-constrained.swift +++ b/test/IRGen/async/run-structinstance_generic-void-to-void-constrained.swift @@ -15,8 +15,8 @@ protocol Fooable {} extension String: Fooable {} extension Optional where Wrapped: Fooable { - // CHECK-LL: @"$sSq4mainAA7FooableRzlE22theConstrainedFunctionyyYFTu" = hidden global %swift.async_func_pointer - // CHECK-LL: define hidden swift{{(tail)?}}cc void @"$sSq4mainAA7FooableRzlE22theConstrainedFunctionyyYF"( + // CHECK-LL: @"$sSq4mainAA7FooableRzlE22theConstrainedFunctionyyYaFTu" = hidden global %swift.async_func_pointer + // CHECK-LL: define hidden swift{{(tail)?}}cc void @"$sSq4mainAA7FooableRzlE22theConstrainedFunctionyyYaF"( func theConstrainedFunction() async { // CHECK: running Optional.theConstrainedFunction print("running \(Self.self).theConstrainedFunction") diff --git a/test/IRGen/async/run-thintothick-int64-to-void.sil b/test/IRGen/async/run-thintothick-int64-to-void.sil index 2be25ecbf04a7..b6b8fa2bab190 100644 --- a/test/IRGen/async/run-thintothick-int64-to-void.sil +++ b/test/IRGen/async/run-thintothick-int64-to-void.sil @@ -47,7 +47,7 @@ sil @test_case : $@convention(thin) @async () -> () { } // Defined in _Concurrency -sil @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () +sil @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () sil @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error { bb0(%0 :$@async @callee_guaranteed () -> ()): @@ -62,7 +62,7 @@ bb0(%0 : $Int32, %1 : $UnsafeMutablePointer> %thick_test_case = thin_to_thick_function %test_case_nothrow : $@convention(thin) @async () -> () to $@callee_guaranteed @async () -> () %thunk = function_ref @no_throw_to_throw_think : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error %throwing = partial_apply [callee_guaranteed] %thunk(%thick_test_case) : $@convention(thin) @async (@guaranteed @async @callee_guaranteed () -> ()) -> @error Error - %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () + %runAsyncMain = function_ref @$ss13_runAsyncMainyyyyYaKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %result = apply %runAsyncMain(%throwing) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> () %out_literal = integer_literal $Builtin.Int32, 0 %out = struct $Int32 (%out_literal : $Builtin.Int32) diff --git a/test/Runtime/demangleToMetadata.swift b/test/Runtime/demangleToMetadata.swift index 055f92afafdcb..2e02554585eac 100644 --- a/test/Runtime/demangleToMetadata.swift +++ b/test/Runtime/demangleToMetadata.swift @@ -62,7 +62,7 @@ DemangleToMetadataTests.test("function types") { #endif // Async functions - expectEqual(type(of: f0_async), _typeByName("yyYc")!) + expectEqual(type(of: f0_async), _typeByName("yyYac")!) // Throwing functions expectEqual(type(of: f0_throws), _typeByName("yyKc")!) @@ -82,7 +82,7 @@ DemangleToMetadataTests.test("function types") { expectEqual(type(of: f1_owned), _typeByName("yyyXlnc")!) // Concurrent function types. - expectEqual(type(of: f1_takes_concurrent), _typeByName("yyyyJXEc")!) + expectEqual(type(of: f1_takes_concurrent), _typeByName("yyyyYbXEc")!) // Mix-and-match. expectEqual(type(of: f2_variadic_inout), _typeByName("yyytd_ytztc")!) diff --git a/test/SILGen/async_builtins.swift b/test/SILGen/async_builtins.swift index 8ba886c8a9559..42f86efcfc3ac 100644 --- a/test/SILGen/async_builtins.swift +++ b/test/SILGen/async_builtins.swift @@ -4,7 +4,7 @@ import Swift public struct X { - // CHECK-LABEL: sil hidden [ossa] @$s4test1XV14getCurrentTaskBoyYF + // CHECK-LABEL: sil hidden [ossa] @$s4test1XV14getCurrentTaskBoyYaF func getCurrentTask() async -> Builtin.NativeObject { // CHECK: builtin "getCurrentAsyncTask"() : $Builtin.NativeObject return Builtin.getCurrentAsyncTask() @@ -37,12 +37,12 @@ public struct X { } } -// CHECK-LABEL: sil [ossa] @$s4test26usesWithUnsafeContinuationyyYF : $@convention(thin) @async () -> () { +// CHECK-LABEL: sil [ossa] @$s4test26usesWithUnsafeContinuationyyYaF : $@convention(thin) @async () -> () { public func usesWithUnsafeContinuation() async { // trivial resume type let _: Int = await Builtin.withUnsafeContinuation { c in } - // CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYFyBcXEfU_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () + // CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYaFyBcXEfU_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () // CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> () // CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]] // CHECK: [[BOX:%.*]] = alloc_stack $Int @@ -57,7 +57,7 @@ public func usesWithUnsafeContinuation() async { // loadable resume type let _: String = await Builtin.withUnsafeContinuation { c in } - // CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYFyBcXEfU0_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () + // CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYaFyBcXEfU0_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () // CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> () // CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]] // CHECK: [[BOX:%.*]] = alloc_stack $String @@ -73,7 +73,7 @@ public func usesWithUnsafeContinuation() async { // address-only resume type let _: Any = await Builtin.withUnsafeContinuation { c in } - // CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYFyBcXEfU1_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () + // CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYaFyBcXEfU1_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () // CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> () // CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]] // CHECK: [[BOX:%.*]] = alloc_stack $Any @@ -89,11 +89,11 @@ public func usesWithUnsafeContinuation() async { // CHECK: dealloc_stack [[BOX]] } -// CHECK-LABEL: sil [ossa] @$s4test34usesWithUnsafeThrowingContinuationyyYKF : $@convention(thin) @async () -> @error Error { +// CHECK-LABEL: sil [ossa] @$s4test34usesWithUnsafeThrowingContinuationyyYaKF : $@convention(thin) @async () -> @error Error { public func usesWithUnsafeThrowingContinuation() async throws { let _: Int = try await Builtin.withUnsafeThrowingContinuation { c in } - // CHECK: [[FN:%.*]] = function_ref @$s4test34usesWithUnsafeThrowingContinuationyyYKFyBcXEfU_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () + // CHECK: [[FN:%.*]] = function_ref @$s4test34usesWithUnsafeThrowingContinuationyyYaKFyBcXEfU_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () // CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> () // CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]] // CHECK: [[BOX:%.*]] = alloc_stack $Int diff --git a/test/SILGen/async_conversion.swift b/test/SILGen/async_conversion.swift index ecd98fdf44dfb..8684c3af1ae0e 100644 --- a/test/SILGen/async_conversion.swift +++ b/test/SILGen/async_conversion.swift @@ -17,7 +17,7 @@ protocol P { } struct X: P { - // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s4test1XVAA1PA2aDP1fySSSgSi_SStYFTW : $@convention(witness_method: P) @async (Int, @guaranteed String, @in_guaranteed X) -> @owned Optional + // CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s4test1XVAA1PA2aDP1fySSSgSi_SStYaFTW : $@convention(witness_method: P) @async (Int, @guaranteed String, @in_guaranteed X) -> @owned Optional // CHECK: function_ref @$s4test1XV1fySSSgSi_SStF : $@convention(method) (Int, @guaranteed String, X) -> @owned Optional func f(_: Int, _: String) -> String? { nil } } diff --git a/test/SILGen/async_handler.swift b/test/SILGen/async_handler.swift index c8d687b56e6e1..2545a863a68b4 100644 --- a/test/SILGen/async_handler.swift +++ b/test/SILGen/async_handler.swift @@ -6,9 +6,9 @@ func take(_ t: T) async { } // CHECK-LABEL: sil [ossa] @$s4test13simpleHandleryySiF : $@convention(thin) (Int) -> () { -// CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test13simpleHandleryySiYF : $@convention(thin) @async (Int) -> () +// CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test13simpleHandleryySiYaF : $@convention(thin) @async (Int) -> () // CHECK: [[FN:%[0-9]+]] = partial_apply [callee_guaranteed] [[BODYFN]](%0) : $@convention(thin) @async (Int) -> () -// CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYc_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () +// CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYac_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: {{.*}} = apply [[INTRINSIC]]([[FN]]) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: destroy_value [[FN]] : $@async @callee_guaranteed () -> () // CHECK: } // end sil function '$s4test13simpleHandleryySiF' @@ -19,9 +19,9 @@ public func simpleHandler(_ i: Int) { // CHECK-LABEL: sil [ossa] @$s4test20nonTrivialArgHandleryySSF : $@convention(thin) (@guaranteed String) -> () { // CHECK: [[COPY:%[0-9]+]] = copy_value %0 : $String -// CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test20nonTrivialArgHandleryySSYF : $@convention(thin) @async (@guaranteed String) -> () +// CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test20nonTrivialArgHandleryySSYaF : $@convention(thin) @async (@guaranteed String) -> () // CHECK: [[FN:%[0-9]+]] = partial_apply [callee_guaranteed] [[BODYFN]]([[COPY]]) : $@convention(thin) @async (@guaranteed String) -> () -// CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYc_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () +// CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYac_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: {{.*}} = apply [[INTRINSIC]]([[FN]]) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: destroy_value [[FN]] : $@async @callee_guaranteed () -> () // CHECK: } // end sil function '$s4test20nonTrivialArgHandleryySSF' @@ -33,9 +33,9 @@ public func nonTrivialArgHandler(_ s: String) { // CHECK-LABEL: sil [ossa] @$s4test14genericHandleryyxlF : $@convention(thin) (@in_guaranteed T) -> () { // CHECK: [[TMP:%[0-9]+]] = alloc_stack $T // CHECK: copy_addr %0 to [initialization] [[TMP]] : $*T -// CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test14genericHandleryyxYlF : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> () +// CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test14genericHandleryyxYalF : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> () // CHECK: [[FN:%[0-9]+]] = partial_apply [callee_guaranteed] [[BODYFN]]([[TMP]]) : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> () -// CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYc_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () +// CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYac_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: {{.*}} = apply [[INTRINSIC]]([[FN]]) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: destroy_value [[FN]] : $@async @callee_guaranteed () -> () // CHECK: } // end sil function '$s4test14genericHandleryyxlF' @@ -46,9 +46,9 @@ public func genericHandler(_ t: T) { public struct Mystruct { // CHECK-LABEL: sil [ossa] @$s4test8MystructV13memberHandleryySiF : $@convention(method) (Int, Mystruct) -> () { - // CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test8MystructV13memberHandleryySiYF : $@convention(method) @async (Int, Mystruct) -> () + // CHECK: [[BODYFN:%[0-9]+]] = function_ref @$s4test8MystructV13memberHandleryySiYaF : $@convention(method) @async (Int, Mystruct) -> () // CHECK: [[FN:%[0-9]+]] = partial_apply [callee_guaranteed] [[BODYFN]](%0, %1) : $@convention(method) @async (Int, Mystruct) -> () - // CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYc_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () + // CHECK: [[INTRINSIC:%[0-9]+]] = function_ref @$ss16_runAsyncHandler9operationyyyYac_tF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: {{.*}} = apply [[INTRINSIC]]([[FN]]) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> () // CHECK: destroy_value [[FN]] : $@async @callee_guaranteed () -> () // CHECK: } // end sil function '$s4test8MystructV13memberHandleryySiF' diff --git a/test/SILGen/async_let.swift b/test/SILGen/async_let.swift index d50d85bde29d1..eb0e8243f5403 100644 --- a/test/SILGen/async_let.swift +++ b/test/SILGen/async_let.swift @@ -13,15 +13,15 @@ enum SomeError: Error { case boom } -// CHECK-LABEL: sil hidden [ossa] @$s4test0A11AsyncLetIntSiyYF : $@convention(thin) @async () -> Int +// CHECK-LABEL: sil hidden [ossa] @$s4test0A11AsyncLetIntSiyYaF : $@convention(thin) @async () -> Int func testAsyncLetInt() async -> Int { // CHECK: [[I:%.*]] = mark_uninitialized [var] %0 - // CHECK: [[CLOSURE:%.*]] = function_ref @$s4test0A11AsyncLetIntSiyYFSiyYJcfu_ : $@convention(thin) @Sendable @async () -> Int + // CHECK: [[CLOSURE:%.*]] = function_ref @$s4test0A11AsyncLetIntSiyYaFSiyYaYbcfu_ : $@convention(thin) @Sendable @async () -> Int // CHECK: [[THICK_CLOSURE:%.*]] = thin_to_thick_function [[CLOSURE]] : $@convention(thin) @Sendable @async () -> Int to $@Sendable @async @callee_guaranteed () -> Int // CHECK: [[REABSTRACT_THUNK:%.*]] = function_ref @$sSiIeghHd_Sis5Error_pIeghHrzo_TR : $@convention(thin) @Sendable @async (@guaranteed @Sendable @async @callee_guaranteed () -> Int) -> (@out Int, @error Error) // CHECK: [[REABSTRACT_CLOSURE:%.*]] = partial_apply [callee_guaranteed] [[REABSTRACT_THUNK]]([[THICK_CLOSURE]]) : $@convention(thin) @Sendable @async (@guaranteed @Sendable @async @callee_guaranteed () -> Int) -> (@out Int, @error Error) // CHECK: [[CLOSURE_ARG:%.*]] = convert_function [[REABSTRACT_CLOSURE]] : $@Sendable @async @callee_guaranteed () -> (@out Int, @error Error) to $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error Error) for - // CHECK: [[RUN_CHILD_TASK:%.*]] = function_ref @$ss13_runChildTask9operationBoxyYJKc_tYlF : $@convention(thin) @async <τ_0_0> (@guaranteed @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error Error) for <τ_0_0>) -> @owned Builtin.NativeObject + // CHECK: [[RUN_CHILD_TASK:%.*]] = function_ref @$ss13_runChildTask9operationBoxyYaYbKc_tYalF : $@convention(thin) @async <τ_0_0> (@guaranteed @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error Error) for <τ_0_0>) -> @owned Builtin.NativeObject // CHECK: [[CHILD_TASK:%.*]] = apply [[RUN_CHILD_TASK]]([[CLOSURE_ARG]]) : $@convention(thin) @async <τ_0_0> (@guaranteed @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error Error) for <τ_0_0>) -> @owned Builtin.NativeObject async let i = await getInt() @@ -50,7 +50,7 @@ func testAsyncLetWithThrows(cond: Bool) async throws -> String { return await s } -// CHECK-LABEL: sil hidden [ossa] @$s4test0A14AsyncLetThrowsSSyYKF : $@convention(thin) @async () -> (@owned String, @error Error) { +// CHECK-LABEL: sil hidden [ossa] @$s4test0A14AsyncLetThrowsSSyYaKF : $@convention(thin) @async () -> (@owned String, @error Error) { func testAsyncLetThrows() async throws -> String { async let s = try await getStringThrowingly() @@ -59,7 +59,7 @@ func testAsyncLetThrows() async throws -> String { return try await s } -// CHECK-LABEL: sil hidden [ossa] @$s4test0A14DecomposeAwait4condSiSb_tYF : $@convention(thin) @async (Bool) -> Int { +// CHECK-LABEL: sil hidden [ossa] @$s4test0A14DecomposeAwait4condSiSb_tYaF : $@convention(thin) @async (Bool) -> Int { func testDecomposeAwait(cond: Bool) async -> Int { // CHECK: [[I_VAR:%.*]] = alloc_stack $Int, let, name "i" // CHECK: [[I:%.*]] = mark_uninitialized [var] [[I_VAR]] : $*Int diff --git a/test/SILGen/async_vtable_thunk.swift b/test/SILGen/async_vtable_thunk.swift index 12d6c06b03b43..014efc254776f 100644 --- a/test/SILGen/async_vtable_thunk.swift +++ b/test/SILGen/async_vtable_thunk.swift @@ -9,5 +9,5 @@ class Derived : BaseClass { override func wait() async -> Int {} } -// CHECK-LABEL: sil private [thunk] [ossa] @$s18async_vtable_thunk7DerivedC4waitSiyYFAA9BaseClassCADxyYFTV : $@convention(method) @async (@guaranteed Derived) -> @out Int { +// CHECK-LABEL: sil private [thunk] [ossa] @$s18async_vtable_thunk7DerivedC4waitSiyYaFAA9BaseClassCADxyYaFTV : $@convention(method) @async (@guaranteed Derived) -> @out Int { diff --git a/test/SILGen/concurrent_functions.swift b/test/SILGen/concurrent_functions.swift index 6cc631da68077..8066a1e18b664 100644 --- a/test/SILGen/concurrent_functions.swift +++ b/test/SILGen/concurrent_functions.swift @@ -6,13 +6,13 @@ func acceptsConcurrent(_: @escaping @Sendable () -> Int) { } func concurrentWithCaptures(i: Int) -> Int { var i = i - // CHECK: sil private [ossa] @$s4test22concurrentWithCaptures1iS2i_tFSiyJcfU_ : $@convention(thin) @Sendable (@guaranteed { var Int }) -> Int + // CHECK: sil private [ossa] @$s4test22concurrentWithCaptures1iS2i_tFSiyYbcfU_ : $@convention(thin) @Sendable (@guaranteed { var Int }) -> Int acceptsConcurrent { i + 1 } i = i + 1 - // CHECK: sil private [ossa] @$s4test22concurrentWithCaptures1iS2i_tF13localFunctionL_SiyJF : $@convention(thin) @Sendable (@guaranteed { var Int }) -> Int + // CHECK: sil private [ossa] @$s4test22concurrentWithCaptures1iS2i_tF13localFunctionL_SiyYbF : $@convention(thin) @Sendable (@guaranteed { var Int }) -> Int @Sendable func localFunction() -> Int { return i + 1 } diff --git a/test/SILGen/concurrent_prologue.swift b/test/SILGen/concurrent_prologue.swift index abb50a0508d5a..a3d8488b865fb 100644 --- a/test/SILGen/concurrent_prologue.swift +++ b/test/SILGen/concurrent_prologue.swift @@ -5,13 +5,13 @@ // locations. @MainActor func f() async -> Int { -// CHECK: {{^sil .*}}@$s1a1fSiyYF +// CHECK: {{^sil .*}}@$s1a1fSiyYaF // CHECK: %0 = metatype {{.*}}loc "{{.*}}.swift":[[@LINE-2]]:17,{{.*}}:auto_gen // CHECK: %1 = function_ref {{.*}}loc "{{.*}}.swift":[[@LINE-3]]:17,{{.*}}:auto_gen // CHECK: %2 = apply %1(%0) {{.*}}loc "{{.*}}.swift":[[@LINE-4]]:17,{{.*}}:auto_gen // CHECK: begin_borrow {{.*}}loc "{{.*}}.swift":[[@LINE-5]]:17,{{.*}}:auto_gen // CHECK: hop_to_executor {{.*}}loc "{{.*}}.swift":[[@LINE-6]]:17,{{.*}}:auto_gen -// CHECK: // end sil function '$s1a1fSiyYF' +// CHECK: // end sil function '$s1a1fSiyYaF' return 23 } @main struct Main { diff --git a/test/SILGen/effectful_properties.swift b/test/SILGen/effectful_properties.swift index f3f5e7767c6f9..576cb9ff53e42 100644 --- a/test/SILGen/effectful_properties.swift +++ b/test/SILGen/effectful_properties.swift @@ -50,19 +50,19 @@ actor A { } -// CHECK-LABEL: sil hidden [ossa] @$s9accessors19testImplicitlyAsync1aSiAA1AC_tYF : $@convention(thin) @async (@guaranteed A) -> Int { +// CHECK-LABEL: sil hidden [ossa] @$s9accessors19testImplicitlyAsync1aSiAA1AC_tYaF : $@convention(thin) @async (@guaranteed A) -> Int { // CHECK: hop_to_executor // CHECK: apply {{%[0-9]+}}({{%[0-9]+}}) : $@convention(method) (@guaranteed A) -> Int // CHECK: hop_to_executor -// CHECK: } // end sil function '$s9accessors19testImplicitlyAsync1aSiAA1AC_tYF' +// CHECK: } // end sil function '$s9accessors19testImplicitlyAsync1aSiAA1AC_tYaF' func testImplicitlyAsync(a : A) async -> Int { return await a.computedProp } -// CHECK-LABEL: sil hidden [ossa] @$s9accessors15testNormalAsync1aSiAA1AC_tYF : $@convention(thin) @async (@guaranteed A) -> Int { +// CHECK-LABEL: sil hidden [ossa] @$s9accessors15testNormalAsync1aSiAA1AC_tYaF : $@convention(thin) @async (@guaranteed A) -> Int { // CHECK: apply {{%[0-9]+}}({{%[0-9]+}}) : $@convention(method) @async (@guaranteed A) -> Int -// CHECK: } // end sil function '$s9accessors15testNormalAsync1aSiAA1AC_tYF' +// CHECK: } // end sil function '$s9accessors15testNormalAsync1aSiAA1AC_tYaF' func testNormalAsync(a : A) async -> Int { return await a.asyncProp -} \ No newline at end of file +} diff --git a/test/SILGen/foreach_async.swift b/test/SILGen/foreach_async.swift index b10b1dc481631..715d34fffcc5b 100644 --- a/test/SILGen/foreach_async.swift +++ b/test/SILGen/foreach_async.swift @@ -71,7 +71,7 @@ struct AsyncLazySequence: AsyncSequence { // Trivial Struct //===----------------------------------------------------------------------===// -// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async13trivialStructyyAA17AsyncLazySequenceVySaySiGGYF : $@convention(thin) @async (@guaranteed AsyncLazySequence>) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async13trivialStructyyAA17AsyncLazySequenceVySaySiGGYaF : $@convention(thin) @async (@guaranteed AsyncLazySequence>) -> () { // CHECK: bb0([[SOURCE:%.*]] : @guaranteed $AsyncLazySequence>): // CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var AsyncLazySequence>.Iterator }, var, name "$x$generator" // CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]] @@ -97,7 +97,7 @@ struct AsyncLazySequence: AsyncSequence { // CHECK: [[ERROR_BB]]([[VAR:%.*]] : @owned $Error): // CHECK: unreachable -// CHECK: } // end sil function '$s13foreach_async13trivialStructyyAA17AsyncLazySequenceVySaySiGGYF' +// CHECK: } // end sil function '$s13foreach_async13trivialStructyyAA17AsyncLazySequenceVySaySiGGYaF' func trivialStruct(_ xx: AsyncLazySequence<[Int]>) async { for await x in xx { loopBodyEnd() @@ -105,7 +105,7 @@ func trivialStruct(_ xx: AsyncLazySequence<[Int]>) async { funcEnd() } -// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async21trivialStructContinueyyAA17AsyncLazySequenceVySaySiGGYF : $@convention(thin) @async (@guaranteed AsyncLazySequence>) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async21trivialStructContinueyyAA17AsyncLazySequenceVySaySiGGYaF : $@convention(thin) @async (@guaranteed AsyncLazySequence>) -> () { // CHECK: bb0([[SOURCE:%.*]] : @guaranteed $AsyncLazySequence>): // CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var AsyncLazySequence>.Iterator }, var, name "$x$generator" // CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]] @@ -139,7 +139,7 @@ func trivialStruct(_ xx: AsyncLazySequence<[Int]>) async { // CHECK: [[ERROR_BB]]([[VAR:%.*]] : @owned $Error): // CHECK: unreachable -// CHECK: } // end sil function '$s13foreach_async21trivialStructContinueyyAA17AsyncLazySequenceVySaySiGGYF' +// CHECK: } // end sil function '$s13foreach_async21trivialStructContinueyyAA17AsyncLazySequenceVySaySiGGYaF' func trivialStructContinue(_ xx: AsyncLazySequence<[Int]>) async { for await x in xx { @@ -166,7 +166,7 @@ func trivialStructBreak(_ xx: AsyncLazySequence<[Int]>) async { funcEnd() } -// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async26trivialStructContinueBreakyyAA17AsyncLazySequenceVySaySiGGYF : $@convention(thin) @async (@guaranteed AsyncLazySequence>) -> () +// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async26trivialStructContinueBreakyyAA17AsyncLazySequenceVySaySiGGYaF : $@convention(thin) @async (@guaranteed AsyncLazySequence>) -> () // CHECK: bb0([[SOURCE:%.*]] : @guaranteed $AsyncLazySequence>): // CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var AsyncLazySequence>.Iterator }, var, name "$x$generator" // CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]] @@ -204,7 +204,7 @@ func trivialStructBreak(_ xx: AsyncLazySequence<[Int]>) async { // CHECK: [[LOOP_EXIT]]: // CHECK: return -// CHECK: } // end sil function '$s13foreach_async26trivialStructContinueBreakyyAA17AsyncLazySequenceVySaySiGGYF' +// CHECK: } // end sil function '$s13foreach_async26trivialStructContinueBreakyyAA17AsyncLazySequenceVySaySiGGYaF' func trivialStructContinueBreak(_ xx: AsyncLazySequence<[Int]>) async { for await x in xx { if (condition()) { diff --git a/test/SILGen/hop_to_executor.swift b/test/SILGen/hop_to_executor.swift index 4413ec0b940f0..d6fbe9662be38 100644 --- a/test/SILGen/hop_to_executor.swift +++ b/test/SILGen/hop_to_executor.swift @@ -6,21 +6,21 @@ actor MyActor { private var p: Int - // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC6calleeyySiYF : $@convention(method) @async (Int, @guaranteed MyActor) -> () { + // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC6calleeyySiYaF : $@convention(method) @async (Int, @guaranteed MyActor) -> () { // CHECK-NOT: hop_to_executor - // CHECK: } // end sil function '$s4test7MyActorC6calleeyySiYF' + // CHECK: } // end sil function '$s4test7MyActorC6calleeyySiYaF' nonisolated func callee(_ x: Int) async { print(x) } - // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC14throwingCalleeyySiYKF : $@convention(method) @async (Int, @guaranteed MyActor) -> @error Error { + // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC14throwingCalleeyySiYaKF : $@convention(method) @async (Int, @guaranteed MyActor) -> @error Error { // CHECK-NOT: hop_to_executor - // CHECK: } // end sil function '$s4test7MyActorC14throwingCalleeyySiYKF' + // CHECK: } // end sil function '$s4test7MyActorC14throwingCalleeyySiYaKF' nonisolated func throwingCallee(_ x: Int) async throws { print(x) } - // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC0A13AsyncFunctionyyYKF : $@convention(method) @async (@guaranteed MyActor) -> @error Error { + // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC0A13AsyncFunctionyyYaKF : $@convention(method) @async (@guaranteed MyActor) -> @error Error { // CHECK: hop_to_executor %0 : $MyActor // CHECK: = apply {{.*}} : $@convention(method) @async (Int, @guaranteed MyActor) -> () // CHECK-NEXT: hop_to_executor %0 : $MyActor @@ -29,29 +29,29 @@ actor MyActor { // CHECK-NEXT: hop_to_executor %0 : $MyActor // CHECK: bb2({{.*}}): // CHECK-NEXT: hop_to_executor %0 : $MyActor - // CHECK: } // end sil function '$s4test7MyActorC0A13AsyncFunctionyyYKF' + // CHECK: } // end sil function '$s4test7MyActorC0A13AsyncFunctionyyYaKF' func testAsyncFunction() async throws { await callee(p) try await throwingCallee(p) } - // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC0A22ConsumingAsyncFunctionyyYF : $@convention(method) @async (@owned MyActor) -> () { + // CHECK-LABEL: sil hidden [ossa] @$s4test7MyActorC0A22ConsumingAsyncFunctionyyYaF : $@convention(method) @async (@owned MyActor) -> () { // CHECK: [[BORROWED_SELF:%[0-9]+]] = begin_borrow %0 : $MyActor // CHECK: hop_to_executor [[BORROWED_SELF]] : $MyActor // CHECK: = apply {{.*}} : $@convention(method) @async (Int, @guaranteed MyActor) -> () // CHECK-NEXT: hop_to_executor [[BORROWED_SELF]] : $MyActor - // CHECK: } // end sil function '$s4test7MyActorC0A22ConsumingAsyncFunctionyyYF' + // CHECK: } // end sil function '$s4test7MyActorC0A22ConsumingAsyncFunctionyyYaF' __consuming func testConsumingAsyncFunction() async { await callee(p) } - // CHECK-LABEL: sil private [ossa] @$s4test7MyActorC0A7ClosureSiyYFSiyYXEfU_ : $@convention(thin) @async (@guaranteed MyActor) -> Int { + // CHECK-LABEL: sil private [ossa] @$s4test7MyActorC0A7ClosureSiyYaFSiyYaXEfU_ : $@convention(thin) @async (@guaranteed MyActor) -> Int { // CHECK: [[COPIED_SELF:%[0-9]+]] = copy_value %0 : $MyActor // CHECK: [[BORROWED_SELF:%[0-9]+]] = begin_borrow [[COPIED_SELF]] : $MyActor // CHECK: hop_to_executor [[BORROWED_SELF]] : $MyActor // CHECK: = apply - // CHECK: } // end sil function '$s4test7MyActorC0A7ClosureSiyYFSiyYXEfU_' + // CHECK: } // end sil function '$s4test7MyActorC0A7ClosureSiyYaFSiyYaXEfU_' func testClosure() async -> Int { return await { () async in p }() } @@ -73,7 +73,7 @@ struct GlobalActor { static var shared: MyActor = MyActor() } -// CHECK-LABEL: sil hidden [ossa] @$s4test0A11GlobalActoryyYF : $@convention(thin) @async () -> () { +// CHECK-LABEL: sil hidden [ossa] @$s4test0A11GlobalActoryyYaF : $@convention(thin) @async () -> () { // CHECK: [[F:%[0-9]+]] = function_ref @$s4test11GlobalActorV6sharedAA02MyC0Cvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: [[P:%[0-9]+]] = apply [[F]]() : $@convention(thin) () -> Builtin.RawPointer // CHECK: [[A:%[0-9]+]] = pointer_to_address %2 : $Builtin.RawPointer to [strict] $*MyActor @@ -81,12 +81,12 @@ struct GlobalActor { // CHECK: [[L:%[0-9]+]] = load [copy] [[ACC]] : $*MyActor // CHECK: [[B:%[0-9]+]] = begin_borrow [[L]] : $MyActor // CHECK: hop_to_executor [[B]] : $MyActor -// CHECK: } // end sil function '$s4test0A11GlobalActoryyYF' +// CHECK: } // end sil function '$s4test0A11GlobalActoryyYaF' @GlobalActor func testGlobalActor() async { } -// CHECK-LABEL: sil private [ossa] @$s4test0A22GlobalActorWithClosureyyYFyyYXEfU_ : $@convention(thin) @async () -> () { +// CHECK-LABEL: sil private [ossa] @$s4test0A22GlobalActorWithClosureyyYaFyyYaXEfU_ : $@convention(thin) @async () -> () { // CHECK: [[F:%[0-9]+]] = function_ref @$s4test11GlobalActorV6sharedAA02MyC0Cvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: [[P:%[0-9]+]] = apply [[F]]() : $@convention(thin) () -> Builtin.RawPointer // CHECK: [[A:%[0-9]+]] = pointer_to_address %2 : $Builtin.RawPointer to [strict] $*MyActor @@ -94,7 +94,7 @@ func testGlobalActor() async { // CHECK: [[L:%[0-9]+]] = load [copy] [[ACC]] : $*MyActor // CHECK: [[B:%[0-9]+]] = begin_borrow [[L]] : $MyActor // CHECK: hop_to_executor [[B]] : $MyActor -// CHECK: } // end sil function '$s4test0A22GlobalActorWithClosureyyYFyyYXEfU_' +// CHECK: } // end sil function '$s4test0A22GlobalActorWithClosureyyYaFyyYaXEfU_' @GlobalActor func testGlobalActorWithClosure() async { await { () async in }() @@ -105,13 +105,13 @@ struct GenericGlobalActorWithGetter { static var shared: MyActor { return MyActor() } } -// CHECK-LABEL: sil hidden [ossa] @$s4test0A28GenericGlobalActorWithGetteryyYF : $@convention(thin) @async () -> () { +// CHECK-LABEL: sil hidden [ossa] @$s4test0A28GenericGlobalActorWithGetteryyYaF : $@convention(thin) @async () -> () { // CHECK: [[MT:%[0-9]+]] = metatype $@thin GenericGlobalActorWithGetter.Type // CHECK: [[F:%[0-9]+]] = function_ref @$s4test28GenericGlobalActorWithGetterV6sharedAA02MyD0CvgZ : $@convention(method) <τ_0_0> (@thin GenericGlobalActorWithGetter<τ_0_0>.Type) -> @owned MyActor // CHECK: [[A:%[0-9]+]] = apply [[F]]([[MT]]) : $@convention(method) <τ_0_0> (@thin GenericGlobalActorWithGetter<τ_0_0>.Type) -> @owned MyActor // CHECK: [[B:%[0-9]+]] = begin_borrow [[A]] : $MyActor // CHECK: hop_to_executor [[B]] : $MyActor -// CHECK: } // end sil function '$s4test0A28GenericGlobalActorWithGetteryyYF' +// CHECK: } // end sil function '$s4test0A28GenericGlobalActorWithGetteryyYaF' @GenericGlobalActorWithGetter func testGenericGlobalActorWithGetter() async { } @@ -125,7 +125,7 @@ actor RedActorImpl { } actor BlueActorImpl { -// CHECK-LABEL: sil hidden [ossa] @$s4test13BlueActorImplC4poke6personyAA03RedcD0C_tYF : $@convention(method) @async (@guaranteed RedActorImpl, @guaranteed BlueActorImpl) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s4test13BlueActorImplC4poke6personyAA03RedcD0C_tYaF : $@convention(method) @async (@guaranteed RedActorImpl, @guaranteed BlueActorImpl) -> () { // CHECK: bb0([[RED:%[0-9]+]] : @guaranteed $RedActorImpl, [[BLUE:%[0-9]+]] : @guaranteed $BlueActorImpl): // CHECK: hop_to_executor [[BLUE]] : $BlueActorImpl // CHECK-NOT: hop_to_executor @@ -136,12 +136,12 @@ actor BlueActorImpl { // CHECK-NEXT: {{%[0-9]+}} = apply [[METH]]([[INTARG]], [[RED]]) : $@convention(method) (Int, @guaranteed RedActorImpl) -> () // CHECK-NEXT: hop_to_executor [[BLUE]] : $BlueActorImpl // CHECK-NOT: hop_to_executor -// CHECK: } // end sil function '$s4test13BlueActorImplC4poke6personyAA03RedcD0C_tYF' +// CHECK: } // end sil function '$s4test13BlueActorImplC4poke6personyAA03RedcD0C_tYaF' func poke(person red : RedActorImpl) async { await red.hello(42) } -// CHECK-LABEL: sil hidden [ossa] @$s4test13BlueActorImplC14createAndGreetyyYF : $@convention(method) @async (@guaranteed BlueActorImpl) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s4test13BlueActorImplC14createAndGreetyyYaF : $@convention(method) @async (@guaranteed BlueActorImpl) -> () { // CHECK: bb0([[BLUE:%[0-9]+]] : @guaranteed $BlueActorImpl): // CHECK: hop_to_executor [[BLUE]] : $BlueActorImpl // CHECK: [[RED:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}) : $@convention(method) (@thick RedActorImpl.Type) -> @owned RedActorImpl @@ -153,7 +153,7 @@ actor BlueActorImpl { // CHECK-NEXT: hop_to_executor [[BLUE]] : $BlueActorImpl // CHECK: end_borrow [[REDBORROW]] : $RedActorImpl // CHECK: destroy_value [[RED]] : $RedActorImpl -// CHECK: } // end sil function '$s4test13BlueActorImplC14createAndGreetyyYF' +// CHECK: } // end sil function '$s4test13BlueActorImplC14createAndGreetyyYaF' func createAndGreet() async { let red = RedActorImpl() // <- key difference from `poke` is local construction of the actor await red.hello(42) @@ -175,7 +175,7 @@ struct BlueActor { // CHECK: } // end sil function '$s4test5redFnyySiF' @RedActor func redFn(_ x : Int) {} -// CHECK-LABEL: sil hidden [ossa] @$s4test6blueFnyyYF : $@convention(thin) @async () -> () { +// CHECK-LABEL: sil hidden [ossa] @$s4test6blueFnyyYaF : $@convention(thin) @async () -> () { // ---- switch to blue actor, since we're an async function ---- // CHECK: [[MT:%[0-9]+]] = metatype $@thin BlueActor.Type // CHECK: [[F:%[0-9]+]] = function_ref @$s4test9BlueActorV6sharedAA0bC4ImplCvgZ : $@convention(method) (@thin BlueActor.Type) -> @owned BlueActorImpl @@ -203,12 +203,12 @@ struct BlueActor { // CHECK: end_borrow [[BLUEEXE]] : $BlueActorImpl // CHECK: destroy_value [[B]] : $BlueActorImpl // CHECK-NOT: hop_to_executor -// CHECK: } // end sil function '$s4test6blueFnyyYF' +// CHECK: } // end sil function '$s4test6blueFnyyYaF' @BlueActor func blueFn() async { await redFn(100) } -// CHECK-LABEL: sil hidden [ossa] @$s4test20unspecifiedAsyncFuncyyYF : $@convention(thin) @async () -> () { +// CHECK-LABEL: sil hidden [ossa] @$s4test20unspecifiedAsyncFuncyyYaF : $@convention(thin) @async () -> () { // CHECK-NOT: hop_to_executor // CHECK: [[BORROW:%[0-9]+]] = begin_borrow {{%[0-9]+}} : $RedActorImpl // CHECK-NEXT: [[PREV_EXEC:%.*]] = builtin "getCurrentExecutor"() @@ -217,12 +217,12 @@ struct BlueActor { // CHECK-NEXT: hop_to_executor [[PREV_EXEC]] // CHECK-NEXT: end_borrow [[BORROW]] : $RedActorImpl // CHECK-NOT: hop_to_executor -// CHECK: } // end sil function '$s4test20unspecifiedAsyncFuncyyYF' +// CHECK: } // end sil function '$s4test20unspecifiedAsyncFuncyyYaF' func unspecifiedAsyncFunc() async { await redFn(200) } -// CHECK-LABEL: sil hidden [ossa] @$s4test27anotherUnspecifiedAsyncFuncyyAA12RedActorImplCYF : $@convention(thin) @async (@guaranteed RedActorImpl) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s4test27anotherUnspecifiedAsyncFuncyyAA12RedActorImplCYaF : $@convention(thin) @async (@guaranteed RedActorImpl) -> () { // CHECK: bb0([[RED:%[0-9]+]] : @guaranteed $RedActorImpl): // CHECK-NOT: hop_to_executor // CHECK: [[INTARG:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int @@ -232,7 +232,7 @@ func unspecifiedAsyncFunc() async { // CHECK-NEXT: hop_to_executor [[RED]] : $RedActorImpl // CHECK-NEXT: {{%[0-9]+}} = apply [[METH]]([[INTARG]], [[RED]]) : $@convention(method) (Int, @guaranteed RedActorImpl) -> () // CHECK-NEXT: hop_to_executor [[PREV_EXEC]] -// CHECK: } // end sil function '$s4test27anotherUnspecifiedAsyncFuncyyAA12RedActorImplCYF' +// CHECK: } // end sil function '$s4test27anotherUnspecifiedAsyncFuncyyAA12RedActorImplCYaF' func anotherUnspecifiedAsyncFunc(_ red : RedActorImpl) async { await red.hello(12); } diff --git a/test/SILGen/hop_to_executor_async_prop.swift b/test/SILGen/hop_to_executor_async_prop.swift index 9b177b0e9734c..4b4e3e6c9e998 100644 --- a/test/SILGen/hop_to_executor_async_prop.swift +++ b/test/SILGen/hop_to_executor_async_prop.swift @@ -79,7 +79,7 @@ struct GlobalCat { set {} } -// CHECK-LABEL: sil hidden [ossa] @$s4test015accessSweaterOfC03catAA0C0VAA3CatC_tYF : $@convention(thin) @async (@guaranteed Cat) -> @owned Sweater { +// CHECK-LABEL: sil hidden [ossa] @$s4test015accessSweaterOfC03catAA0C0VAA3CatC_tYaF : $@convention(thin) @async (@guaranteed Cat) -> @owned Sweater { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat): // CHECK: [[PREV_EXEC:%.*]] = builtin "getCurrentExecutor" // CHECK: hop_to_executor [[CAT]] : $Cat @@ -104,13 +104,13 @@ struct GlobalCat { // CHECK: destroy_value [[CAT2_REF]] : $Cat // CHECK: return [[SWEATER2_OWNER]] : $Sweater -// CHECK: } // end sil function '$s4test015accessSweaterOfC03catAA0C0VAA3CatC_tYF' +// CHECK: } // end sil function '$s4test015accessSweaterOfC03catAA0C0VAA3CatC_tYaF' func accessSweaterOfSweater(cat : Cat) async -> Sweater { // note that Sweater is not an actor! return await cat.computedSweater.owner.computedSweater } -// CHECK-LABEL: sil hidden [ossa] @$s4test26accessGlobalIsolatedMember3catSSAA3CatC_tYF : $@convention(thin) @async (@guaranteed Cat) -> @owned String { +// CHECK-LABEL: sil hidden [ossa] @$s4test26accessGlobalIsolatedMember3catSSAA3CatC_tYaF : $@convention(thin) @async (@guaranteed Cat) -> @owned String { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat): // CHECK: [[GLOBAL_CAT_SHARED:%[0-9]+]] = function_ref @$s4test9GlobalCatV6sharedAA0C0Cvau : $@convention(thin) () -> Builtin.RawPointer // CHECK: [[GLOBAL_CAT_RAWPTR:%[0-9]+]] = apply [[GLOBAL_CAT_SHARED]]() : $@convention(thin) () -> Builtin.RawPointer @@ -126,7 +126,7 @@ func accessSweaterOfSweater(cat : Cat) async -> Sweater { // CHECK: hop_to_executor [[PREV_EXEC]] // CHECK: destroy_value [[GLOBAL_CAT_REF]] : $Cat // CHECK: return [[THE_STRING]] : $String -// CHECK: } // end sil function '$s4test26accessGlobalIsolatedMember3catSSAA3CatC_tYF' +// CHECK: } // end sil function '$s4test26accessGlobalIsolatedMember3catSSAA3CatC_tYaF' func accessGlobalIsolatedMember(cat : Cat) async -> String { return await cat.leader } @@ -134,7 +134,7 @@ func accessGlobalIsolatedMember(cat : Cat) async -> String { actor Dog { - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC15accessGlobalVarSbyYF : $@convention(method) @async (@guaranteed Dog) -> Bool { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC15accessGlobalVarSbyYaF : $@convention(method) @async (@guaranteed Dog) -> Bool { // CHECK: [[GLOBAL_BOOL_ADDR:%[0-9]+]] = global_addr @$s4test10globalBoolSbvp : $*Bool // CHECK: hop_to_executor [[SELF:%[0-9]+]] : $Dog // CHECK: [[SHARED_REF_FN:%[0-9]+]] = function_ref @$s4test9GlobalCatV6sharedAA0C0Cvau : $@convention(thin) () -> Builtin.RawPointer @@ -152,13 +152,13 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[CAT]] : $Cat // CHECK: return [[THE_BOOL]] : $Bool - // CHECK: } // end sil function '$s4test3DogC15accessGlobalVarSbyYF' + // CHECK: } // end sil function '$s4test3DogC15accessGlobalVarSbyYaF' func accessGlobalVar() async -> Bool { return await globalBool } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC24accessGlobalComputedPropSiyYF : $@convention(method) @async (@guaranteed Dog) -> Int { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC24accessGlobalComputedPropSiyYaF : $@convention(method) @async (@guaranteed Dog) -> Int { // CHECK: bb0([[SELF:%[0-9]+]] : @guaranteed $Dog): // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: [[SHARED_REF_FN:%[0-9]+]] = function_ref @$s4test9GlobalCatV6sharedAA0C0Cvau : $@convention(thin) () -> Builtin.RawPointer @@ -185,13 +185,13 @@ actor Dog { // CHECK: destroy_value [[BIRB]] : $Birb // CHECK: destroy_value [[CAT]] : $Cat // CHECK: return [[THE_INT]] : $Int - // CHECK: } // end sil function '$s4test3DogC24accessGlobalComputedPropSiyYF' + // CHECK: } // end sil function '$s4test3DogC24accessGlobalComputedPropSiyYaF' func accessGlobalComputedProp() async -> Int { return await someBirb.feathers } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC21accessWrappedProperty3catSiAA3CatC_tYF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> Int { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC21accessWrappedProperty3catSiAA3CatC_tYaF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> Int { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat, [[SELF:%[0-9]+]] : @guaranteed $Dog): // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: hop_to_executor [[CAT]] : $Cat @@ -208,13 +208,13 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[BIRB_REF]] : $Birb // CHECK: return [[THE_INT]] : $Int - // CHECK: } // end sil function '$s4test3DogC21accessWrappedProperty3catSiAA3CatC_tYF' + // CHECK: } // end sil function '$s4test3DogC21accessWrappedProperty3catSiAA3CatC_tYaF' func accessWrappedProperty(cat : Cat) async -> Int { return await cat.bestFriend.feathers } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC16accessFromRValueSbyYF : $@convention(method) @async (@guaranteed Dog) -> Bool { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC16accessFromRValueSbyYaF : $@convention(method) @async (@guaranteed Dog) -> Bool { // CHECK: hop_to_executor [[SELF:%[0-9]+]] : $Dog // CHECK: [[INIT:%[0-9]+]] = function_ref @$s4test3CatCACycfC : $@convention(method) (@thick Cat.Type) -> @owned Cat // CHECK: [[CAT_REF:%[0-9]+]] = apply [[INIT]]({{%[0-9]+}}) : $@convention(method) (@thick Cat.Type) -> @owned Cat @@ -230,13 +230,13 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[CAT_REF]] : $Cat // CHECK: return [[THE_BOOL]] : $Bool - // CHECK: } // end sil function '$s4test3DogC16accessFromRValueSbyYF' + // CHECK: } // end sil function '$s4test3DogC16accessFromRValueSbyYaF' func accessFromRValue() async -> Bool { return await Cat().storedBool } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC23accessFromRValueChainedSbyYF : $@convention(method) @async (@guaranteed Dog) -> Bool { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC23accessFromRValueChainedSbyYaF : $@convention(method) @async (@guaranteed Dog) -> Bool { // CHECK: hop_to_executor [[SELF:%[0-9]+]] : $Dog // CHECK: [[INIT:%[0-9]+]] = function_ref @$s4test3CatCACycfC : $@convention(method) (@thick Cat.Type) -> @owned Cat // CHECK: [[CAT_REF:%[0-9]+]] = apply [[INIT]]({{%[0-9]+}}) : $@convention(method) (@thick Cat.Type) -> @owned Cat @@ -263,13 +263,13 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[FRIEND_REF]] : $Cat // CHECK: return [[THE_BOOL]] : $Bool - // CHECK: } // end sil function '$s4test3DogC23accessFromRValueChainedSbyYF' + // CHECK: } // end sil function '$s4test3DogC23accessFromRValueChainedSbyYaF' func accessFromRValueChained() async -> Bool { return await Cat().friend.storedBool } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC15accessSubscript3catAA3CatCAG_tYF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Cat { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC15accessSubscript3catAA3CatCAG_tYaF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Cat { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat, [[DOG:%[0-9]+]] : @guaranteed $Dog): // CHECK: hop_to_executor [[DOG]] : $Dog // CHECK: [[INTEGER1:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int @@ -280,12 +280,12 @@ actor Dog { // CHECK: hop_to_executor [[DOG]] : $Dog // CHECK: return [[OTHER_CAT]] : $Cat - // CHECK: } // end sil function '$s4test3DogC15accessSubscript3catAA3CatCAG_tYF' + // CHECK: } // end sil function '$s4test3DogC15accessSubscript3catAA3CatCAG_tYaF' func accessSubscript(cat : Cat) async -> Cat { return await cat[1] } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC27accessRValueNestedSubscriptAA3CatCyYF : $@convention(method) @async (@guaranteed Dog) -> @owned Cat { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC27accessRValueNestedSubscriptAA3CatCyYaF : $@convention(method) @async (@guaranteed Dog) -> @owned Cat { // CHECK: hop_to_executor [[SELF:%[0-9]+]] : $Dog // CHECK: [[RVALUE_CAT_REF:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}) : $@convention(method) (@thick Cat.Type) -> @owned Cat // CHECK: [[LIT_ONE:%[0-9]+]] = integer_literal $Builtin.IntLiteral, 1 @@ -315,13 +315,13 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[FIRST_CAT_REF]] : $Cat // CHECK: return [[SECOND_CAT_REF]] : $Cat - // CHECK: } // end sil function '$s4test3DogC27accessRValueNestedSubscriptAA3CatCyYF' + // CHECK: } // end sil function '$s4test3DogC27accessRValueNestedSubscriptAA3CatCyYaF' func accessRValueNestedSubscript() async -> Cat { return await Cat()[1][2] } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC33accessStoredPropFromRefProjection3boxSbAA6CatBoxC_tYF : $@convention(method) @async (@guaranteed CatBox, @guaranteed Dog) -> Bool { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC33accessStoredPropFromRefProjection3boxSbAA6CatBoxC_tYaF : $@convention(method) @async (@guaranteed CatBox, @guaranteed Dog) -> Bool { // CHECK: bb0([[BOX:%[0-9]+]] : @guaranteed $CatBox, [[SELF:%[0-9]+]] : @guaranteed $Dog): // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: [[BOX_GETTER:%[0-9]+]] = class_method [[BOX]] : $CatBox, #CatBox.cat!getter : (CatBox) -> () -> Cat, $@convention(method) (@guaranteed CatBox) -> @owned Cat @@ -338,12 +338,12 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[CAT_REF]] : $Cat // CHECK: return [[THE_BOOL]] : $Bool - // CHECK: } // end sil function '$s4test3DogC33accessStoredPropFromRefProjection3boxSbAA6CatBoxC_tYF' + // CHECK: } // end sil function '$s4test3DogC33accessStoredPropFromRefProjection3boxSbAA6CatBoxC_tYaF' func accessStoredPropFromRefProjection(box : CatBox) async -> Bool { return await box.cat.storedBool } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC015accessSweaterOfD03catAA0D0VAA3CatC_tYF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Sweater { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC015accessSweaterOfD03catAA0D0VAA3CatC_tYaF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Sweater { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat, [[SELF:%[0-9]+]] : @guaranteed $Dog): // CHECK: hop_to_executor [[SELF]] : $Dog @@ -369,14 +369,14 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[CAT2_REF]] : $Cat // CHECK: return [[SWEATER2_OWNER]] : $Sweater - // CHECK: } // end sil function '$s4test3DogC015accessSweaterOfD03catAA0D0VAA3CatC_tYF' + // CHECK: } // end sil function '$s4test3DogC015accessSweaterOfD03catAA0D0VAA3CatC_tYaF' func accessSweaterOfSweater(cat : Cat) async -> Sweater { // note that Sweater is not an actor! return await cat.computedSweater.owner.computedSweater } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC13accessCatList3catAA0D0CAG_tYF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Cat { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC13accessCatList3catAA0D0CAG_tYaF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Cat { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat, [[SELF:%[0-9]+]] : @guaranteed $Dog): // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: hop_to_executor [[CAT]] : $Cat @@ -393,13 +393,13 @@ actor Dog { // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: destroy_value [[FRIEND1_REF]] : $Cat // CHECK: return [[FRIEND2_REF]] : $Cat - // CHECK: } // end sil function '$s4test3DogC13accessCatList3catAA0D0CAG_tYF' + // CHECK: } // end sil function '$s4test3DogC13accessCatList3catAA0D0CAG_tYaF' func accessCatList(cat : Cat) async -> Cat { return await cat.friend.friend } - // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC21accessOptionalCatList3catAA0E0CSgAG_tYF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Optional { + // CHECK-LABEL: sil hidden [ossa] @$s4test3DogC21accessOptionalCatList3catAA0E0CSgAG_tYaF : $@convention(method) @async (@guaranteed Cat, @guaranteed Dog) -> @owned Optional { // CHECK: bb0([[CAT:%[0-9]+]] : @guaranteed $Cat, [[SELF:%[0-9]+]] : @guaranteed $Dog): // CHECK: hop_to_executor [[SELF]] : $Dog // CHECK: [[FRIEND1_STACK:%[0-9]+]] = alloc_stack $Optional @@ -431,7 +431,7 @@ actor Dog { // CHECK: br bb2([[FRIEND2_OPTIONAL]] : $Optional) // CHECK-NOT: hop_to_executor - // CHECK: } // end sil function '$s4test3DogC21accessOptionalCatList3catAA0E0CSgAG_tYF' + // CHECK: } // end sil function '$s4test3DogC21accessOptionalCatList3catAA0E0CSgAG_tYaF' func accessOptionalCatList(cat : Cat) async -> Cat? { return await cat.maybeFriend?.friend } diff --git a/test/SILGen/reasync.swift b/test/SILGen/reasync.swift index 16065a9ca8ccb..30892ea5775b5 100644 --- a/test/SILGen/reasync.swift +++ b/test/SILGen/reasync.swift @@ -1,7 +1,7 @@ // RUN: %target-swift-frontend -emit-silgen %s -enable-experimental-concurrency | %FileCheck %s // REQUIRES: concurrency -// CHECK-LABEL: sil hidden [ossa] @$s7reasync0A8FunctionyyyyYXEYF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () { +// CHECK-LABEL: sil hidden [ossa] @$s7reasync0A8FunctionyyyyYaXEYaF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () { func reasyncFunction(_ a: () async -> ()) reasync { await a() } @@ -10,26 +10,26 @@ func reasyncFunction(_ a: () async -> ()) reasync { // CHECK: [[THUNK_FN:%.*]] = function_ref @$sIg_IegH_TR : $@convention(thin) @async (@noescape @callee_guaranteed () -> ()) -> () // CHECK: [[THUNK:%.*]] = partial_apply [callee_guaranteed] [[THUNK_FN]](%0) : $@convention(thin) @async (@noescape @callee_guaranteed () -> ()) -> () // CHECK: [[NOESCAPE:%.*]] = convert_escape_to_noescape [not_guaranteed] [[THUNK]] : $@async @callee_guaranteed () -> () to $@noescape @async @callee_guaranteed () -> () -// CHECK: [[FN:%.*]] = function_ref @$s7reasync0A8FunctionyyyyYXEYF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () +// CHECK: [[FN:%.*]] = function_ref @$s7reasync0A8FunctionyyyyYaXEYaF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () // CHECK: apply [noasync] [[FN]]([[NOESCAPE]]) : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () func syncCaller(_ fn: () -> ()) { reasyncFunction(fn) } func asyncCaller(_ fn: () async -> ()) async { -// CHECK: [[FN:%.*]] = function_ref @$s7reasync0A8FunctionyyyyYXEYF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () +// CHECK: [[FN:%.*]] = function_ref @$s7reasync0A8FunctionyyyyYaXEYaF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () // CHECK: apply [[FN]](%0) : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> ()) -> () await reasyncFunction(fn) } -// CHECK-LABEL: sil hidden [ossa] @$s7reasync23throwingReasyncFunctionyyyyYKXEYKF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> @error Error) -> @error Error { +// CHECK-LABEL: sil hidden [ossa] @$s7reasync23throwingReasyncFunctionyyyyYaKXEYaKF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> @error Error) -> @error Error { func throwingReasyncFunction(_ a: () async throws -> ()) reasync throws { try await a() } // CHECK-LABEL: sil hidden [ossa] @$s7reasync18throwingSyncCalleryyyyXEKF : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> @error Error { -// CHECK: [[FN:%.*]] = function_ref @$s7reasync23throwingReasyncFunctionyyyyYKXEYKF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> @error Error) -> @error Error +// CHECK: [[FN:%.*]] = function_ref @$s7reasync23throwingReasyncFunctionyyyyYaKXEYaKF : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> @error Error) -> @error Error // CHECK: try_apply [noasync] [[FN]]({{.*}}) : $@convention(thin) @async (@noescape @async @callee_guaranteed () -> @error Error) -> @error Error, normal bb1, error bb2 func throwingSyncCaller(_ fn: () -> ()) throws { try throwingReasyncFunction(fn) -} \ No newline at end of file +} diff --git a/test/SILOptimizer/diagnose_lifetime_issues.swift b/test/SILOptimizer/diagnose_lifetime_issues.swift index b325a80460b98..c0b1e352c6a34 100644 --- a/test/SILOptimizer/diagnose_lifetime_issues.swift +++ b/test/SILOptimizer/diagnose_lifetime_issues.swift @@ -13,6 +13,10 @@ final class Container { } init(_ d: Delegate) { strongRef = d } + init(weakDelegate: Delegate, strongDelegate: Delegate) { + delegate = weakDelegate + strongRef = strongDelegate + } } func warningForDeadDelegate(container: Container) { @@ -64,3 +68,32 @@ func noWarningWithFixLifetime2() { }) } +func warningWithStoreWeakInCalledFunction() { + let d = Delegate() + let c = Container(weakDelegate: d, strongDelegate: Delegate()) // expected-warning {{weak reference will always be nil because the referenced object is deallocated here}} + c.callDelegate() +} + +final class StrongContainer { + var k: Delegate + init(_ k: Delegate) { self.k = k } + func set(_ newk: Delegate) { k = newk } + func noset(_ newk: Delegate) { } +} + +final class Testcl { + private weak var wk: Delegate? + + func test_set(_ c: StrongContainer) { + let k = Delegate() + c.set(k) + wk = k // No warning here, because k is kept alive by c + } + + func test_noset(_ c: StrongContainer) { + let k = Delegate() + c.noset(k) + wk = k // expected-warning {{weak reference will always be nil because the referenced object is deallocated here}} + } +} + diff --git a/test/SILOptimizer/mandatory_inlining.sil b/test/SILOptimizer/mandatory_inlining.sil index 64c69e93cf092..98ed930c6ceea 100644 --- a/test/SILOptimizer/mandatory_inlining.sil +++ b/test/SILOptimizer/mandatory_inlining.sil @@ -1481,3 +1481,22 @@ bb0: return %r : $() } +sil [transparent] @hop_to_executor : $@convention(thin) @async (@guaranteed Builtin.Executor) -> () { +entry(%executor: $Builtin.Executor): + hop_to_executor %executor : $Builtin.Executor + %r = tuple () + return %r : $() +} + +// CHECK-LABEL: sil @test_inline_nonasync +// CHECK-NOT: hop_to_executor +// CHECK-NOT: apply +// CHECK: } // end sil function 'test_inline_nonasync' + +sil @test_inline_nonasync : $@convention(thin) (@guaranteed Builtin.Executor) -> () { +entry(%executor: $Builtin.Executor): + %f = function_ref @hop_to_executor : $@convention(thin) @async (@guaranteed Builtin.Executor) -> () + %c = apply [noasync] %f(%executor) : $@convention(thin) @async (@guaranteed Builtin.Executor) -> () + %r = tuple () + return %r : $() +} diff --git a/test/SILOptimizer/performance_inliner.sil b/test/SILOptimizer/performance_inliner.sil index e2681a9fc36c2..8ec364ad875cf 100644 --- a/test/SILOptimizer/performance_inliner.sil +++ b/test/SILOptimizer/performance_inliner.sil @@ -994,3 +994,22 @@ bb0(%1 : $@thick X.Type): return %30 : $X } +sil @hop_to_executor : $@convention(thin) @async (@guaranteed Builtin.Executor) -> () { +entry(%executor: $Builtin.Executor): + hop_to_executor %executor : $Builtin.Executor + %r = tuple () + return %r : $() +} + +// CHECK-LABEL: sil @test_inline_nonasync +// CHECK-NOT: hop_to_executor +// CHECK-NOT: apply +// CHECK: } // end sil function 'test_inline_nonasync' + +sil @test_inline_nonasync : $@convention(thin) (@guaranteed Builtin.Executor) -> () { +entry(%executor: $Builtin.Executor): + %f = function_ref @hop_to_executor : $@convention(thin) @async (@guaranteed Builtin.Executor) -> () + %c = apply [noasync] %f(%executor) : $@convention(thin) @async (@guaranteed Builtin.Executor) -> () + %r = tuple () + return %r : $() +} diff --git a/test/SourceKit/DocSupport/doc_async.swift b/test/SourceKit/DocSupport/doc_async.swift index 6bd50607c16d8..2c38a398a1035 100644 --- a/test/SourceKit/DocSupport/doc_async.swift +++ b/test/SourceKit/DocSupport/doc_async.swift @@ -6,7 +6,7 @@ public protocol AsyncProto { func protoAsyncFunc() async - // CHECK: key.usr: "s:5async10AsyncProtoP05protoB4FuncyyYF" + // CHECK: key.usr: "s:5async10AsyncProtoP05protoB4FuncyyYaF" // CHECK-NOT: } // CHECK: key.is_async: 1 // CHECK: } @@ -18,7 +18,7 @@ public protocol AsyncProto { public struct AsyncStruct: AsyncProto { public func structAsyncFunc() async { } - // CHECK: key.usr: "s:5async11AsyncStructV06structB4FuncyyYF" + // CHECK: key.usr: "s:5async11AsyncStructV06structB4FuncyyYaF" // CHECK-NOT: } // CHECK: key.is_async: 1 // CHECK: } @@ -28,11 +28,11 @@ public struct AsyncStruct: AsyncProto { // CHECK: } public func protoAsyncFunc() async { } - // CHECK: key.usr: "s:5async11AsyncStructV05protoB4FuncyyYF" + // CHECK: key.usr: "s:5async11AsyncStructV05protoB4FuncyyYaF" // CHECK-NOT: } // CHECK: key.conforms // CHECK: { - // CHECK: key.usr: "s:5async10AsyncProtoP05protoB4FuncyyYF" + // CHECK: key.usr: "s:5async10AsyncProtoP05protoB4FuncyyYaF" // CHECK-NOT: } // CHECK: key.is_async: 1 // CHECK: } @@ -45,7 +45,7 @@ public struct AsyncStruct: AsyncProto { } public func topLevelAsyncFunc() async { } -// CHECK: key.usr: "s:5async17topLevelAsyncFuncyyYF" +// CHECK: key.usr: "s:5async17topLevelAsyncFuncyyYaF" // CHECK-NOT: } // CHECK: key.is_async: 1 // CHECK: } diff --git a/test/TBD/async-function-pointer.swift b/test/TBD/async-function-pointer.swift index 4291e1d529ad3..e780f8f3b8cb7 100644 --- a/test/TBD/async-function-pointer.swift +++ b/test/TBD/async-function-pointer.swift @@ -2,7 +2,7 @@ // REQUIRES: concurrency // RUN: %target-swift-frontend -emit-ir %s -enable-experimental-concurrency -enable-experimental-async-handler -validate-tbd-against-ir=all -module-name test | %FileCheck %s -// CHECK: @"$s4test6testityyYFTu" = hidden global %swift.async_func_pointer +// CHECK: @"$s4test6testityyYaFTu" = hidden global %swift.async_func_pointer @asyncHandler public func testit() { } @@ -11,7 +11,7 @@ public func testit() { } @_silgen_name("bar") public func foo() async {} -// CHECK: @"$s4test1CC1f33_295642D23064661A21CD592AD781409CLLyyYFTu" = global %swift.async_func_pointer +// CHECK: @"$s4test1CC1f33_295642D23064661A21CD592AD781409CLLyyYaFTu" = global %swift.async_func_pointer open class C { private func f() async { } diff --git a/test/TypeDecoder/concurrency.swift b/test/TypeDecoder/concurrency.swift index a4fdd14b7b905..60dbc0492e74c 100644 --- a/test/TypeDecoder/concurrency.swift +++ b/test/TypeDecoder/concurrency.swift @@ -20,10 +20,10 @@ func foo() { } } -// DEMANGLE-TYPE: $sSayySiYcG +// DEMANGLE-TYPE: $sSayySiYacG // CHECK-TYPE: Array<(Int) async -> ()> -// DEMANGLE-TYPE: $sSayySiYKcG +// DEMANGLE-TYPE: $sSayySiYaKcG // CHECK-TYPE: Array<(Int) async throws -> ()> // DEMANGLE-TYPE: $sIegH_D diff --git a/unittests/Reflection/TypeRef.cpp b/unittests/Reflection/TypeRef.cpp index 55b40c48c503f..77dcf6e4b14aa 100644 --- a/unittests/Reflection/TypeRef.cpp +++ b/unittests/Reflection/TypeRef.cpp @@ -250,6 +250,23 @@ TEST(TypeRefTest, UniqueFunctionTypeRef) { FunctionMetadataDifferentiabilityKind::Reverse); EXPECT_EQ(F17, F18); EXPECT_NE(F17, F19); + + // Test differentiable with @noDerivative. + { + auto parameters = Parameters1; + parameters[1].setNoDerivative(); + auto f1 = Builder.createFunctionType( + parameters, Result, FunctionTypeFlags().withDifferentiable(true), + FunctionMetadataDifferentiabilityKind::Reverse); + auto f2 = Builder.createFunctionType( + parameters, Result, FunctionTypeFlags().withDifferentiable(true), + FunctionMetadataDifferentiabilityKind::Reverse); + auto f3 = Builder.createFunctionType( + Parameters1, Result, FunctionTypeFlags().withDifferentiable(true), + FunctionMetadataDifferentiabilityKind::Reverse); + EXPECT_EQ(f1, f2); + EXPECT_NE(f1, f3); + } } TEST(TypeRefTest, UniqueProtocolTypeRef) {