diff --git a/include/swift/Basic/RelativePointer.h b/include/swift/Basic/RelativePointer.h index c5210acd89efa..bad8b3427dbaf 100644 --- a/include/swift/Basic/RelativePointer.h +++ b/include/swift/Basic/RelativePointer.h @@ -42,6 +42,26 @@ static inline uintptr_t applyRelativeOffset(BasePtrTy *basePtr, Offset offset) { return base + extendOffset; } +/// Measure the relative offset between two pointers. This measures +/// (referent - base) using wrapping arithmetic. The result is truncated if +/// Offset is smaller than a pointer, with an assertion that the +/// pre-truncation result is a sign extension of the truncated result. +template +static inline Offset measureRelativeOffset(A *referent, B *base) { + static_assert(std::is_integral::value && + std::is_signed::value, + "offset type should be signed integer"); + + auto distance = (uintptr_t)referent - (uintptr_t)base; + // Truncate as unsigned, then wrap around to signed. + auto truncatedDistance = + (Offset)(typename std::make_unsigned::type)distance; + // Assert that the truncation didn't discard any non-sign-extended bits. + assert((intptr_t)truncatedDistance == (intptr_t)distance + && "pointers are too far apart to fit in offset type"); + return truncatedDistance; +} + } // namespace detail /// A relative reference to an object stored in memory. The reference may be @@ -70,7 +90,34 @@ class RelativeIndirectablePointer { = delete; public: + /// Allow construction and reassignment from an absolute pointer. + /// These always produce a direct relative offset. + RelativeIndirectablePointer(ValueTy *absolute) + : RelativeOffsetPlusIndirect( + Nullable && absolute == nullptr + ? 0 + : detail::measureRelativeOffset(absolute, this)) { + if (!Nullable) + assert(absolute != nullptr && + "constructing non-nullable relative pointer from null"); + } + + RelativeIndirectablePointer &operator=(ValueTy *absolute) & { + if (!Nullable) + assert(absolute != nullptr && + "constructing non-nullable relative pointer from null"); + + RelativeOffsetPlusIndirect = Nullable && absolute == nullptr + ? 0 + : detail::measureRelativeOffset(absolute, this); + return *this; + } + const ValueTy *get() const & { + static_assert(alignof(ValueTy) >= 2 && alignof(Offset) >= 2, + "alignment of value and offset must be at least 2 to " + "make room for indirectable flag"); + // Check for null. if (Nullable && RelativeOffsetPlusIndirect == 0) return nullptr; @@ -118,17 +165,42 @@ class RelativeDirectPointerImpl { /// RelativePointers should appear in statically-generated metadata. They /// shouldn't be constructed or copied. RelativeDirectPointerImpl() = delete; - RelativeDirectPointerImpl(RelativeDirectPointerImpl &&) = delete; - RelativeDirectPointerImpl(const RelativeDirectPointerImpl &) = delete; - RelativeDirectPointerImpl &operator=(RelativeDirectPointerImpl &&) - = delete; - RelativeDirectPointerImpl &operator=(const RelativeDirectPointerImpl&) - = delete; public: using ValueTy = T; using PointerTy = T*; + // Allow construction and reassignment from an absolute pointer. + RelativeDirectPointerImpl(PointerTy absolute) + : RelativeOffset(Nullable && absolute == nullptr + ? 0 + : detail::measureRelativeOffset(absolute, this)) + { + if (!Nullable) + assert(absolute != nullptr && + "constructing non-nullable relative pointer from null"); + } + explicit constexpr RelativeDirectPointerImpl(std::nullptr_t) + : RelativeOffset (0) { + static_assert(Nullable, "can't construct non-nullable pointer from null"); + } + + RelativeDirectPointerImpl &operator=(PointerTy absolute) & { + if (!Nullable) + assert(absolute != nullptr && + "constructing non-nullable relative pointer from null"); + RelativeOffset = Nullable && absolute == nullptr + ? 0 + : detail::measureRelativeOffset(absolute, this); + return *this; + } + + // Can copy-construct by recalculating the relative offset at the new + // position. + RelativeDirectPointerImpl(const RelativeDirectPointerImpl &p) { + *this = p.get(); + } + PointerTy get() const & { // Check for null. if (Nullable && RelativeOffset == 0) @@ -153,6 +225,12 @@ class RelativeDirectPointer : using super = RelativeDirectPointerImpl; public: using super::get; + using super::super; + + RelativeDirectPointer &operator=(T *absolute) & { + super::operator=(absolute); + return *this; + } operator typename super::PointerTy() const & { return this->get(); @@ -178,7 +256,13 @@ class RelativeDirectPointer : using super = RelativeDirectPointerImpl; public: using super::get; + using super::super; + RelativeDirectPointer &operator=(RetTy (*absolute)(ArgTy...)) & { + super::operator=(absolute); + return *this; + } + operator typename super::PointerTy() const & { return this->get(); } @@ -229,5 +313,16 @@ class RelativeDirectPointerIntPair { } }; +// Type aliases for "far" relative pointers, which need to be able to reach +// across the full address space instead of only across a single small-code- +// model image. + +template +using FarRelativeIndirectablePointer = + RelativeIndirectablePointer; + +template +using FarRelativeDirectPointer = RelativeDirectPointer; + } diff --git a/include/swift/Runtime/Metadata.h b/include/swift/Runtime/Metadata.h index febb64a0f5ca5..d2a761e191334 100644 --- a/include/swift/Runtime/Metadata.h +++ b/include/swift/Runtime/Metadata.h @@ -1246,7 +1246,7 @@ struct EnumTypeDescriptor; /// descriptor is shared for all instantiations of the generic type. struct NominalTypeDescriptor { /// The mangled name of the nominal type, with no generic parameters. - RelativeDirectPointer Name; + RelativeDirectPointer Name; /// The following fields are kind-dependent. union { @@ -1266,7 +1266,7 @@ struct NominalTypeDescriptor { /// The field names. A doubly-null-terminated list of strings, whose /// length and order is consistent with that of the field offset vector. - RelativeDirectPointer FieldNames; + RelativeDirectPointer FieldNames; /// The field type vector accessor. Returns a pointer to an array of /// type metadata references whose order is consistent with that of the @@ -1290,7 +1290,7 @@ struct NominalTypeDescriptor { /// The field names. A doubly-null-terminated list of strings, whose /// length and order is consistent with that of the field offset vector. - RelativeDirectPointer FieldNames; + RelativeDirectPointer FieldNames; /// The field type vector accessor. Returns a pointer to an array of /// type metadata references whose order is consistent with that of the @@ -1313,7 +1313,7 @@ struct NominalTypeDescriptor { /// The names of the cases. A doubly-null-terminated list of strings, /// whose length is NumNonEmptyCases + NumEmptyCases. Cases are named in /// tag order, non-empty cases first, followed by empty cases. - RelativeDirectPointer CaseNames; + RelativeDirectPointer CaseNames; /// The field type vector accessor. Returns a pointer to an array of /// type metadata references whose order is consistent with that of the /// CaseNames. Only types for payload cases are provided. @@ -1372,20 +1372,19 @@ typedef void (*ClassIVarDestroyer)(HeapObject *); struct ClassMetadata : public HeapMetadata { ClassMetadata() = default; constexpr ClassMetadata(const HeapMetadata &base, - const ClassMetadata *superClass, - uintptr_t data, - ClassFlags flags, - const NominalTypeDescriptor *description, - ClassIVarDestroyer ivarDestroyer, - uintptr_t size, uintptr_t addressPoint, - uintptr_t alignMask, - uintptr_t classSize, uintptr_t classAddressPoint) + const ClassMetadata *superClass, + uintptr_t data, + ClassFlags flags, + ClassIVarDestroyer ivarDestroyer, + uintptr_t size, uintptr_t addressPoint, + uintptr_t alignMask, + uintptr_t classSize, uintptr_t classAddressPoint) : HeapMetadata(base), SuperClass(superClass), CacheData{nullptr, nullptr}, Data(data), Flags(flags), InstanceAddressPoint(addressPoint), InstanceSize(size), InstanceAlignMask(alignMask), Reserved(0), ClassSize(classSize), ClassAddressPoint(classAddressPoint), - Description(description), IVarDestroyer(ivarDestroyer) {} + Description(nullptr), IVarDestroyer(ivarDestroyer) {} /// The metadata for the superclass. This is null for the root class. const ClassMetadata *SuperClass; @@ -1443,7 +1442,8 @@ struct ClassMetadata : public HeapMetadata { /// if this is an artificial subclass. We currently provide no /// supported mechanism for making a non-artificial subclass /// dynamically. - const NominalTypeDescriptor *Description; + FarRelativeDirectPointer Description; /// A function for destroying instance variables, used to clean up /// after an early return from a constructor. @@ -1462,6 +1462,10 @@ struct ClassMetadata : public HeapMetadata { assert(!isArtificialSubclass()); return Description; } + + void setDescription(const NominalTypeDescriptor *description) { + Description = description; + } ClassIVarDestroyer getIVarDestroyer() const { assert(isTypeMetadata()); @@ -1713,14 +1717,40 @@ struct ForeignClassMetadata : public ForeignTypeMetadata { } }; -/// The structure of type metadata for structs. -struct StructMetadata : public Metadata { +/// The common structure of metadata for structs and enums. +struct ValueMetadata : public Metadata { + ValueMetadata(MetadataKind Kind, const NominalTypeDescriptor *description, + const Metadata *parent) + : Metadata(Kind), Description(description), Parent(parent) + {} + /// An out-of-line description of the type. - const NominalTypeDescriptor *Description; + FarRelativeDirectPointer Description; /// The parent type of this member type, or null if this is not a /// member type. - const Metadata *Parent; + FarRelativeIndirectablePointer Parent; + + static bool classof(const Metadata *metadata) { + return metadata->getKind() == MetadataKind::Struct + || metadata->getKind() == MetadataKind::Enum + || metadata->getKind() == MetadataKind::Optional; + } + + /// Retrieve the generic arguments of this type. + const Metadata * const *getGenericArgs() const { + if (Description->GenericParams.NumParams == 0) + return nullptr; + + const void* const *asWords = reinterpret_cast(this); + asWords += Description->GenericParams.Offset; + return reinterpret_cast(asWords); + } +}; + +/// The structure of type metadata for structs. +struct StructMetadata : public ValueMetadata { + using ValueMetadata::ValueMetadata; /// Get a pointer to the field offset vector, if present, or null. const uintptr_t *getFieldOffsets() const { @@ -1740,29 +1770,14 @@ struct StructMetadata : public Metadata { return getter(this); } - /// Retrieve the generic arguments of this struct. - const Metadata * const *getGenericArgs() const { - if (Description->GenericParams.NumParams == 0) - return nullptr; - - const void* const *asWords = reinterpret_cast(this); - asWords += Description->GenericParams.Offset; - return reinterpret_cast(asWords); - } - static bool classof(const Metadata *metadata) { return metadata->getKind() == MetadataKind::Struct; } }; /// The structure of type metadata for enums. -struct EnumMetadata : public Metadata { - /// An out-of-line description of the type. - const NominalTypeDescriptor *Description; - - /// The parent type of this member type, or null if this is not a - /// member type. - const Metadata *Parent; +struct EnumMetadata : public ValueMetadata { + using ValueMetadata::ValueMetadata; /// True if the metadata records the size of the payload area. bool hasPayloadSize() const { @@ -1788,16 +1803,6 @@ struct EnumMetadata : public Metadata { return *asWords; } - /// Retrieve the generic arguments of this enum. - const Metadata * const *getGenericArgs() const { - const void* const *asWords = reinterpret_cast(this); - if (Description->GenericParams.NumParams == 0) - return nullptr; - - asWords += Description->GenericParams.Offset; - return reinterpret_cast(asWords); - } - static bool classof(const Metadata *metadata) { return metadata->getKind() == MetadataKind::Enum || metadata->getKind() == MetadataKind::Optional; @@ -2215,7 +2220,7 @@ struct GenericWitnessTable { /*nullable*/ true> Protocol; /// The pattern. - RelativeDirectPointer Pattern; + RelativeDirectPointer Pattern; /// The instantiation function, which is called after the template is copied. RelativeDirectPointer DirectType; + RelativeDirectPointer DirectType; /// The nominal type descriptor for a resilient or generic type. RelativeDirectPointer TypeDescriptor; @@ -2327,7 +2332,7 @@ struct ProtocolConformanceRecord { // The conformance, or a generator function for the conformance. union { /// A direct reference to the witness table for the conformance. - RelativeDirectPointer WitnessTable; + RelativeDirectPointer WitnessTable; /// A function that produces the witness table given an instance of the /// type. The function may return null if a specific instance does not @@ -2502,7 +2507,7 @@ swift_allocateGenericClassMetadata(GenericMetadata *pattern, // Callback to allocate a generic struct/enum metadata object. SWIFT_RUNTIME_EXPORT -extern "C" Metadata * +extern "C" ValueMetadata * swift_allocateGenericValueMetadata(GenericMetadata *pattern, const void *arguments); diff --git a/lib/IRGen/ConstantBuilder.h b/lib/IRGen/ConstantBuilder.h index 5b983270887e6..437972a5594c6 100644 --- a/lib/IRGen/ConstantBuilder.h +++ b/lib/IRGen/ConstantBuilder.h @@ -72,8 +72,12 @@ class ConstantBuilder : public Base { relativeAddressBase = base; } - llvm::Constant *getRelativeAddressFromNextField(llvm::Constant *referent) { + llvm::Constant *getRelativeAddressFromNextField(llvm::Constant *referent, + llvm::IntegerType *addressTy = nullptr) { assert(relativeAddressBase && "no relative address base set"); + if (!addressTy) + addressTy = IGM.RelativeAddressTy; + // Determine the address of the next field in the initializer. llvm::Constant *fieldAddr = llvm::ConstantExpr::getPtrToInt(relativeAddressBase, IGM.SizeTy); @@ -85,9 +89,8 @@ class ConstantBuilder : public Base { llvm::Constant *relative = llvm::ConstantExpr::getSub(referent, fieldAddr); - if (relative->getType() != IGM.RelativeAddressTy) - relative = llvm::ConstantExpr::getTrunc(relative, - IGM.RelativeAddressTy); + if (relative->getType() != addressTy) + relative = llvm::ConstantExpr::getTrunc(relative, addressTy); return relative; } @@ -97,6 +100,13 @@ class ConstantBuilder : public Base { addInt32(getRelativeAddressFromNextField(referent)); } + /// Add a pointer-sized relative address from the current location in the + /// local being built to another global variable. + void addFarRelativeAddress(llvm::Constant *referent) { + addWord(getRelativeAddressFromNextField(referent, + IGM.FarRelativeAddressTy)); + } + /// Add a 32-bit relative address from the current location in the local /// being built to another global variable, or null if a null referent /// is passed. @@ -107,6 +117,16 @@ class ConstantBuilder : public Base { addConstantInt32(0); } + /// Add a pointer-sized relative address from the current location in the + /// local being built to another global variable, or null if a null referent + /// is passed. + void addFarRelativeAddressOrNull(llvm::Constant *referent) { + if (referent) + addFarRelativeAddress(referent); + else + addConstantWord(0); + } + /// Add a 32-bit relative address from the current location in the local /// being built to another global variable. Pack a constant integer into /// the alignment bits of the pointer. @@ -119,6 +139,20 @@ class ConstantBuilder : public Base { addInt32(relativeAddr); } + /// Add a pointer-size relative address from the current location in the + /// local being built to another global variable. Pack a constant integer + /// into the alignment bits of the pointer. + void addFarRelativeAddressWithTag(llvm::Constant *referent, + unsigned tag) { + // FIXME: could be 8 when targeting 64-bit platforms + assert(tag < 4 && "tag too big to pack in relative address"); + llvm::Constant *relativeAddr = + getRelativeAddressFromNextField(referent, IGM.FarRelativeAddressTy); + relativeAddr = llvm::ConstantExpr::getAdd(relativeAddr, + llvm::ConstantInt::get(IGM.FarRelativeAddressTy, tag)); + addWord(relativeAddr); + } + /// Add a uint32_t value that represents the given offset /// scaled to a number of words. void addConstantInt32InWords(Size value) { diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp index 6f42ad0089ad7..3a5c45d011e95 100644 --- a/lib/IRGen/GenDecl.cpp +++ b/lib/IRGen/GenDecl.cpp @@ -1190,29 +1190,45 @@ getIRLinkage(IRGenModule &IGM, #define RESULT(LINKAGE, VISIBILITY) \ { llvm::GlobalValue::LINKAGE##Linkage, \ llvm::GlobalValue::VISIBILITY##Visibility } + // Public visibility depends on the target object format. + llvm::GlobalValue::VisibilityTypes PublicDefinitionVisibility; + switch (IGM.TargetInfo.OutputObjectFormat) { + case llvm::Triple::ELF: + // Use protected visibility for public symbols we define. + // ld.so doesn't support relative relocations at load time, which interferes + // with our metadata formats. + PublicDefinitionVisibility = llvm::GlobalValue::ProtectedVisibility; + break; + default: + // Default visibility should suffice for other object formats. + PublicDefinitionVisibility = llvm::GlobalValue::DefaultVisibility; + break; + } + if (isFragile) { // Fragile functions/globals must be visible from outside, regardless of // their accessibility. If a caller is also fragile and inlined into another // module it must be able to access this (not-inlined) function/global. switch (linkage) { - case SILLinkage::Hidden: - case SILLinkage::Private: - linkage = SILLinkage::Public; - break; + case SILLinkage::Hidden: + case SILLinkage::Private: + linkage = SILLinkage::Public; + break; - case SILLinkage::Public: - case SILLinkage::Shared: - case SILLinkage::HiddenExternal: - case SILLinkage::PrivateExternal: - case SILLinkage::PublicExternal: - case SILLinkage::SharedExternal: - break; + case SILLinkage::Public: + case SILLinkage::Shared: + case SILLinkage::HiddenExternal: + case SILLinkage::PrivateExternal: + case SILLinkage::PublicExternal: + case SILLinkage::SharedExternal: + break; } } switch (linkage) { - case SILLinkage::Public: return RESULT(External, Default); + case SILLinkage::Public: + return {llvm::GlobalValue::ExternalLinkage, PublicDefinitionVisibility}; case SILLinkage::Shared: case SILLinkage::SharedExternal: return RESULT(LinkOnceODR, Hidden); case SILLinkage::Hidden: return RESULT(External, Hidden); @@ -1266,8 +1282,7 @@ static void updateLinkageForDefinition(IRGenModule &IGM, // Exclude "main", because it should naturally be used, and because adding it // to llvm.used leaves a dangling use when the REPL attempts to discard // intermediate mains. - if (linkage.first == llvm::GlobalValue::ExternalLinkage && - linkage.second == llvm::GlobalValue::DefaultVisibility && + if (LinkInfo::isUsed(linkage.first, linkage.second) && global->getName() != SWIFT_ENTRY_POINT_FUNCTION) { IGM.addUsedGlobal(global); } @@ -1336,9 +1351,7 @@ llvm::Function *LinkInfo::createFunction(IRGenModule &IGM, // Exclude "main", because it should naturally be used, and because adding it // to llvm.used leaves a dangling use when the REPL attempts to discard // intermediate mains. - if (ForDefinition && - Linkage == llvm::GlobalValue::ExternalLinkage && - Visibility == llvm::GlobalValue::DefaultVisibility && + if (isUsed() && getName() != SWIFT_ENTRY_POINT_FUNCTION) { IGM.addUsedGlobal(fn); } @@ -1346,12 +1359,13 @@ llvm::Function *LinkInfo::createFunction(IRGenModule &IGM, return fn; } -bool LinkInfo::isUsed() const { +bool LinkInfo::isUsed(llvm::GlobalValue::LinkageTypes Linkage, + llvm::GlobalValue::VisibilityTypes Visibility) { // Everything externally visible is considered used in Swift. // That mostly means we need to be good at not marking things external. - return ForDefinition && - Linkage == llvm::GlobalValue::ExternalLinkage && - Visibility == llvm::GlobalValue::DefaultVisibility; + return Linkage == llvm::GlobalValue::ExternalLinkage && + (Visibility == llvm::GlobalValue::DefaultVisibility || + Visibility == llvm::GlobalValue::ProtectedVisibility); } /// Get or create an LLVM global variable with these linkage rules. @@ -2253,11 +2267,12 @@ IRGenModule::getAddrOfTypeMetadataLazyCacheVariable(CanType type, /// existing external declaration to the address point as an alias into the /// full metadata object. llvm::GlobalValue *IRGenModule::defineTypeMetadata(CanType concreteType, - bool isIndirect, - bool isPattern, - bool isConstant, - llvm::Constant *init, - llvm::StringRef section) { + bool isIndirect, + bool isPattern, + bool isConstant, + llvm::Constant *init, + std::unique_ptr replace, + llvm::StringRef section) { assert(init); assert(!isIndirect && "indirect type metadata not used yet"); @@ -2299,6 +2314,13 @@ llvm::GlobalValue *IRGenModule::defineTypeMetadata(CanType concreteType, var->setConstant(isConstant); if (!section.empty()) var->setSection(section); + + // Replace the placeholder if we were given one. + if (replace) { + auto replacer = llvm::ConstantExpr::getBitCast(var, replace->getType()); + replace->replaceAllUsesWith(replacer); + replace.release(); + } // Keep type metadata around for all types, although the runtime can currently // only perform name lookup of non-generic types. @@ -2471,42 +2493,6 @@ llvm::Constant *IRGenModule::getAddrOfTypeMetadata(CanType concreteType, return addr; } -/// Return the address of a foreign-type metadata candidate. There is no -/// single translation unit which can uniquely emit foreign-type metadata, -/// and we don't want to force the dynamic linker to eagerly unique them -/// by symbol name, so instead we emit a "candidate" metadata and ask -/// the runtime to unique them. -llvm::Constant * -IRGenModule::getAddrOfForeignTypeMetadataCandidate(CanType type) { - // What we save in GlobalVars is actually the offsetted value. - auto entity = LinkEntity::forForeignTypeMetadataCandidate(type); - if (auto entry = GlobalVars[entity]) - return entry; - - // Compute the constant initializer and the offset of the type - // metadata candidate within it. - Size addressPoint; - auto init = emitForeignTypeMetadataInitializer(*this, type, addressPoint); - - // Create the global variable. - LinkInfo link = LinkInfo::get(*this, entity, ForDefinition); - auto var = link.createVariable(*this, init->getType(), - getPointerAlignment()); - var->setInitializer(init); - - // Apply the offset. - llvm::Constant *result = var; - result = llvm::ConstantExpr::getBitCast(result, Int8PtrTy); - result = llvm::ConstantExpr::getInBoundsGetElementPtr( - Int8Ty, result, getSize(addressPoint)); - result = llvm::ConstantExpr::getBitCast(result, TypeMetadataPtrTy); - - // Only remember the offset. - GlobalVars[entity] = result; - - return result; -} - /// Return the address of a nominal type descriptor. Right now, this /// must always be for purposes of defining it. llvm::Constant *IRGenModule::getAddrOfNominalTypeDescriptor(NominalTypeDecl *D, diff --git a/lib/IRGen/GenMeta.cpp b/lib/IRGen/GenMeta.cpp index 3bbfc8e318361..bf5ebaf7c0958 100644 --- a/lib/IRGen/GenMeta.cpp +++ b/lib/IRGen/GenMeta.cpp @@ -1841,7 +1841,24 @@ void irgen::emitMetatypeRef(IRGenFunction &IGF, CanMetatypeType type, /** Nominal Type Descriptor Emission *****************************************/ /*****************************************************************************/ -namespace { +namespace { + /// Helper to produce a dummy value that can stand in for a global constant + /// for us to build relative references against before the constant is + /// instantiated. + static std::unique_ptr + createTemporaryRelativeAddressBase(IRGenModule &IGM) { + return std::unique_ptr( + new llvm::GlobalVariable(IGM.Int8Ty, true, + llvm::GlobalValue::PrivateLinkage)); + } + + static void + replaceTemporaryRelativeAddressBase(IRGenModule &IGM, + std::unique_ptr temp, llvm::Constant *real) { + real = llvm::ConstantExpr::getBitCast(real, IGM.Int8PtrTy); + temp->replaceAllUsesWith(real); + } + template class NominalTypeDescriptorBuilderBase : public ConstantBuilder<> { Impl &asImpl() { return *static_cast(this); } @@ -1925,9 +1942,7 @@ namespace { llvm::Constant *emit() { // Set up a dummy global to stand in for the constant. - std::unique_ptr tempBase( - new llvm::GlobalVariable(IGM.Int8Ty, true, - llvm::GlobalValue::PrivateLinkage)); + auto tempBase = createTemporaryRelativeAddressBase(IGM); setRelativeAddressBase(tempBase.get()); asImpl().layout(); auto init = getInit(); @@ -1939,9 +1954,7 @@ namespace { var->setInitializer(init); IGM.setTrueConstGlobal(var); - auto replacer = llvm::ConstantExpr::getBitCast(var, IGM.Int8PtrTy); - tempBase->replaceAllUsesWith(replacer); - + replaceTemporaryRelativeAddressBase(IGM, std::move(tempBase), var); return var; } @@ -2855,6 +2868,7 @@ namespace { protected: IRGenModule &IGM = super::IGM; ClassDecl * const& Target = super::Target; + using super::setRelativeAddressBase; using super::addWord; using super::addConstantWord; using super::addInt16; @@ -2863,14 +2877,18 @@ namespace { using super::addConstantInt32; using super::addStruct; using super::getNextOffset; + using super::addFarRelativeAddress; + using super::addFarRelativeAddressOrNull; const StructLayout &Layout; const ClassLayout &FieldLayout; SILVTable *VTable; ClassMetadataBuilderBase(IRGenModule &IGM, ClassDecl *theClass, const StructLayout &layout, - const ClassLayout &fieldLayout) + const ClassLayout &fieldLayout, + llvm::GlobalVariable *relativeAddressBase) : super(IGM, theClass), Layout(layout), FieldLayout(fieldLayout) { + setRelativeAddressBase(relativeAddressBase); VTable = IGM.SILMod->lookUpVTable(Target); } @@ -2934,7 +2952,9 @@ namespace { } void addNominalTypeDescriptor() { - addWord(ClassNominalTypeDescriptorBuilder(IGM, Target).emit()); + auto descriptor = + ClassNominalTypeDescriptorBuilder(IGM, Target).emit(); + addFarRelativeAddress(descriptor); } void addIVarDestroyer() { @@ -3156,8 +3176,10 @@ namespace { public: ClassMetadataBuilder(IRGenModule &IGM, ClassDecl *theClass, const StructLayout &layout, - const ClassLayout &fieldLayout) - : ClassMetadataBuilderBase(IGM, theClass, layout, fieldLayout) { + const ClassLayout &fieldLayout, + llvm::GlobalVariable *relativeAddressBase) + : ClassMetadataBuilderBase(IGM, theClass, layout, fieldLayout, + relativeAddressBase) { assert(layout.isFixedLayout() && "non-fixed layout classes require a template"); @@ -3236,8 +3258,9 @@ namespace { public: GenericClassMetadataBuilder(IRGenModule &IGM, ClassDecl *theClass, const StructLayout &layout, - const ClassLayout &fieldLayout) - : super(IGM, theClass, layout, fieldLayout) + const ClassLayout &fieldLayout, + llvm::GlobalVariable *relativeAddressBase) + : super(IGM, theClass, layout, fieldLayout, relativeAddressBase) { // We need special initialization of metadata objects to trick the ObjC // runtime into initializing them. @@ -3583,16 +3606,22 @@ void irgen::emitClassMetadata(IRGenModule &IGM, ClassDecl *classDecl, const ClassLayout &fieldLayout) { assert(!classDecl->isForeign()); + // Set up a dummy global to stand in for the metadata object while we produce + // relative references. + auto tempBase = createTemporaryRelativeAddressBase(IGM); + // TODO: classes nested within generic types llvm::Constant *init; bool isPattern; if (IGM.hasMetadataPattern(classDecl)) { - GenericClassMetadataBuilder builder(IGM, classDecl, layout, fieldLayout); + GenericClassMetadataBuilder builder(IGM, classDecl, layout, fieldLayout, + tempBase.get()); builder.layout(); init = builder.getInit(); isPattern = true; } else { - ClassMetadataBuilder builder(IGM, classDecl, layout, fieldLayout); + ClassMetadataBuilder builder(IGM, classDecl, layout, fieldLayout, + tempBase.get()); builder.layout(); init = builder.getInit(); isPattern = false; @@ -3614,7 +3643,7 @@ void irgen::emitClassMetadata(IRGenModule &IGM, ClassDecl *classDecl, // special case: it's not a pattern, ObjC interoperation isn't // required, there are no class fields, and there is nothing that // needs to be runtime-adjusted. - /*isConstant*/ false, init, section); + /*isConstant*/ false, init, std::move(tempBase), section); // Add non-generic classes to the ObjC class list. if (IGM.ObjCInterop && !isPattern && !isIndirect) { @@ -4332,9 +4361,15 @@ namespace { using super::Target; using super::addConstantWord; using super::addWord; + using super::addFarRelativeAddress; + using super::addFarRelativeAddressOrNull; + using super::setRelativeAddressBase; - StructMetadataBuilderBase(IRGenModule &IGM, StructDecl *theStruct) - : super(IGM, theStruct) {} + StructMetadataBuilderBase(IRGenModule &IGM, StructDecl *theStruct, + llvm::GlobalVariable *relativeAddressBase) + : super(IGM, theStruct) { + setRelativeAddressBase(relativeAddressBase); + } public: void addMetadataFlags() { @@ -4342,12 +4377,14 @@ namespace { } void addNominalTypeDescriptor() { - addWord(StructNominalTypeDescriptorBuilder(IGM, Target).emit()); + llvm::Constant *descriptor = + StructNominalTypeDescriptorBuilder(IGM, Target).emit(); + addFarRelativeAddress(descriptor); } void addParentMetadataRef() { - // FIXME! - addWord(llvm::ConstantPointerNull::get(IGM.TypeMetadataPtrTy)); + // FIXME: populate + addFarRelativeAddressOrNull(nullptr); } void addFieldOffset(VarDecl *var) { @@ -4384,8 +4421,9 @@ namespace { class StructMetadataBuilder : public StructMetadataBuilderBase { public: - StructMetadataBuilder(IRGenModule &IGM, StructDecl *theStruct) - : StructMetadataBuilderBase(IGM, theStruct) {} + StructMetadataBuilder(IRGenModule &IGM, StructDecl *theStruct, + llvm::GlobalVariable *relativeAddressBase) + : StructMetadataBuilderBase(IGM, theStruct, relativeAddressBase) {} void addValueWitnessTable() { auto type = this->Target->getDeclaredType()->getCanonicalType(); @@ -4418,8 +4456,9 @@ namespace { typedef GenericMetadataBuilderBase super; public: - GenericStructMetadataBuilder(IRGenModule &IGM, StructDecl *theStruct) - : super(IGM, theStruct) {} + GenericStructMetadataBuilder(IRGenModule &IGM, StructDecl *theStruct, + llvm::GlobalVariable *relativeAddressBase) + : super(IGM, theStruct, relativeAddressBase) {} llvm::Value *emitAllocateMetadata(IRGenFunction &IGF, llvm::Value *metadataPattern, @@ -4456,16 +4495,20 @@ namespace { /// Emit the type metadata or metadata template for a struct. void irgen::emitStructMetadata(IRGenModule &IGM, StructDecl *structDecl) { + // Set up a dummy global to stand in for the metadata object while we produce + // relative references. + auto tempBase = createTemporaryRelativeAddressBase(IGM); + // TODO: structs nested within generic types llvm::Constant *init; bool isPattern; if (IGM.hasMetadataPattern(structDecl)) { - GenericStructMetadataBuilder builder(IGM, structDecl); + GenericStructMetadataBuilder builder(IGM, structDecl, tempBase.get()); builder.layout(); init = builder.getInit(); isPattern = true; } else { - StructMetadataBuilder builder(IGM, structDecl); + StructMetadataBuilder builder(IGM, structDecl, tempBase.get()); builder.layout(); init = builder.getInit(); isPattern = false; @@ -4479,7 +4522,8 @@ void irgen::emitStructMetadata(IRGenModule &IGM, StructDecl *structDecl) { bool isIndirect = false; IGM.defineTypeMetadata(declaredType, isIndirect, isPattern, - /*isConstant*/!isPattern, init); + /*isConstant*/!isPattern, init, + std::move(tempBase)); } // Enums @@ -4488,17 +4532,24 @@ namespace { template class EnumMetadataBuilderBase - : public ConstantBuilder> { + : public ConstantBuilder> +{ using super = ConstantBuilder>; protected: using super::IGM; using super::Target; using super::addWord; + using super::addFarRelativeAddress; + using super::addFarRelativeAddressOrNull; + using super::setRelativeAddressBase; public: - EnumMetadataBuilderBase(IRGenModule &IGM, EnumDecl *theEnum) - : super(IGM, theEnum) {} + EnumMetadataBuilderBase(IRGenModule &IGM, EnumDecl *theEnum, + llvm::GlobalVariable *relativeAddressBase) + : super(IGM, theEnum) { + setRelativeAddressBase(relativeAddressBase); + } void addMetadataFlags() { addWord(getMetadataKind(IGM, Target->classifyAsOptionalType() @@ -4506,13 +4557,15 @@ class EnumMetadataBuilderBase } void addNominalTypeDescriptor() { - // FIXME! - addWord(EnumNominalTypeDescriptorBuilder(IGM, Target).emit()); + auto descriptor = + EnumNominalTypeDescriptorBuilder(IGM, Target).emit(); + + addFarRelativeAddress(descriptor); } void addParentMetadataRef() { - // FIXME! - addWord(llvm::ConstantPointerNull::get(IGM.TypeMetadataPtrTy)); + // FIXME: populate + addFarRelativeAddressOrNull(nullptr); } void addGenericArgument(ArchetypeType *type) { @@ -4528,8 +4581,9 @@ class EnumMetadataBuilder : public EnumMetadataBuilderBase { public: - EnumMetadataBuilder(IRGenModule &IGM, EnumDecl *theEnum) - : EnumMetadataBuilderBase(IGM, theEnum) {} + EnumMetadataBuilder(IRGenModule &IGM, EnumDecl *theEnum, + llvm::GlobalVariable *relativeAddressBase) + : EnumMetadataBuilderBase(IGM, theEnum, relativeAddressBase) {} void addValueWitnessTable() { auto type = Target->getDeclaredType()->getCanonicalType(); @@ -4555,8 +4609,9 @@ class GenericEnumMetadataBuilder EnumMetadataBuilderBase> { public: - GenericEnumMetadataBuilder(IRGenModule &IGM, EnumDecl *theEnum) - : GenericMetadataBuilderBase(IGM, theEnum) {} + GenericEnumMetadataBuilder(IRGenModule &IGM, EnumDecl *theEnum, + llvm::GlobalVariable *relativeAddressBase) + : GenericMetadataBuilderBase(IGM, theEnum, relativeAddressBase) {} llvm::Value *emitAllocateMetadata(IRGenFunction &IGF, llvm::Value *metadataPattern, @@ -4604,17 +4659,21 @@ class GenericEnumMetadataBuilder } void irgen::emitEnumMetadata(IRGenModule &IGM, EnumDecl *theEnum) { + // Set up a dummy global to stand in for the metadata object while we produce + // relative references. + auto tempBase = createTemporaryRelativeAddressBase(IGM); + // TODO: enums nested inside generic types llvm::Constant *init; bool isPattern; if (IGM.hasMetadataPattern(theEnum)) { - GenericEnumMetadataBuilder builder(IGM, theEnum); + GenericEnumMetadataBuilder builder(IGM, theEnum, tempBase.get()); builder.layout(); init = builder.getInit(); isPattern = true; } else { - EnumMetadataBuilder builder(IGM, theEnum); + EnumMetadataBuilder builder(IGM, theEnum, tempBase.get()); builder.layout(); init = builder.getInit(); isPattern = false; @@ -4628,7 +4687,8 @@ void irgen::emitEnumMetadata(IRGenModule &IGM, EnumDecl *theEnum) { bool isIndirect = false; IGM.defineTypeMetadata(declaredType, isIndirect, isPattern, - /*isConstant*/!isPattern, init); + /*isConstant*/!isPattern, init, + std::move(tempBase)); } llvm::Value *IRGenFunction::emitObjCSelectorRefLoad(StringRef selector) { @@ -4774,8 +4834,9 @@ namespace { StructMetadataBuilderBase> { public: - ForeignStructMetadataBuilder(IRGenModule &IGM, StructDecl *target) - : ForeignMetadataBuilderBase(IGM, target) + ForeignStructMetadataBuilder(IRGenModule &IGM, StructDecl *target, + llvm::GlobalVariable *relativeAddressBase) + : ForeignMetadataBuilderBase(IGM, target, relativeAddressBase) {} CanType getTargetType() const { @@ -4796,8 +4857,9 @@ namespace { EnumMetadataBuilderBase> { public: - ForeignEnumMetadataBuilder(IRGenModule &IGM, EnumDecl *target) - : ForeignMetadataBuilderBase(IGM, target) + ForeignEnumMetadataBuilder(IRGenModule &IGM, EnumDecl *target, + llvm::GlobalVariable *relativeAddressBase) + : ForeignMetadataBuilderBase(IGM, target, relativeAddressBase) {} CanType getTargetType() const { @@ -4818,36 +4880,68 @@ namespace { } llvm::Constant * -irgen::emitForeignTypeMetadataInitializer(IRGenModule &IGM, CanType type, - Size &offsetOfAddressPoint) { +IRGenModule::getAddrOfForeignTypeMetadataCandidate(CanType type) { + // Create a temporary base for relative references. + auto tempBase = createTemporaryRelativeAddressBase(*this); + + // What we save in GlobalVars is actually the offsetted value. + auto entity = LinkEntity::forForeignTypeMetadataCandidate(type); + if (auto entry = GlobalVars[entity]) + return entry; + + // Compute the constant initializer and the offset of the type + // metadata candidate within it. + Size addressPoint; + llvm::Constant *init; if (auto classType = dyn_cast(type)) { assert(!classType.getParent()); auto classDecl = classType->getDecl(); assert(classDecl->isForeign()); - ForeignClassMetadataBuilder builder(IGM, classDecl); + ForeignClassMetadataBuilder builder(*this, classDecl); builder.layout(); - offsetOfAddressPoint = builder.getOffsetOfAddressPoint(); - return builder.getInit(); + addressPoint = builder.getOffsetOfAddressPoint(); + init = builder.getInit(); } else if (auto structType = dyn_cast(type)) { auto structDecl = structType->getDecl(); assert(structDecl->hasClangNode()); - ForeignStructMetadataBuilder builder(IGM, structDecl); + ForeignStructMetadataBuilder builder(*this, structDecl, tempBase.get()); builder.layout(); - offsetOfAddressPoint = builder.getOffsetOfAddressPoint(); - return builder.getInit(); + addressPoint = builder.getOffsetOfAddressPoint(); + init = builder.getInit(); } else if (auto enumType = dyn_cast(type)) { auto enumDecl = enumType->getDecl(); assert(enumDecl->hasClangNode()); - ForeignEnumMetadataBuilder builder(IGM, enumDecl); + ForeignEnumMetadataBuilder builder(*this, enumDecl, tempBase.get()); builder.layout(); - offsetOfAddressPoint = builder.getOffsetOfAddressPoint(); - return builder.getInit(); + addressPoint = builder.getOffsetOfAddressPoint(); + init = builder.getInit(); } else { llvm_unreachable("foreign metadata for unexpected type?!"); } + + // Create the global variable. + LinkInfo link = LinkInfo::get(*this, entity, ForDefinition); + auto var = link.createVariable(*this, init->getType(), + getPointerAlignment()); + var->setInitializer(init); + + // Close the loop on relative references. + replaceTemporaryRelativeAddressBase(*this, std::move(tempBase), var); + + // Apply the offset. + llvm::Constant *result = var; + result = llvm::ConstantExpr::getBitCast(result, Int8PtrTy); + result = llvm::ConstantExpr::getInBoundsGetElementPtr( + Int8Ty, result, getSize(addressPoint)); + result = llvm::ConstantExpr::getBitCast(result, TypeMetadataPtrTy); + + // Only remember the offset. + GlobalVars[entity] = result; + + return result; } // Protocols diff --git a/lib/IRGen/GenObjC.cpp b/lib/IRGen/GenObjC.cpp index 478a30373f3db..659c4fb04f7e4 100644 --- a/lib/IRGen/GenObjC.cpp +++ b/lib/IRGen/GenObjC.cpp @@ -937,7 +937,6 @@ static llvm::Constant *findSwiftAsObjCThunk(IRGenModule &IGM, SILDeclRef ref) { SILFunction *SILFn = IGM.SILMod->lookUpFunction(ref); assert(SILFn && "no IR function for swift-as-objc thunk"); auto fn = IGM.getAddrOfSILFunction(SILFn, NotForDefinition); - // FIXME: Should set the linkage of the SILFunction to 'internal'. fn->setVisibility(llvm::GlobalValue::DefaultVisibility); fn->setLinkage(llvm::GlobalValue::InternalLinkage); fn->setUnnamedAddr(true); diff --git a/lib/IRGen/IRGenModule.h b/lib/IRGen/IRGenModule.h index db0d2119cf3d1..ed88ed3746a35 100644 --- a/lib/IRGen/IRGenModule.h +++ b/lib/IRGen/IRGenModule.h @@ -352,6 +352,7 @@ class IRGenModule { llvm::IntegerType *IntPtrTy; llvm::IntegerType *MetadataKindTy; llvm::IntegerType *OnceTy; + llvm::IntegerType *FarRelativeAddressTy; }; llvm::IntegerType *ObjCBoolTy; /// i8 or i1 union { @@ -777,11 +778,12 @@ private: \ bool isForeign, ForDefinition_t forDefinition); llvm::GlobalValue *defineTypeMetadata(CanType concreteType, - bool isIndirect, - bool isPattern, - bool isConstant, - llvm::Constant *init, - llvm::StringRef section = {}); + bool isIndirect, + bool isPattern, + bool isConstant, + llvm::Constant *init, + std::unique_ptr replace, + llvm::StringRef section = {}); llvm::Constant *getAddrOfTypeMetadata(CanType concreteType, bool isPattern); llvm::Function *getAddrOfTypeMetadataAccessFunction(CanType type, diff --git a/lib/IRGen/Linking.h b/lib/IRGen/Linking.h index c33776e23ba93..879b4d9cf80cc 100644 --- a/lib/IRGen/Linking.h +++ b/lib/IRGen/Linking.h @@ -616,7 +616,12 @@ class LinkInfo { Optional DebugLoc = None, StringRef DebugName = StringRef()); - bool isUsed() const; + bool isUsed() const { + return ForDefinition && isUsed(Linkage, Visibility); + } + + static bool isUsed(llvm::GlobalValue::LinkageTypes Linkage, + llvm::GlobalValue::VisibilityTypes Visibility); }; } // end namespace irgen diff --git a/stdlib/public/runtime/Metadata.cpp b/stdlib/public/runtime/Metadata.cpp index 59399bfb5851c..da1bcedad2f2a 100644 --- a/stdlib/public/runtime/Metadata.cpp +++ b/stdlib/public/runtime/Metadata.cpp @@ -193,9 +193,17 @@ swift::swift_allocateGenericClassMetadata(GenericMetadata *pattern, bytes += pattern->AddressPoint; ClassMetadata *metadata = reinterpret_cast(bytes); assert(metadata->isTypeMetadata()); - + // Overwrite the superclass field. metadata->SuperClass = superclass; + // Adjust the relative reference to the nominal type descriptor. + if (!metadata->isArtificialSubclass()) { + auto patternBytes = + reinterpret_cast(pattern->getMetadataTemplate()) + + pattern->AddressPoint; + metadata->setDescription( + reinterpret_cast(patternBytes)->getDescription()); + } // Adjust the class object extents. if (extraPrefixSize) { @@ -207,7 +215,7 @@ swift::swift_allocateGenericClassMetadata(GenericMetadata *pattern, return metadata; } -Metadata * +ValueMetadata * swift::swift_allocateGenericValueMetadata(GenericMetadata *pattern, const void *arguments) { void * const *argumentsAsArray = reinterpret_cast(arguments); @@ -224,7 +232,17 @@ swift::swift_allocateGenericValueMetadata(GenericMetadata *pattern, // Okay, move to the address point. bytes += pattern->AddressPoint; - Metadata *metadata = reinterpret_cast(bytes); + auto *metadata = reinterpret_cast(bytes); + + // Adjust the relative references to the nominal type descriptor and + // parent type. + auto patternBytes = + reinterpret_cast(pattern->getMetadataTemplate()) + + pattern->AddressPoint; + auto patternMetadata = reinterpret_cast(patternBytes); + metadata->Description = patternMetadata->Description.get(); + metadata->Parent = patternMetadata->Parent.get(); + return metadata; } diff --git a/test/ClangModules/attr-swift_private.swift b/test/ClangModules/attr-swift_private.swift index f9fe75816e231..06034ff11f746 100644 --- a/test/ClangModules/attr-swift_private.swift +++ b/test/ClangModules/attr-swift_private.swift @@ -16,7 +16,7 @@ import SwiftPrivateAttr // half of a module, or from an overlay. At that point we should test that these // are available in that case and /not/ in the normal import case. -// CHECK-LABEL: define void @{{.+}}12testProperty +// CHECK-LABEL: define{{( protected)?}} void @{{.+}}12testProperty public func testProperty(foo: Foo) { // CHECK: @"\01L_selector(setPrivValue:)" _ = foo.__privValue @@ -27,7 +27,7 @@ public func testProperty(foo: Foo) { #endif } -// CHECK-LABEL: define void @{{.+}}11testMethods +// CHECK-LABEL: define{{( protected)?}} void @{{.+}}11testMethods public func testMethods(foo: Foo) { // CHECK: @"\01L_selector(noArgs)" foo.__noArgs() @@ -37,7 +37,7 @@ public func testMethods(foo: Foo) { foo.__twoArgs(1, other: 2) } -// CHECK-LABEL: define void @{{.+}}16testInitializers +// CHECK-LABEL: define{{( protected)?}} void @{{.+}}16testInitializers public func testInitializers() { // Checked below; look for "CSo3Bar". _ = Bar(__noArgs: ()) @@ -46,7 +46,7 @@ public func testInitializers() { _ = Bar(__: 1) } -// CHECK-LABEL: define void @{{.+}}18testFactoryMethods +// CHECK-LABEL: define{{( protected)?}} void @{{.+}}18testFactoryMethods public func testFactoryMethods() { // CHECK: @"\01L_selector(fooWithOneArg:)" _ = Foo(__oneArg: 1) @@ -63,7 +63,7 @@ public func testSubscript(foo: Foo) { } #endif -// CHECK-LABEL: define void @{{.+}}12testTopLevel +// CHECK-LABEL: define{{( protected)?}} void @{{.+}}12testTopLevel public func testTopLevel() { // Checked below; look for "PrivFooSub". let foo = __PrivFooSub() diff --git a/test/DebugInfo/inlinescopes.swift b/test/DebugInfo/inlinescopes.swift index 66cf4921e9f2c..0ef5e0ad470e6 100644 --- a/test/DebugInfo/inlinescopes.swift +++ b/test/DebugInfo/inlinescopes.swift @@ -5,7 +5,7 @@ // RUN: FileCheck %s < %t.ll // RUN: FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll -// CHECK: define{{( signext)?}} i32 @main +// CHECK: define{{( protected)?( signext)?}} i32 @main // CHECK: tail call { i64, i1 } @llvm.smul.with.overflow.i64(i64 %[[C:.*]], i64 %[[C]]), !dbg ![[MULSCOPE:.*]] // CHECK-DAG: ![[TOPLEVEL:.*]] = !DIFile(filename: "inlinescopes.swift" diff --git a/test/DebugInfo/returnlocation.swift b/test/DebugInfo/returnlocation.swift index b7f62d6f580bb..b45c40fa55abe 100644 --- a/test/DebugInfo/returnlocation.swift +++ b/test/DebugInfo/returnlocation.swift @@ -9,7 +9,7 @@ import Foundation // cleanups/no cleanups, single / multiple return locations. // RUN: FileCheck %s --check-prefix=CHECK_NONE < %t.ll -// CHECK_NONE: define void {{.*}}none +// CHECK_NONE: define{{( protected)?}} void {{.*}}none public func none(inout a: Int64) { // CHECK_NONE: call void @llvm.dbg{{.*}}, !dbg // CHECK_NONE: !dbg ![[NONE_INIT:.*]] diff --git a/test/IRGen/abitypes.swift b/test/IRGen/abitypes.swift index 72ca85e0d00fd..ecb5e19b0c2e0 100644 --- a/test/IRGen/abitypes.swift +++ b/test/IRGen/abitypes.swift @@ -439,7 +439,7 @@ class Foo { // armv7k-watchos: define internal %struct.One @makeOne(float %f, float %s) // rdar://17631440 - Expand direct arguments that are coerced to aggregates. -// x86_64-macosx: define float @_TF8abitypes13testInlineAggFVSC6MyRectSf(%VSC6MyRect* noalias nocapture dereferenceable({{.*}})) {{.*}} { +// x86_64-macosx: define{{( protected)?}} float @_TF8abitypes13testInlineAggFVSC6MyRectSf(%VSC6MyRect* noalias nocapture dereferenceable({{.*}})) {{.*}} { // x86_64-macosx: [[COERCED:%.*]] = alloca %VSC6MyRect, align 4 // x86_64-macosx: store float % // x86_64-macosx: store float % diff --git a/test/IRGen/access_control.sil b/test/IRGen/access_control.sil index a3273b2022c2d..c6ff1e139251a 100644 --- a/test/IRGen/access_control.sil +++ b/test/IRGen/access_control.sil @@ -4,13 +4,13 @@ import Builtin import Swift public struct PublicStruct { var x: Int } -// CHECK: @_TWVV14access_control12PublicStruct = constant -// CHECK: @_TMnV14access_control12PublicStruct = constant +// CHECK: @_TWVV14access_control12PublicStruct = {{(protected )?}}constant +// CHECK: @_TMnV14access_control12PublicStruct = {{(protected )?}}constant // CHECK: @_TMfV14access_control12PublicStruct = internal constant internal struct InternalStruct { var x: Int } -// CHECK: @_TWVV14access_control14InternalStruct = constant -// CHECK: @_TMnV14access_control14InternalStruct = constant +// CHECK: @_TWVV14access_control14InternalStruct = {{(protected )?}}constant +// CHECK: @_TMnV14access_control14InternalStruct = {{(protected )?}}constant // CHECK: @_TMfV14access_control14InternalStruct = internal constant private struct PrivateStruct { var x: Int } @@ -25,7 +25,7 @@ func local() { // CHECK: @_TMfVF14access_control5localFT_T_L_11LocalStruct = internal constant } -// CHECK: @_TMV14access_control12PublicStruct = alias -// CHECK: @_TMV14access_control14InternalStruct = alias +// CHECK: @_TMV14access_control12PublicStruct = {{(protected )?}}alias +// CHECK: @_TMV14access_control14InternalStruct = {{(protected )?}}alias // CHECK: @_TMV14access_controlP33_8F630B0A1EEF3ED34B761E3ED76C95A813PrivateStruct = hidden alias // CHECK: @_TMVF14access_control5localFT_T_L_11LocalStruct = hidden alias diff --git a/test/IRGen/argument_attrs.sil b/test/IRGen/argument_attrs.sil index c70260a045f88..5e42f777b5f94 100644 --- a/test/IRGen/argument_attrs.sil +++ b/test/IRGen/argument_attrs.sil @@ -4,7 +4,7 @@ import Builtin struct Huge { var x,y,z,w,a,b,c,d: Builtin.Int32 } -// CHECK-LABEL: define void @arguments_in_def(i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type* %T) +// CHECK-LABEL: define{{( protected)?}} void @arguments_in_def(i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type* %T) sil @arguments_in_def : $@convention(thin) (@inout Builtin.Int32, @in Builtin.Int32, @in_guaranteed Builtin.Int32, Huge, @in T, @in ()) -> () { entry(%1 : $*Builtin.Int32, %2 : $*Builtin.Int32, %3 : $*Builtin.Int32, %4 : $Huge, %5 : $*T, %6 : $*()): // CHECK: call void @arguments_in_decl(i32* nocapture dereferenceable(4) {{%.*}}, i32* noalias nocapture dereferenceable(4) {{%.*}}, i32* noalias nocapture dereferenceable(4) {{%.*}}, %V14argument_attrs4Huge* noalias nocapture dereferenceable(32) {{%.*}}, %swift.opaque* noalias nocapture {{%.*}}, %swift.opaque* noalias nocapture {{%.*}}, %swift.type* %T) @@ -19,7 +19,7 @@ entry(%1 : $*Builtin.Int32, %2 : $*Builtin.Int32, %3 : $*Builtin.Int32, %4 : $Hu // CHECK-LABEL: declare void @arguments_in_decl(i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type*) sil @arguments_in_decl : $@convention(thin) (@inout Builtin.Int32, @in Builtin.Int32, @in_guaranteed Builtin.Int32, Huge, @in T, @in ()) -> () -// CHECK-LABEL: define void @arguments_in_def_out(i32* noalias nocapture sret, i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type* %T) +// CHECK-LABEL: define{{( protected)?}} void @arguments_in_def_out(i32* noalias nocapture sret, i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type* %T) sil @arguments_in_def_out : $@convention(thin) (@out Builtin.Int32, @inout Builtin.Int32, @in Builtin.Int32, @in_guaranteed Builtin.Int32, Huge, @in T, @in ()) -> () { entry(%0 : $*Builtin.Int32, %1 : $*Builtin.Int32, %2 : $*Builtin.Int32, %3 : $*Builtin.Int32, %4 : $Huge, %5 : $*T, %6 : $*()): // CHECK: call void @arguments_in_decl_out(i32* noalias nocapture sret {{%.*}}, i32* nocapture dereferenceable(4) {{%.*}}, i32* noalias nocapture dereferenceable(4) {{%.*}}, i32* noalias nocapture dereferenceable(4) {{%.*}}, %V14argument_attrs4Huge* noalias nocapture dereferenceable(32) {{%.*}}, %swift.opaque* noalias nocapture {{%.*}}, %swift.opaque* noalias nocapture {{%.*}}, %swift.type* {{%.*}}) @@ -34,7 +34,7 @@ entry(%0 : $*Builtin.Int32, %1 : $*Builtin.Int32, %2 : $*Builtin.Int32, %3 : $*B // CHECK-LABEL: declare void @arguments_in_decl_out(i32* noalias nocapture sret, i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type*) sil @arguments_in_decl_out : $@convention(thin) (@out Builtin.Int32, @inout Builtin.Int32, @in Builtin.Int32, @in_guaranteed Builtin.Int32, Huge, @in T, @in ()) -> () -// CHECK-LABEL: define void @arguments_in_def_huge_ret(%V14argument_attrs4Huge* noalias nocapture sret, i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type* %T) +// CHECK-LABEL: define{{( protected)?}} void @arguments_in_def_huge_ret(%V14argument_attrs4Huge* noalias nocapture sret, i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type* %T) sil @arguments_in_def_huge_ret : $@convention(thin) (@inout Builtin.Int32, @in Builtin.Int32, @in_guaranteed Builtin.Int32, Huge, @in T, @in ()) -> Huge { entry(%1 : $*Builtin.Int32, %2 : $*Builtin.Int32, %3 : $*Builtin.Int32, %4 : $Huge, %5 : $*T, %6 : $*()): %f = function_ref @arguments_in_decl_huge_ret : $@convention(thin) (@inout Builtin.Int32, @in Builtin.Int32, @in_guaranteed Builtin.Int32, Huge, @in T, @in ()) -> Huge diff --git a/test/IRGen/autorelease.sil b/test/IRGen/autorelease.sil index 1cd35cd4e1f3e..ff4fca9ee4aac 100644 --- a/test/IRGen/autorelease.sil +++ b/test/IRGen/autorelease.sil @@ -24,23 +24,23 @@ sil @foo : $@convention(thin) (@owned C?) -> @autoreleased C? { bb0(%0 : $C?): return %0 : $C? } -// x86_64: define i64 @foo(i64) {{.*}} { +// x86_64: define{{( protected)?}} i64 @foo(i64) {{.*}} { // x86_64: [[T0:%.*]] = tail call i64 bitcast ([[OBJC]]* ([[OBJC]]*)* @objc_autoreleaseReturnValue to i64 (i64)*)(i64 %0) // x86_64-NEXT: ret i64 [[T0]] -// i386: define i32 @foo(i32) {{.*}} { +// i386: define{{( protected)?}} i32 @foo(i32) {{.*}} { // i386: [[T0:%.*]] = tail call i32 bitcast ([[OBJC]]* ([[OBJC]]*)* @objc_autoreleaseReturnValue to i32 (i32)*)(i32 %0) // i386-NEXT: ret i32 [[T0]] -// arm64: define i64 @foo(i64) {{.*}} { +// arm64: define{{( protected)?}} i64 @foo(i64) {{.*}} { // arm64: [[T0:%.*]] = tail call i64 bitcast ([[OBJC]]* ([[OBJC]]*)* @objc_autoreleaseReturnValue to i64 (i64)*)(i64 %0) // arm64-NEXT: ret i64 [[T0]] -// armv7: define i32 @foo(i32) {{.*}} { +// armv7: define{{( protected)?}} i32 @foo(i32) {{.*}} { // armv7: [[T0:%.*]] = tail call i32 bitcast ([[OBJC]]* ([[OBJC]]*)* @objc_autoreleaseReturnValue to i32 (i32)*)(i32 %0) // armv7-NEXT: ret i32 [[T0]] -// armv7k: define i32 @foo(i32) {{.*}} { +// armv7k: define{{( protected)?}} i32 @foo(i32) {{.*}} { // armv7k: [[T0:%.*]] = tail call i32 bitcast ([[OBJC]]* ([[OBJC]]*)* @objc_autoreleaseReturnValue to i32 (i32)*)(i32 %0) // armv7k-NEXT: ret i32 [[T0]] @@ -50,21 +50,21 @@ bb0(%0 : $C?): %2 = apply %1(%0) : $@convention(thin) (@owned C?) -> @autoreleased C? return %2 : $C? } -// x86_64: define i64 @bar(i64) +// x86_64: define{{( protected)?}} i64 @bar(i64) // x86_64: [[T0:%.*]] = call i64 @foo(i64 %0) // x86_64-NEXT: [[T1:%.*]] = inttoptr i64 [[T0]] to i8* // x86_64-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) // x86_64-NEXT: [[T3:%.*]] = ptrtoint i8* [[T2]] to i64 // x86_64-NEXT: ret i64 [[T3]] -// i386: define i32 @bar(i32) +// i386: define{{( protected)?}} i32 @bar(i32) // i386: [[T0:%.*]] = call i32 @foo(i32 %0) // i386-NEXT: [[T1:%.*]] = inttoptr i32 [[T0]] to i8* // i386-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) // i386-NEXT: [[T3:%.*]] = ptrtoint i8* [[T2]] to i32 // i386-NEXT: ret i32 [[T3]] -// arm64: define i64 @bar(i64) +// arm64: define{{( protected)?}} i64 @bar(i64) // arm64: [[T0:%.*]] = call i64 @foo(i64 %0) // arm64-NEXT: call void asm sideeffect "mov // arm64-NEXT: [[T1:%.*]] = inttoptr i64 [[T0]] to i8* @@ -72,7 +72,7 @@ bb0(%0 : $C?): // arm64-NEXT: [[T3:%.*]] = ptrtoint i8* [[T2]] to i64 // arm64-NEXT: ret i64 [[T3]] -// armv7: define i32 @bar(i32) +// armv7: define{{( protected)?}} i32 @bar(i32) // armv7: [[T0:%.*]] = call i32 @foo(i32 %0) // armv7-NEXT: call void asm sideeffect "mov // armv7-NEXT: [[T1:%.*]] = inttoptr i32 [[T0]] to i8* @@ -80,7 +80,7 @@ bb0(%0 : $C?): // armv7-NEXT: [[T3:%.*]] = ptrtoint i8* [[T2]] to i32 // armv7-NEXT: ret i32 [[T3]] -// armv7k: define i32 @bar(i32) +// armv7k: define{{( protected)?}} i32 @bar(i32) // armv7k: [[T0:%.*]] = call i32 @foo(i32 %0) // armv7k-NEXT: call void asm sideeffect "mov // armv7k-NEXT: [[T1:%.*]] = inttoptr i32 [[T0]] to i8* diff --git a/test/IRGen/bitcast.sil b/test/IRGen/bitcast.sil index e225c9bfb465b..c71d837464794 100644 --- a/test/IRGen/bitcast.sil +++ b/test/IRGen/bitcast.sil @@ -16,7 +16,7 @@ sil_vtable C {} protocol CP: class {} -// CHECK-i386-LABEL: define i32 @bitcast_trivial(%C7bitcast1C*) {{.*}} { +// CHECK-i386-LABEL: define{{( protected)?}} i32 @bitcast_trivial(%C7bitcast1C*) {{.*}} { // CHECK-i386: [[BUF:%.*]] = alloca %C7bitcast1C*, align 4 // CHECK-i386: store %C7bitcast1C* %0, %C7bitcast1C** [[BUF]] // CHECK-i386: [[OUT_BUF:%.*]] = bitcast %C7bitcast1C** [[BUF]] to %Si* @@ -25,7 +25,7 @@ protocol CP: class {} // CHECK-i386: ret i32 [[VALUE]] // CHECK-i386: } -// CHECK-x86_64-LABEL: define i64 @bitcast_trivial(%C7bitcast1C*) {{.*}} { +// CHECK-x86_64-LABEL: define{{( protected)?}} i64 @bitcast_trivial(%C7bitcast1C*) {{.*}} { // CHECK-x86_64: [[BUF:%.*]] = alloca %C7bitcast1C*, align 8 // CHECK-x86_64: store %C7bitcast1C* %0, %C7bitcast1C** [[BUF]] // CHECK-x86_64: [[OUT_BUF:%.*]] = bitcast %C7bitcast1C** [[BUF]] to %Si* @@ -40,7 +40,7 @@ entry(%c : $C): } -// CHECK-x86_64-LABEL: define { i64, i1 } @bitcast_trivial_optional(i64, i1) {{.*}} { +// CHECK-x86_64-LABEL: define{{( protected)?}} { i64, i1 } @bitcast_trivial_optional(i64, i1) {{.*}} { // CHECK-x86_64-NEXT: entry: // CHECK-x86_64-NEXT: %2 = insertvalue { i64, i1 } undef, i64 %0, 0 // CHECK-x86_64-NEXT: %3 = insertvalue { i64, i1 } %2, i1 %1, 1 @@ -52,13 +52,13 @@ entry(%c : $Optional): return %i : $ImplicitlyUnwrappedOptional } -// CHECK-i386-LABEL: define i32 @bitcast_ref(%C7bitcast1C*) {{.*}} { +// CHECK-i386-LABEL: define{{( protected)?}} i32 @bitcast_ref(%C7bitcast1C*) {{.*}} { // CHECK-i386-NEXT: entry: // CHECK-i386-NEXT: [[VALUE:%.*]] = ptrtoint %C7bitcast1C* %0 to i32 // CHECK-i386-NEXT: ret i32 [[VALUE]] // CHECK-i386-NEXT: } -// CHECK-x86_64-LABEL: define i64 @bitcast_ref(%C7bitcast1C*) {{.*}} { +// CHECK-x86_64-LABEL: define{{( protected)?}} i64 @bitcast_ref(%C7bitcast1C*) {{.*}} { // CHECK-x86_64-NEXT: entry: // CHECK-x86_64-NEXT: [[VALUE:%.*]] = ptrtoint %C7bitcast1C* %0 to i64 // CHECK-x86_64-NEXT: ret i64 [[VALUE]] @@ -114,7 +114,7 @@ bb0(%0 : $Int, %1 : $Int): return %i3 : $Int } -// CHECK-LABEL: define void @unchecked_ref_cast_addr +// CHECK-LABEL: define{{( protected)?}} void @unchecked_ref_cast_addr // CHECK-i386: call i1 @swift_dynamicCast(%swift.opaque* %0, %swift.opaque* %{{.*}}, %swift.type* %T, %swift.type* %U, i32 7) // CHECK-x86_64: call i1 @swift_dynamicCast(%swift.opaque* %0, %swift.opaque* %{{.*}}, %swift.type* %T, %swift.type* %U, i64 7) sil @unchecked_ref_cast_addr : $@convention(thin) (@out U, @in T) -> () { @@ -128,11 +128,11 @@ bb0(%0 : $*U, %1 : $*T): return %r : $() } -// CHECK-i386-LABEL: define i32 @unchecked_ref_cast_class_optional +// CHECK-i386-LABEL: define{{( protected)?}} i32 @unchecked_ref_cast_class_optional // CHECK-i386: ptrtoint %C7bitcast1A* %0 to i32 // CHECK-i386-NEXT: ret i32 -// CHECK-x86_64-LABEL: define i64 @unchecked_ref_cast_class_optional +// CHECK-x86_64-LABEL: define{{( protected)?}} i64 @unchecked_ref_cast_class_optional // CHECK-x86_64: ptrtoint %C7bitcast1A* %0 to i64 // CHECK-x86_64-NEXT: ret i64 sil @unchecked_ref_cast_class_optional : $@convention(thin) (@owned A) -> @owned Optional { @@ -141,10 +141,10 @@ bb0(%0 : $A): return %2 : $Optional } -// CHECK-i386-LABEL: define i32 @unchecked_ref_cast_optional_optional +// CHECK-i386-LABEL: define{{( protected)?}} i32 @unchecked_ref_cast_optional_optional // CHECK-i386: ret i32 %0 -// CHECK-x86_64-LABEL: define i64 @unchecked_ref_cast_optional_optional +// CHECK-x86_64-LABEL: define{{( protected)?}} i64 @unchecked_ref_cast_optional_optional // CHECK-x86_64: ret i64 %0 sil @unchecked_ref_cast_optional_optional : $@convention(thin) (@owned Optional) -> @owned Optional { bb0(%0 : $Optional): @@ -152,11 +152,11 @@ bb0(%0 : $Optional): return %2 : $Optional } -// CHECK-i386-LABEL: define i32 @unchecked_ref_cast_proto_optional +// CHECK-i386-LABEL: define{{( protected)?}} i32 @unchecked_ref_cast_proto_optional // CHECK-i386: ptrtoint {{%objc_object|%swift.refcounted}}* %0 to i32 // CHECK-i386-NEXT: ret i32 -// CHECK-x86_64-LABEL: define i64 @unchecked_ref_cast_proto_optional +// CHECK-x86_64-LABEL: define{{( protected)?}} i64 @unchecked_ref_cast_proto_optional // CHECK-x86_64: ptrtoint {{%objc_object|%swift.refcounted}}* %0 to i64 // CHECK-x86_64-NEXT: ret i64 sil @unchecked_ref_cast_proto_optional : $@convention(thin) (@owned CP) -> @owned Optional { @@ -165,10 +165,10 @@ bb0(%0 : $CP): return %2 : $Optional } -// CHECK-i386-LABEL: define i32 @unchecked_ref_cast_optionalproto_optional +// CHECK-i386-LABEL: define{{( protected)?}} i32 @unchecked_ref_cast_optionalproto_optional // CHECK-i386: ret i32 %0 -// CHECK-x86_64-LABEL: define i64 @unchecked_ref_cast_optionalproto_optional +// CHECK-x86_64-LABEL: define{{( protected)?}} i64 @unchecked_ref_cast_optionalproto_optional // CHECK-x86_64: ret i64 %0 sil @unchecked_ref_cast_optionalproto_optional : $@convention(thin) (@owned Optional) -> @owned Optional { bb0(%0 : $Optional): diff --git a/test/IRGen/bitcast_different_size.sil b/test/IRGen/bitcast_different_size.sil index bdbd8f8a8d8f2..5ea95d6572a98 100644 --- a/test/IRGen/bitcast_different_size.sil +++ b/test/IRGen/bitcast_different_size.sil @@ -6,7 +6,7 @@ sil_stage canonical import Swift -// CHECK-LABEL: define i64 @bitcast_different_size1 +// CHECK-LABEL: define{{( protected)?}} i64 @bitcast_different_size1 sil @bitcast_different_size1 : $@convention(thin) (Int32) -> Int64 { entry(%i : $Int32): diff --git a/test/IRGen/boxed_existential.sil b/test/IRGen/boxed_existential.sil index bbb5d21c02465..b62018263cc6a 100644 --- a/test/IRGen/boxed_existential.sil +++ b/test/IRGen/boxed_existential.sil @@ -2,7 +2,7 @@ import Swift -// CHECK-LABEL: define void @retain_release_boxed_existential(%swift.error*) +// CHECK-LABEL: define{{( protected)?}} void @retain_release_boxed_existential(%swift.error*) sil @retain_release_boxed_existential : $@convention(thin) (ErrorType) -> () { entry(%e : $ErrorType): // CHECK-objc: @swift_errorRetain @@ -14,7 +14,7 @@ entry(%e : $ErrorType): return undef : $() } -// CHECK-LABEL: define %swift.error* @alloc_boxed_existential(%swift.opaque* noalias nocapture, %swift.type* %T, i8** %T.ErrorType) +// CHECK-LABEL: define{{( protected)?}} %swift.error* @alloc_boxed_existential(%swift.opaque* noalias nocapture, %swift.type* %T, i8** %T.ErrorType) sil @alloc_boxed_existential : $@convention(thin) (@in T) -> @owned ErrorType { entry(%x : $*T): // CHECK: [[BOX_PAIR:%.*]] = call { %swift.error*, %swift.opaque* } @swift_allocError(%swift.type* %T, i8** %T.ErrorType, %swift.opaque* null, i1 false) @@ -33,7 +33,7 @@ struct SomeError: ErrorType { let _code: Int } -// CHECK-LABEL: define %swift.error* @alloc_boxed_existential_concrete +// CHECK-LABEL: define{{( protected)?}} %swift.error* @alloc_boxed_existential_concrete sil @alloc_boxed_existential_concrete : $@convention(thin) (@owned SomeError) -> @owned ErrorType { entry(%x : $SomeError): // CHECK: [[BOX_PAIR:%.*]] = call { %swift.error*, %swift.opaque* } @swift_allocError(%swift.type* {{.*}} @_TMfV17boxed_existential9SomeError, {{.*}}, i8** @_TWPV17boxed_existential9SomeErrors9ErrorTypeS_, %swift.opaque* null, i1 false) @@ -47,7 +47,7 @@ entry(%x : $SomeError): return %b : $ErrorType } -// CHECK-LABEL: define void @dealloc_boxed_existential(%swift.error*, %swift.type* %T, i8** %T.ErrorType) +// CHECK-LABEL: define{{( protected)?}} void @dealloc_boxed_existential(%swift.error*, %swift.type* %T, i8** %T.ErrorType) sil @dealloc_boxed_existential : $@convention(thin) (@owned ErrorType) -> () { entry(%b : $ErrorType): // CHECK: call void @swift_deallocError(%swift.error* %0, %swift.type* %T) @@ -55,7 +55,7 @@ entry(%b : $ErrorType): return undef : $() } -// CHECK-LABEL: define {{i[0-9]+}} @project_boxed_existential(%swift.error*) +// CHECK-LABEL: define{{( protected)?}} {{i[0-9]+}} @project_boxed_existential(%swift.error*) sil @project_boxed_existential : $@convention(thin) (@owned ErrorType) -> Int { entry(%b : $ErrorType): // CHECK: call void @swift_getErrorValue(%swift.error* %0, i8** {{%.*}}, [[TRIPLE:{ %swift.opaque\*, %swift.type\*, i8\*\* }]]* [[OUT:%.*]]) @@ -75,7 +75,7 @@ entry(%b : $ErrorType): return %l : $Int } -// CHECK-LABEL: define {{i[0-9]+}} @open_boxed_existential(%swift.error*) +// CHECK-LABEL: define{{( protected)?}} {{i[0-9]+}} @open_boxed_existential(%swift.error*) sil @open_boxed_existential : $@convention(thin) (@owned ErrorType) -> Int { entry(%b : $ErrorType): // CHECK: call void @swift_getErrorValue(%swift.error* %0, i8** {{%.*}}, [[TRIPLE:{ %swift.opaque\*, %swift.type\*, i8\*\* }]]* [[OUT:%.*]]) diff --git a/test/IRGen/bridge_object.sil b/test/IRGen/bridge_object.sil index a903e4471587c..ac4d37aad4342 100644 --- a/test/IRGen/bridge_object.sil +++ b/test/IRGen/bridge_object.sil @@ -11,7 +11,7 @@ sil_vtable C {} @objc protocol ObjC {} -// X86_64-LABEL: define void @retain_release_bridge_object +// X86_64-LABEL: define{{( protected)?}} void @retain_release_bridge_object // X86_64: call [[BRIDGE:%swift.bridge\*]] @swift_bridgeObjectRetain // X86_64: call void @swift_bridgeObjectRelease sil @retain_release_bridge_object : $(Builtin.BridgeObject) -> () { @@ -21,7 +21,7 @@ entry(%b : $Builtin.BridgeObject): return undef : $() } -// X86_64-LABEL: define %swift.bridge* @convert_to_bridge_object +// X86_64-LABEL: define{{( protected)?}} %swift.bridge* @convert_to_bridge_object // X86_64: [[REFBITS:%.*]] = ptrtoint [[C:%C13bridge_object1C\*]] %0 to i64 // X86_64: [[OR:%.*]] = or i64 [[REFBITS]], %1 // X86_64: inttoptr i64 [[OR]] to [[BRIDGE]] @@ -31,7 +31,7 @@ entry(%c : $C, %w : $Builtin.Word): return %b : $Builtin.BridgeObject } -// X86_64-LABEL: define { %objc_object*, i64 } @convert_from_bridge_object +// X86_64-LABEL: define{{( protected)?}} { %objc_object*, i64 } @convert_from_bridge_object // X86_64: [[BOBITS:%.*]] = ptrtoint [[BRIDGE]] %0 to i64 // -- 0x8000_0000_0000_0001 // X86_64: [[TAGBITS:%.*]] = and i64 [[BOBITS]], -9223372036854775807 @@ -48,7 +48,7 @@ entry(%c : $C, %w : $Builtin.Word): // X86_64: tagged-cont: // X86_64: phi [[C]] [ [[TAGGED_RESULT]], %tagged-pointer ], [ [[MASKED_RESULT]], %not-tagged-pointer ] -// ARM64-LABEL: define { %objc_object*, i64 } @convert_from_bridge_object +// ARM64-LABEL: define{{( protected)?}} { %objc_object*, i64 } @convert_from_bridge_object // ARM64: [[BOBITS:%.*]] = ptrtoint [[BRIDGE:%swift.bridge\*]] %0 to i64 // -- 0x8000_0000_0000_0000 // ARM64: [[TAGBITS:%.*]] = and i64 [[BOBITS]], -9223372036854775808 @@ -65,7 +65,7 @@ entry(%c : $C, %w : $Builtin.Word): // ARM64: tagged-cont: // ARM64: phi [[C]] [ [[TAGGED_RESULT]], %tagged-pointer ], [ [[MASKED_RESULT]], %not-tagged-pointer ] -// ARMV7-LABEL: define { %objc_object*, i32 } @convert_from_bridge_object +// ARMV7-LABEL: define{{( protected)?}} { %objc_object*, i32 } @convert_from_bridge_object // ARMV7: [[BOBITS:%.*]] = ptrtoint [[BRIDGE:%swift.bridge\*]] %0 to i32 // ARMV7: [[MASKED_BITS:%.*]] = and i32 [[BOBITS]], -4 // ARMV7: inttoptr i32 [[MASKED_BITS]] to [[C:%objc_object\*]] @@ -77,7 +77,7 @@ entry(%b : $Builtin.BridgeObject): return %t : $(ObjC, Builtin.Word) } -// X86_64-LABEL: define %C13bridge_object1C* @convert_from_native_bridge_object +// X86_64-LABEL: define{{( protected)?}} %C13bridge_object1C* @convert_from_native_bridge_object // X86_64: [[BOBITS:%.*]] = ptrtoint %swift.bridge* %0 to i64 // X86_64: [[MASKED_BITS:%.*]] = and i64 [[BOBITS]], 72057594037927928 // X86_64: [[RESULT:%.*]] = inttoptr i64 [[MASKED_BITS]] to [[C:%C13bridge_object1C\*]] diff --git a/test/IRGen/builtin_word.sil b/test/IRGen/builtin_word.sil index 816a2274d42c1..7516adc0968a3 100644 --- a/test/IRGen/builtin_word.sil +++ b/test/IRGen/builtin_word.sil @@ -6,11 +6,11 @@ sil_stage canonical import Builtin -// INTEL: define i64 @word_literal() {{.*}} { +// INTEL: define{{( protected)?}} i64 @word_literal() {{.*}} { // INTEL: entry: // INTEL: ret i64 12345 // INTEL: } -// ARM32: define i32 @word_literal() {{.*}} { +// ARM32: define{{( protected)?}} i32 @word_literal() {{.*}} { // ARM32: entry: // ARM32: ret i32 12345 // ARM32: } @@ -20,14 +20,14 @@ entry: return %w : $Builtin.Word } -// INTEL: define { i64, i64 } @word_zextOrBitCast(i32, i64) {{.*}} { +// INTEL: define{{( protected)?}} { i64, i64 } @word_zextOrBitCast(i32, i64) {{.*}} { // INTEL: entry: // INTEL: %2 = zext i32 %0 to i64 // INTEL: %3 = insertvalue { i64, i64 } undef, i64 %2, 0 // INTEL: %4 = insertvalue { i64, i64 } %3, i64 %1, 1 // INTEL: ret { i64, i64 } %4 // INTEL: } -// ARM32: define { i32, i64 } @word_zextOrBitCast(i32, i32) {{.*}} { +// ARM32: define{{( protected)?}} { i32, i64 } @word_zextOrBitCast(i32, i32) {{.*}} { // ARM32: entry: // ARM32: %2 = zext i32 %1 to i64 // ARM32: %3 = insertvalue { i32, i64 } undef, i32 %0, 0 @@ -42,14 +42,14 @@ entry(%i : $Builtin.Int32, %w : $Builtin.Word): return %t : $(Builtin.Word, Builtin.Int64) } -// INTEL: define { i32, i64 } @word_truncOrBitCast(i64, i64) {{.*}} { +// INTEL: define{{( protected)?}} { i32, i64 } @word_truncOrBitCast(i64, i64) {{.*}} { // INTEL: entry: // INTEL: %2 = trunc i64 %0 to i32 // INTEL: %3 = insertvalue { i32, i64 } undef, i32 %2, 0 // INTEL: %4 = insertvalue { i32, i64 } %3, i64 %1, 1 // INTEL: ret { i32, i64 } %4 // INTEL: } -// ARM32: define { i32, i32 } @word_truncOrBitCast(i32, i64) {{.*}} { +// ARM32: define{{( protected)?}} { i32, i32 } @word_truncOrBitCast(i32, i64) {{.*}} { // ARM32: entry: // ARM32: %2 = trunc i64 %1 to i32 // ARM32: %3 = insertvalue { i32, i32 } undef, i32 %0, 0 diff --git a/test/IRGen/c_function_pointer.sil b/test/IRGen/c_function_pointer.sil index b703fa8630322..492cfc0eb3f9e 100644 --- a/test/IRGen/c_function_pointer.sil +++ b/test/IRGen/c_function_pointer.sil @@ -2,13 +2,13 @@ import Swift -// CHECK-LABEL: define void @c_native_function_pointer(void ()*) +// CHECK-LABEL: define{{( protected)?}} void @c_native_function_pointer(void ()*) sil @c_native_function_pointer : $@convention(c) (@convention(c) () -> ()) -> () { entry(%f : $@convention(c) () -> ()): return undef : $() } -// CHECK-LABEL: define void @call_with_native_c_function_pointer(i8*) +// CHECK-LABEL: define{{( protected)?}} void @call_with_native_c_function_pointer(i8*) sil @call_with_native_c_function_pointer : $@convention(thin) (@convention(c) () -> ()) -> () { entry(%f : $@convention(c) () -> ()): %c = function_ref @c_native_function_pointer : $@convention(c) (@convention(c) () -> ()) -> () @@ -16,7 +16,7 @@ entry(%f : $@convention(c) () -> ()): return %z : $() } -// CHECK-LABEL: define %swift.type* @c_function_pointer_metadata() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @c_function_pointer_metadata() sil @c_function_pointer_metadata : $@convention(thin) () -> @thick Any.Type { entry: // CHECK: call %swift.type* @_TMacT_T_() diff --git a/test/IRGen/c_layout.sil b/test/IRGen/c_layout.sil index 24e6b7d4ee9ff..e6a333b9e009b 100644 --- a/test/IRGen/c_layout.sil +++ b/test/IRGen/c_layout.sil @@ -27,7 +27,7 @@ bb0: %r = tuple () return %r : $() } -// CHECK-x86_64: define void @test0() +// CHECK-x86_64: define{{( protected)?}} void @test0() // CHECK-x86_64: [[RESULT:%.*]] = alloca %VSC11BitfieldOne, align 8 // CHECK-x86_64: [[ARG:%.*]] = alloca %VSC11BitfieldOne, align 8 // Make the first call and pull all the values out of the indirect result. @@ -106,7 +106,7 @@ bb0: sil public_external @createSIMDStruct : $@convention(c) () -> SIMDStruct sil public_external @consumeSIMDStruct : $@convention(c) SIMDStruct -> () -// CHECK-x86_64-LABEL: define void @testSIMDStruct() +// CHECK-x86_64-LABEL: define{{( protected)?}} void @testSIMDStruct() // CHECK-x86_64: call <3 x float> @createSIMDStruct // CHECK-x86_64: call void @consumeSIMDStruct(<3 x float> sil @testSIMDStruct : $() -> () { @@ -125,7 +125,7 @@ bb0: return %s : $Builtin.Word } -// CHECK-x86_64-LABEL: define void @testIntegerExtension +// CHECK-x86_64-LABEL: define{{( protected)?}} void @testIntegerExtension // CHECK-x86_64: call signext i8 @chareth(i8 signext %0) // CHECK-x86_64: call signext i8 @signedChareth(i8 signext %1) // CHECK-x86_64: call zeroext i8 @unsignedChareth(i8 zeroext %2) @@ -141,7 +141,7 @@ bb0: // CHECK-x86_64-LABEL: declare i32 @ints(i32) // CHECK-x86_64-LABEL: declare i32 @unsigneds(i32) -// CHECK-i386-LABEL: define void @testIntegerExtension +// CHECK-i386-LABEL: define{{( protected)?}} void @testIntegerExtension // CHECK-i386: call signext i8 @chareth(i8 signext %0) // CHECK-i386: call signext i8 @signedChareth(i8 signext %1) // CHECK-i386: call zeroext i8 @unsignedChareth(i8 zeroext %2) @@ -157,7 +157,7 @@ bb0: // CHECK-i386-LABEL: declare i32 @ints(i32) // CHECK-i386-LABEL: declare i32 @unsigneds(i32) -// CHECK-armv7-LABEL: define void @testIntegerExtension +// CHECK-armv7-LABEL: define{{( protected)?}} void @testIntegerExtension // CHECK-armv7: call signext i8 @chareth(i8 signext %0) // CHECK-armv7: call signext i8 @signedChareth(i8 signext %1) // CHECK-armv7: call zeroext i8 @unsignedChareth(i8 zeroext %2) @@ -173,7 +173,7 @@ bb0: // CHECK-armv7-LABEL: declare i32 @ints(i32) // CHECK-armv7-LABEL: declare i32 @unsigneds(i32) -// CHECK-armv7k-LABEL: define void @testIntegerExtension +// CHECK-armv7k-LABEL: define{{( protected)?}} void @testIntegerExtension // CHECK-armv7k: call signext i8 @chareth(i8 signext %0) // CHECK-armv7k: call signext i8 @signedChareth(i8 signext %1) // CHECK-armv7k: call zeroext i8 @unsignedChareth(i8 zeroext %2) @@ -189,7 +189,7 @@ bb0: // CHECK-armv7k-LABEL: declare i32 @ints(i32) // CHECK-armv7k-LABEL: declare i32 @unsigneds(i32) -// CHECK-arm64-LABEL: define void @testIntegerExtension +// CHECK-arm64-LABEL: define{{( protected)?}} void @testIntegerExtension // CHECK-arm64: call signext i8 @chareth(i8 signext %0) // CHECK-arm64: call signext i8 @signedChareth(i8 signext %1) // CHECK-arm64: call zeroext i8 @unsignedChareth(i8 zeroext %2) @@ -231,7 +231,7 @@ entry(%a : $CChar, %b : $CSignedChar, %c : $CUnsignedChar, %d : $CShort, %e : $C return undef : $() } -// CHECK-x86_64-LABEL: define i8 @testIntegerExtensionInBlock(%objc_block*, i8) +// CHECK-x86_64-LABEL: define{{( protected)?}} i8 @testIntegerExtensionInBlock(%objc_block*, i8) sil @testIntegerExtensionInBlock : $@convention(thin) (@owned @convention(block) (CChar) -> CChar, CChar) -> CChar { entry(%b : $@convention(block) (CChar) -> CChar, %c : $CChar): // CHECK-x86_64: call signext i8 {{%.*}}(%objc_block* {{%.*}}, i8 signext {{%.*}}) @@ -239,7 +239,7 @@ entry(%b : $@convention(block) (CChar) -> CChar, %c : $CChar): return %r : $CChar } -// CHECK-x86_64-LABEL: define void @testBitfieldInBlock +// CHECK-x86_64-LABEL: define{{( protected)?}} void @testBitfieldInBlock // CHECK-x86_64: call void {{%.*}}(%VSC11BitfieldOne* noalias nocapture sret {{%.*}}, %objc_block* {{%.*}}, %VSC11BitfieldOne* byval align 8 {{%.*}}) sil @testBitfieldInBlock : $@convention(thin) (@owned @convention(block) (BitfieldOne) -> BitfieldOne, BitfieldOne) -> BitfieldOne { entry(%b : $@convention(block) (BitfieldOne) -> BitfieldOne, %x : $BitfieldOne): diff --git a/test/IRGen/casts.sil b/test/IRGen/casts.sil index 79c7fe36fdf2d..694e59f0466ef 100644 --- a/test/IRGen/casts.sil +++ b/test/IRGen/casts.sil @@ -16,7 +16,7 @@ class B: A {} sil_vtable A {} sil_vtable B {} -// CHECK-LABEL: define %C5casts1B* @unchecked_addr_cast(%C5casts1A** noalias nocapture dereferenceable({{.*}})) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} %C5casts1B* @unchecked_addr_cast(%C5casts1A** noalias nocapture dereferenceable({{.*}})) {{.*}} { // CHECK: bitcast %C5casts1A** %0 to %C5casts1B** sil @unchecked_addr_cast : $(@in A) -> B { entry(%a : $*A): @@ -29,7 +29,7 @@ protocol CP: class {} protocol CP2: class {} @objc protocol OP: class {} -// CHECK-LABEL: define i8* @ref_to_raw_pointer_existential(%objc_object*, i8**) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} i8* @ref_to_raw_pointer_existential(%objc_object*, i8**) {{.*}} { // CHECK: [[CAST:%.*]] = bitcast %objc_object* %0 to i8* // CHECK: ret i8* [[CAST]] sil @ref_to_raw_pointer_existential : $@convention(thin) (@owned CP) -> Builtin.RawPointer { @@ -38,7 +38,7 @@ entry(%p : $CP): return %r : $Builtin.RawPointer } -// CHECK-LABEL: define %objc_object* @raw_pointer_to_ref_existential(i8*) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} %objc_object* @raw_pointer_to_ref_existential(i8*) {{.*}} { // CHECK: [[CAST:%.*]] = bitcast i8* %0 to %objc_object* // CHECK: ret %objc_object* [[CAST]] sil @raw_pointer_to_ref_existential : $@convention(thin) (@owned Builtin.RawPointer) -> AnyObject { @@ -53,9 +53,9 @@ entry(%n : $Builtin.NativeObject): return %r : $AnyObject } -// CHECK-LABEL: define { %objc_object*, i8** } @u_cast_to_class_existential(%objc_object*) +// CHECK-LABEL: define{{( protected)?}} { %objc_object*, i8** } @u_cast_to_class_existential(%objc_object*) // CHECK: call { i8*, i8** } @dynamic_cast_existential_1_unconditional(i8* {{%.*}}, %swift.type* {{%.*}}, %swift.protocol* @_TMp5casts2CP) -// CHECK-LABEL: define private { i8*, i8** } @dynamic_cast_existential_1_unconditional(i8*, %swift.type*, %swift.protocol*) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} private { i8*, i8** } @dynamic_cast_existential_1_unconditional(i8*, %swift.type*, %swift.protocol*) {{.*}} { // CHECK: [[WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %1, %swift.protocol* %2) // CHECK: [[IS_NULL:%.*]] = icmp eq i8** [[WITNESS]], null // CHECK: br i1 [[IS_NULL]], label %fail, label %cont @@ -71,7 +71,7 @@ entry(%a : $AnyObject): return %p : $CP } -// CHECK-LABEL: define { %swift.type*, i8** } @u_cast_to_existential_metatype(%swift.type*) +// CHECK-LABEL: define{{( protected)?}} { %swift.type*, i8** } @u_cast_to_existential_metatype(%swift.type*) // CHECK: call { i8*, i8** } @dynamic_cast_existential_1_unconditional(i8* %1, %swift.type* %0, %swift.protocol* @_TMp5casts2CP) sil @u_cast_to_existential_metatype : $@convention(thin) (@owned @thick Any.Type) -> @owned @thick CP.Type { entry(%a : $@thick Any.Type): @@ -79,9 +79,9 @@ entry(%a : $@thick Any.Type): return %p : $@thick CP.Type } -// CHECK-LABEL: define { %objc_object*, i8**, i8** } @u_cast_to_class_existential_2(%objc_object*) +// CHECK-LABEL: define{{( protected)?}} { %objc_object*, i8**, i8** } @u_cast_to_class_existential_2(%objc_object*) // CHECK: call { i8*, i8**, i8** } @dynamic_cast_existential_2_unconditional(i8* {{%.*}}, %swift.type* {{%.*}}, %swift.protocol* @_TMp5casts2CP, %swift.protocol* @_TMp5casts3CP2) -// CHECK-LABEL: define private { i8*, i8**, i8** } @dynamic_cast_existential_2_unconditional(i8*, %swift.type*, %swift.protocol*, %swift.protocol*) +// CHECK-LABEL: define{{( protected)?}} private { i8*, i8**, i8** } @dynamic_cast_existential_2_unconditional(i8*, %swift.type*, %swift.protocol*, %swift.protocol*) // CHECK: [[WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %1, %swift.protocol* %2) // CHECK: [[IS_NULL:%.*]] = icmp eq i8** [[WITNESS]], null // CHECK: br i1 [[IS_NULL]], label %fail, label %cont @@ -99,7 +99,7 @@ entry(%a : $AnyObject): return %p : $protocol } -// CHECK-LABEL: define { %objc_object*, i8**, i8** } @u_cast_to_class_existential_mixed(%objc_object*) +// CHECK-LABEL: define{{( protected)?}} { %objc_object*, i8**, i8** } @u_cast_to_class_existential_mixed(%objc_object*) // CHECK: call %objc_object* @swift_dynamicCastObjCProtocolUnconditional // CHECK: call { i8*, i8**, i8** } @dynamic_cast_existential_2_unconditional(i8* {{%.*}}, %swift.type* {{%.*}}, %swift.protocol* @_TMp5casts2CP, %swift.protocol* @_TMp5casts3CP2) sil @u_cast_to_class_existential_mixed : $@convention(thin) (@owned AnyObject) -> @owned protocol { @@ -108,7 +108,7 @@ entry(%a : $AnyObject): return %p : $protocol } -// CHECK-LABEL: define { %swift.type*, i8**, i8** } @u_cast_to_existential_metatype_mixed(%swift.type*) +// CHECK-LABEL: define{{( protected)?}} { %swift.type*, i8**, i8** } @u_cast_to_existential_metatype_mixed(%swift.type*) // CHECK: call %swift.type* @swift_dynamicCastTypeToObjCProtocolUnconditional(%swift.type* %0, {{(i32|i64)}} 1, i8** {{%.*}}) // CHECK: [[CAST:%.*]] = call { i8*, i8**, i8** } @dynamic_cast_existential_2_unconditional(i8* {{.*}}, %swift.type* %0, %swift.protocol* @_TMp5casts2CP, %swift.protocol* @_TMp5casts3CP2) // CHECK: [[OBJPTR:%.*]] = extractvalue { i8*, i8**, i8** } [[CAST]], 0 @@ -121,9 +121,9 @@ entry(%a : $@thick Any.Type): } -// CHECK-LABEL: define { %objc_object*, i8** } @c_cast_to_class_existential(%objc_object*) +// CHECK-LABEL: define{{( protected)?}} { %objc_object*, i8** } @c_cast_to_class_existential(%objc_object*) // CHECK: call { i8*, i8** } @dynamic_cast_existential_1_conditional(i8* {{.*}}, %swift.type* %.Type, %swift.protocol* @_TMp5casts2CP) -// CHECK-LABEL: define private { i8*, i8** } @dynamic_cast_existential_1_conditional(i8*, %swift.type*, %swift.protocol*) +// CHECK-LABEL: define{{( protected)?}} private { i8*, i8** } @dynamic_cast_existential_1_conditional(i8*, %swift.type*, %swift.protocol*) // CHECK: [[WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %1, %swift.protocol* %2) // CHECK: [[IS_NULL:%.*]] = icmp eq i8** [[WITNESS]], null // CHECK: br i1 [[IS_NULL]], label %fail, label %cont @@ -140,7 +140,7 @@ nay: unreachable } -// CHECK-LABEL: define { %swift.type*, i8** } @c_cast_to_existential_metatype(%swift.type*) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} { %swift.type*, i8** } @c_cast_to_existential_metatype(%swift.type*) {{.*}} { // CHECK: call { i8*, i8** } @dynamic_cast_existential_1_conditional(i8* %1, %swift.type* %0, %swift.protocol* @_TMp5casts2CP) sil @c_cast_to_existential_metatype : $@convention(thin) (@owned @thick Any.Type) -> @owned @thick CP.Type { entry(%a : $@thick Any.Type): @@ -151,9 +151,9 @@ nay: unreachable } -// CHECK-LABEL: define { %objc_object*, i8**, i8** } @c_cast_to_class_existential_2(%objc_object*) +// CHECK-LABEL: define{{( protected)?}} { %objc_object*, i8**, i8** } @c_cast_to_class_existential_2(%objc_object*) // CHECK: call { i8*, i8**, i8** } @dynamic_cast_existential_2_conditional(i8* {{%.*}}, %swift.type* {{%.*}}, %swift.protocol* @_TMp5casts2CP, %swift.protocol* @_TMp5casts3CP2) -// CHECK-LABEL: define private { i8*, i8**, i8** } @dynamic_cast_existential_2_conditional(i8*, %swift.type*, %swift.protocol*, %swift.protocol*) +// CHECK-LABEL: define{{( protected)?}} private { i8*, i8**, i8** } @dynamic_cast_existential_2_conditional(i8*, %swift.type*, %swift.protocol*, %swift.protocol*) // CHECK: [[WITNESS:%.*]] = call i8** @swift_conformsToProtocol(%swift.type* %1, %swift.protocol* %2) // CHECK: [[IS_NULL:%.*]] = icmp eq i8** [[WITNESS]], null // CHECK: br i1 [[IS_NULL]], label %fail, label %cont @@ -174,7 +174,7 @@ nay: unreachable } -// CHECK-LABEL: define { %objc_object*, i8**, i8** } @c_cast_to_class_existential_mixed(%objc_object*) +// CHECK-LABEL: define{{( protected)?}} { %objc_object*, i8**, i8** } @c_cast_to_class_existential_mixed(%objc_object*) // CHECK: [[CAST:%.*]] = call %objc_object* @swift_dynamicCastObjCProtocolConditional // CHECK: [[IS_NULL:%.*]] = icmp eq %objc_object* [[CAST]], null // CHECK: br i1 [[IS_NULL]], label %cont, label %success @@ -192,7 +192,7 @@ nay: unreachable } -// CHECK-LABEL: define { %swift.type*, i8**, i8** } @c_cast_to_existential_metatype_mixed(%swift.type*) +// CHECK-LABEL: define{{( protected)?}} { %swift.type*, i8**, i8** } @c_cast_to_existential_metatype_mixed(%swift.type*) // CHECK: [[OBJC_CAST:%.*]] = call %swift.type* @swift_dynamicCastTypeToObjCProtocolConditional(%swift.type* %0, {{(i32|i64)}} 1, i8** {{%.*}}) // CHECK: [[IS_NULL:%.*]] = icmp eq %swift.type* [[OBJC_CAST]], null // CHECK: br i1 [[IS_NULL]], label %cont, label %success @@ -207,7 +207,7 @@ nay: unreachable } -// CHECK-LABEL: define %objc_object* @checked_upcast(%C5casts1A*) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} %objc_object* @checked_upcast(%C5casts1A*) {{.*}} { // -- Don't need to check conformance of an object to AnyObject. // CHECK-NOT: call %objc_object* @swift_dynamicCastObjCProtocolConditional // CHECK: phi %objc_object* @@ -220,7 +220,7 @@ nay: unreachable } -// CHECK-LABEL: define %C5casts1A* @checked_downcast_optional({{(i32|i64)}}) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} %C5casts1A* @checked_downcast_optional({{(i32|i64)}}) {{.*}} { // CHECK: [[OBJ_PTR:%.*]] = inttoptr {{(i32|i64)}} %0 to i8* // CHECK: [[METADATA:%.*]] = call %swift.type* @_TMaC5casts1A() // CHECK: [[METADATA_PTR:%.*]] = bitcast %swift.type* [[METADATA]] to i8* @@ -237,7 +237,7 @@ nay: unreachable } -// CHECK-LABEL: define void @checked_metatype_to_object_casts +// CHECK-LABEL: define{{( protected)?}} void @checked_metatype_to_object_casts sil @checked_metatype_to_object_casts : $@convention(thin) (@thick Any.Type) -> () { entry(%e : $@thick Any.Type): %a = metatype $@thin NotClass.Type @@ -286,7 +286,7 @@ entry(%x : $OB): return %x : $OB } -// CHECK-LABEL: define %C5casts1B* @checked_object_to_object_casts(%C5casts1A*) +// CHECK-LABEL: define{{( protected)?}} %C5casts1B* @checked_object_to_object_casts(%C5casts1A*) // CHECK: @swift_dynamicCastClassUnconditional sil @checked_object_to_object_casts : $@convention(thin) (A) -> B { entry(%a : $A): @@ -294,7 +294,7 @@ entry(%a : $A): return %b : $B } -// CHECK-LABEL: define %C5casts2OB* @checked_objc_object_to_object_casts(%C5casts2OA*) +// CHECK-LABEL: define{{( protected)?}} %C5casts2OB* @checked_objc_object_to_object_casts(%C5casts2OA*) // CHECK: @swift_dynamicCastClassUnconditional sil @checked_objc_object_to_object_casts : $@convention(thin) (OA) -> OB { entry(%a : $OA): diff --git a/test/IRGen/cf.sil b/test/IRGen/cf.sil index db19b9b8d70b5..b3d2fc4a71cba 100644 --- a/test/IRGen/cf.sil +++ b/test/IRGen/cf.sil @@ -28,7 +28,7 @@ bb0(%0 : $CCRefrigerator): return %3 : $() } -// CHECK: define void @call_generic([[REFRIGERATOR]]*) {{.*}} { +// CHECK: define{{( protected)?}} void @call_generic([[REFRIGERATOR]]*) {{.*}} { // CHECK: [[T0:%.*]] = bitcast [[REFRIGERATOR]]* %0 to [[OBJC]]* // CHECK-NEXT: [[T1:%.*]] = call [[TYPE]]* @_TMaCSo14CCRefrigerator() // CHECK-NEXT: call void @generic_function([[OBJC]]* [[T0]], [[TYPE]]* [[T1]]) diff --git a/test/IRGen/class.sil b/test/IRGen/class.sil index 6ba0134b5fa3a..243487654efb2 100644 --- a/test/IRGen/class.sil +++ b/test/IRGen/class.sil @@ -44,7 +44,7 @@ sil_vtable C {} // \ CHECK: }> // Destroying destructor -// CHECK: define [[REF]]* @_TFC5class1Cd([[C_CLASS]]*) {{.*}} { +// CHECK: define{{( protected)?}} [[REF]]* @_TFC5class1Cd([[C_CLASS]]*) {{.*}} { // CHECK-NEXT: entry: // CHECK-NEXT: [[OBJ_PTR:%[a-zA-Z0-9]+]] = bitcast [[C_CLASS]]* %0 to [[REF]]* // CHECK-NEXT: ret [[REF]]* [[OBJ_PTR]] @@ -55,7 +55,7 @@ bb0(%0 : $C): } // Deallocating destructor -// CHECK: define void @_TFC5class1CD([[C_CLASS]]*) +// CHECK: define{{( protected)?}} void @_TFC5class1CD([[C_CLASS]]*) sil @_TFC5class1CD : $@convention(method) (@owned C) -> () { bb0(%0 : $C): // CHECK-NEXT: entry @@ -72,7 +72,7 @@ bb0(%0 : $C): return %5 : $() // id: %6 } -// CHECK: define [[REF]]* @unchecked_ref_cast_cast([[C_CLASS]]*) +// CHECK: define{{( protected)?}} [[REF]]* @unchecked_ref_cast_cast([[C_CLASS]]*) // CHECK: bitcast [[C_CLASS]]* {{%.*}} to [[REF]]* sil @unchecked_ref_cast_cast : $@convention(thin) C -> Builtin.NativeObject { entry(%c : $C): @@ -80,7 +80,7 @@ entry(%c : $C): return %r : $Builtin.NativeObject } -// CHECK: define [[OBJCOBJ]]* @ref_to_objc_pointer_cast([[C_CLASS]]*) +// CHECK: define{{( protected)?}} [[OBJCOBJ]]* @ref_to_objc_pointer_cast([[C_CLASS]]*) // CHECK: bitcast [[C_CLASS]]* %0 to [[OBJCOBJ]]* sil @ref_to_objc_pointer_cast : $@convention(thin) C -> Builtin.UnknownObject { entry(%c : $C): @@ -88,7 +88,7 @@ entry(%c : $C): return %r : $Builtin.UnknownObject } -// CHECK-LABEL: define %C5class1C* @alloc_ref_dynamic(%swift.type*) +// CHECK-LABEL: define{{( protected)?}} %C5class1C* @alloc_ref_dynamic(%swift.type*) sil @alloc_ref_dynamic : $@convention(thin) (@thick C.Type) -> @owned C { bb0(%0 : $@thick C.Type): // CHECK: [[META_PTR:%[0-9]+]] = bitcast %swift.type* %0 to i8* @@ -105,7 +105,7 @@ bb0(%0 : $@thick C.Type): return %1 : $C } -// CHECK-LABEL: define %C5class1C* @autorelease(%C5class1C*) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} %C5class1C* @autorelease(%C5class1C*) {{.*}} { // CHECK: %1 = bitcast %C5class1C* %0 to %objc_object* // CHECK: call %objc_object* @objc_autorelease(%objc_object* %1) // CHECK: ret %C5class1C* %0 @@ -115,7 +115,7 @@ entry(%c : $C): return %c : $C } -// CHECK-LABEL: define i64 @autorelease_optional(i64) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} i64 @autorelease_optional(i64) {{.*}} { // CHECK: %1 = inttoptr i64 %0 to %objc_object* // CHECK: call %objc_object* @objc_autorelease(%objc_object* %1) // CHECK: ret i64 %0 @@ -163,7 +163,7 @@ entry(%x : $ClassConstrainedGenericField): %b = load %a : $*ClassConstraintConformance return %b : $ClassConstraintConformance } -// CHECK-LABEL: define %C5class26ClassConstraintConformance* @fixed_class_generic_field(%C5class28ClassConstrainedGenericField*) +// CHECK-LABEL: define{{( protected)?}} %C5class26ClassConstraintConformance* @fixed_class_generic_field(%C5class28ClassConstrainedGenericField*) // CHECK: [[FIELD_ADDR_GENERIC:%.*]] = getelementptr inbounds %C5class28ClassConstrainedGenericField, %C5class28ClassConstrainedGenericField* %0, i32 0, i32 1 // CHECK: [[FIELD_ADDR_CONCRETE:%.*]] = bitcast %objc_object** [[FIELD_ADDR_GENERIC]] to %C5class26ClassConstraintConformance** // CHECK: load %C5class26ClassConstraintConformance*, %C5class26ClassConstraintConformance** [[FIELD_ADDR_CONCRETE]] diff --git a/test/IRGen/class_isa_pointers.sil b/test/IRGen/class_isa_pointers.sil index 7adaee815f190..911033ec8ffb8 100644 --- a/test/IRGen/class_isa_pointers.sil +++ b/test/IRGen/class_isa_pointers.sil @@ -17,7 +17,7 @@ class Purebred { } sil_vtable Purebred {} -// CHECK-LABEL: define void @purebred_method(%C18class_isa_pointers8Purebred*) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @purebred_method(%C18class_isa_pointers8Purebred*) {{.*}} { // CHECK: [[ISA_PTR:%.*]] = bitcast %C18class_isa_pointers8Purebred* %0 to %swift.type** // CHECK: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_PTR]] // CHECK: [[VTABLE:%.*]] = bitcast %swift.type* [[ISA]] @@ -38,7 +38,7 @@ class Mongrel: Gizmo { } sil_vtable Mongrel {} -// CHECK-LABEL: define void @mongrel_method(%C18class_isa_pointers7Mongrel*) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @mongrel_method(%C18class_isa_pointers7Mongrel*) {{.*}} { // CHECK: [[T0:%.*]] = bitcast {{.*}} %0 to i64* // CHECK-NEXT: [[T1:%.*]] = load i64, i64* [[T0]], align 8 // CHECK-NEXT: [[T2:%.*]] = load i64, i64* @swift_isaMask, align 8 diff --git a/test/IRGen/class_resilience.swift b/test/IRGen/class_resilience.swift index 68685743758d3..e0e49ad1a7c78 100644 --- a/test/IRGen/class_resilience.swift +++ b/test/IRGen/class_resilience.swift @@ -3,20 +3,20 @@ // CHECK: %swift.type = type { [[INT:i32|i64]] } -// CHECK: @_TWvdvC16class_resilience26ClassWithResilientProperty1sV16resilient_struct4Size = global [[INT]] 0 -// CHECK: @_TWvdvC16class_resilience26ClassWithResilientProperty5colorVs5Int32 = global [[INT]] 0 +// CHECK: @_TWvdvC16class_resilience26ClassWithResilientProperty1sV16resilient_struct4Size = {{(protected )?}}global [[INT]] 0 +// CHECK: @_TWvdvC16class_resilience26ClassWithResilientProperty5colorVs5Int32 = {{(protected )?}}global [[INT]] 0 -// CHECK: @_TWvdvC16class_resilience33ClassWithResilientlySizedProperty1rV16resilient_struct9Rectangle = global [[INT]] 0 -// CHECK: @_TWvdvC16class_resilience33ClassWithResilientlySizedProperty5colorVs5Int32 = global [[INT]] 0 +// CHECK: @_TWvdvC16class_resilience33ClassWithResilientlySizedProperty1rV16resilient_struct9Rectangle = {{(protected )?}}global [[INT]] 0 +// CHECK: @_TWvdvC16class_resilience33ClassWithResilientlySizedProperty5colorVs5Int32 = {{(protected )?}}global [[INT]] 0 -// CHECK: @_TWvdvC16class_resilience14ResilientChild5fieldVs5Int32 = global [[INT]] {{12|16}} -// CHECK: @_TWvivC16class_resilience21ResilientGenericChild5fieldVs5Int32 = global [[INT]] {{56|88}} +// CHECK: @_TWvdvC16class_resilience14ResilientChild5fieldVs5Int32 = {{(protected )?}}global [[INT]] {{12|16}} +// CHECK: @_TWvivC16class_resilience21ResilientGenericChild5fieldVs5Int32 = {{(protected )?}}global [[INT]] {{56|88}} -// CHECK: @_TWvdvC16class_resilience28ClassWithMyResilientProperty1rVS_17MyResilientStruct = constant [[INT]] {{12|16}} -// CHECK: @_TWvdvC16class_resilience28ClassWithMyResilientProperty5colorVs5Int32 = constant [[INT]] {{16|20}} +// CHECK: @_TWvdvC16class_resilience28ClassWithMyResilientProperty1rVS_17MyResilientStruct = {{(protected )?}}constant [[INT]] {{12|16}} +// CHECK: @_TWvdvC16class_resilience28ClassWithMyResilientProperty5colorVs5Int32 = {{(protected )?}}constant [[INT]] {{16|20}} -// CHECK: @_TWvdvC16class_resilience30ClassWithIndirectResilientEnum1sO14resilient_enum10FunnyShape = constant [[INT]] {{12|16}} -// CHECK: @_TWvdvC16class_resilience30ClassWithIndirectResilientEnum5colorVs5Int32 = constant [[INT]] {{16|24}} +// CHECK: @_TWvdvC16class_resilience30ClassWithIndirectResilientEnum1sO14resilient_enum10FunnyShape = {{(protected )?}}constant [[INT]] {{12|16}} +// CHECK: @_TWvdvC16class_resilience30ClassWithIndirectResilientEnum5colorVs5Int32 = {{(protected )?}}constant [[INT]] {{16|24}} import resilient_class import resilient_struct @@ -113,7 +113,7 @@ public class MyResilientChild : MyResilientParent { // ClassWithResilientProperty metadata accessor -// CHECK-LABEL: define %swift.type* @_TMaC16class_resilience26ClassWithResilientProperty() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @_TMaC16class_resilience26ClassWithResilientProperty() // CHECK: [[CACHE:%.*]] = load %swift.type*, %swift.type** @_TMLC16class_resilience26ClassWithResilientProperty // CHECK-NEXT: [[COND:%.*]] = icmp eq %swift.type* [[CACHE]], null // CHECK-NEXT: br i1 [[COND]], label %cacheIsNull, label %cont @@ -130,7 +130,7 @@ public class MyResilientChild : MyResilientParent { // ClassWithResilientProperty.color getter -// CHECK-LABEL: define i32 @_TFC16class_resilience26ClassWithResilientPropertyg5colorVs5Int32(%C16class_resilience26ClassWithResilientProperty*) +// CHECK-LABEL: define{{( protected)?}} i32 @_TFC16class_resilience26ClassWithResilientPropertyg5colorVs5Int32(%C16class_resilience26ClassWithResilientProperty*) // CHECK: [[OFFSET:%.*]] = load [[INT]], [[INT]]* @_TWvdvC16class_resilience26ClassWithResilientProperty5colorVs5Int32 // CHECK-NEXT: [[PTR:%.*]] = bitcast %C16class_resilience26ClassWithResilientProperty* %0 to i8* // CHECK-NEXT: [[FIELD_ADDR:%.*]] = getelementptr inbounds i8, i8* [[PTR]], [[INT]] [[OFFSET]] @@ -142,7 +142,7 @@ public class MyResilientChild : MyResilientParent { // ClassWithResilientlySizedProperty metadata accessor -// CHECK-LABEL: define %swift.type* @_TMaC16class_resilience33ClassWithResilientlySizedProperty() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @_TMaC16class_resilience33ClassWithResilientlySizedProperty() // CHECK: [[CACHE:%.*]] = load %swift.type*, %swift.type** @_TMLC16class_resilience33ClassWithResilientlySizedProperty // CHECK-NEXT: [[COND:%.*]] = icmp eq %swift.type* [[CACHE]], null // CHECK-NEXT: br i1 [[COND]], label %cacheIsNull, label %cont @@ -159,7 +159,7 @@ public class MyResilientChild : MyResilientParent { // ClassWithResilientlySizedProperty.color getter -// CHECK-LABEL: define i32 @_TFC16class_resilience33ClassWithResilientlySizedPropertyg5colorVs5Int32(%C16class_resilience33ClassWithResilientlySizedProperty*) +// CHECK-LABEL: define{{( protected)?}} i32 @_TFC16class_resilience33ClassWithResilientlySizedPropertyg5colorVs5Int32(%C16class_resilience33ClassWithResilientlySizedProperty*) // CHECK: [[OFFSET:%.*]] = load [[INT]], [[INT]]* @_TWvdvC16class_resilience33ClassWithResilientlySizedProperty5colorVs5Int32 // CHECK-NEXT: [[PTR:%.*]] = bitcast %C16class_resilience33ClassWithResilientlySizedProperty* %0 to i8* // CHECK-NEXT: [[FIELD_ADDR:%.*]] = getelementptr inbounds i8, i8* [[PTR]], [[INT]] [[OFFSET]] @@ -171,7 +171,7 @@ public class MyResilientChild : MyResilientParent { // ClassWithIndirectResilientEnum.color getter -// CHECK-LABEL: define i32 @_TFC16class_resilience30ClassWithIndirectResilientEnumg5colorVs5Int32(%C16class_resilience30ClassWithIndirectResilientEnum*) +// CHECK-LABEL: define{{( protected)?}} i32 @_TFC16class_resilience30ClassWithIndirectResilientEnumg5colorVs5Int32(%C16class_resilience30ClassWithIndirectResilientEnum*) // CHECK: [[FIELD_PTR:%.*]] = getelementptr inbounds %C16class_resilience30ClassWithIndirectResilientEnum, %C16class_resilience30ClassWithIndirectResilientEnum* %0, i32 0, i32 2 // CHECK-NEXT: [[FIELD_PAYLOAD:%.*]] = getelementptr inbounds %Vs5Int32, %Vs5Int32* [[FIELD_PTR]], i32 0, i32 0 // CHECK-NEXT: [[FIELD_VALUE:%.*]] = load i32, i32* [[FIELD_PAYLOAD]] @@ -180,7 +180,7 @@ public class MyResilientChild : MyResilientParent { // ResilientChild.field getter -// CHECK-LABEL: define i32 @_TFC16class_resilience14ResilientChildg5fieldVs5Int32(%C16class_resilience14ResilientChild*) +// CHECK-LABEL: define{{( protected)?}} i32 @_TFC16class_resilience14ResilientChildg5fieldVs5Int32(%C16class_resilience14ResilientChild*) // CHECK: [[OFFSET:%.*]] = load [[INT]], [[INT]]* @_TWvdvC16class_resilience14ResilientChild5fieldVs5Int32 // CHECK-NEXT: [[PTR:%.*]] = bitcast %C16class_resilience14ResilientChild* %0 to i8* // CHECK-NEXT: [[FIELD_ADDR:%.*]] = getelementptr inbounds i8, i8* [[PTR]], [[INT]] [[OFFSET]] @@ -193,7 +193,7 @@ public class MyResilientChild : MyResilientParent { // ResilientGenericChild.field getter -// CHECK-LABEL: define i32 @_TFC16class_resilience21ResilientGenericChildg5fieldVs5Int32(%C16class_resilience21ResilientGenericChild*) +// CHECK-LABEL: define{{( protected)?}} i32 @_TFC16class_resilience21ResilientGenericChildg5fieldVs5Int32(%C16class_resilience21ResilientGenericChild*) // FIXME: we could eliminate the unnecessary isa load by lazily emitting // metadata sources in EmitPolymorphicParameters @@ -217,7 +217,7 @@ public class MyResilientChild : MyResilientParent { // MyResilientChild.field getter -// CHECK-LABEL: define i32 @_TFC16class_resilience16MyResilientChildg5fieldVs5Int32(%C16class_resilience16MyResilientChild*) +// CHECK-LABEL: define{{( protected)?}} i32 @_TFC16class_resilience16MyResilientChildg5fieldVs5Int32(%C16class_resilience16MyResilientChild*) // CHECK: [[FIELD_ADDR:%.*]] = getelementptr inbounds %C16class_resilience16MyResilientChild, %C16class_resilience16MyResilientChild* %0, i32 0, i32 2 // CHECK-NEXT: [[PAYLOAD_ADDR:%.*]] = getelementptr inbounds %Vs5Int32, %Vs5Int32* [[FIELD_ADDR]], i32 0, i32 0 // CHECK-NEXT: [[RESULT:%.*]] = load i32, i32* [[PAYLOAD_ADDR]] @@ -227,7 +227,7 @@ public class MyResilientChild : MyResilientParent { // ClassWithResilientProperty metadata instantiation function -// CHECK-LABEL: define private %swift.type* @create_generic_metadata_ClassWithResilientProperty(%swift.type_pattern*, i8**) +// CHECK-LABEL: define{{( protected)?}} private %swift.type* @create_generic_metadata_ClassWithResilientProperty(%swift.type_pattern*, i8**) // CHECK: [[METADATA:%.*]] = call %swift.type* @swift_allocateGenericClassMetadata( // CHECK: [[SIZE_METADATA:%.*]] = call %swift.type* @_TMaV16resilient_struct4Size() // CHECK: call void @swift_initClassMetadata_UniversalStrategy( @@ -244,7 +244,7 @@ public class MyResilientChild : MyResilientParent { // ClassWithResilientlySizedProperty metadata instantiation function -// CHECK-LABEL: define private %swift.type* @create_generic_metadata_ClassWithResilientlySizedProperty(%swift.type_pattern*, i8**) +// CHECK-LABEL: define{{( protected)?}} private %swift.type* @create_generic_metadata_ClassWithResilientlySizedProperty(%swift.type_pattern*, i8**) // CHECK: [[METADATA:%.*]] = call %swift.type* @swift_allocateGenericClassMetadata( // CHECK: [[RECTANGLE_METADATA:%.*]] = call %swift.type* @_TMaV16resilient_struct9Rectangle() // CHECK: call void @swift_initClassMetadata_UniversalStrategy( diff --git a/test/IRGen/class_stack_alloc.sil b/test/IRGen/class_stack_alloc.sil index 65a2af2b6b0d1..35b3855e8fe15 100644 --- a/test/IRGen/class_stack_alloc.sil +++ b/test/IRGen/class_stack_alloc.sil @@ -16,7 +16,7 @@ struct TestStruct { sil_vtable TestClass {} -// CHECK-LABEL: define void @simple_promote +// CHECK-LABEL: define{{( protected)?}} void @simple_promote // CHECK: %reference.raw = alloca %[[C:[a-zA-Z0-9_]+]], align 8 // CHECK: [[M:%[0-9]+]] = call %swift.type* @_TMa[[C]]() // CHECK: [[O:%[0-9]+]] = bitcast %[[C]]* %reference.raw to %swift.refcounted* @@ -39,7 +39,7 @@ bb0: // A stack promotion limit of 48 bytes allows that one of the two alloc_refs // can be allocated on the stack. -// CHECK-LABEL: define void @exceed_limit +// CHECK-LABEL: define{{( protected)?}} void @exceed_limit // CHECK: alloca {{.*}}TestClass // CHECK: alloca {{.*}}TestStruct // CHECK-NOT: alloca diff --git a/test/IRGen/concrete_inherits_generic_base.swift b/test/IRGen/concrete_inherits_generic_base.swift index 7a4a66123f6d3..3f9faa5fecaa2 100644 --- a/test/IRGen/concrete_inherits_generic_base.swift +++ b/test/IRGen/concrete_inherits_generic_base.swift @@ -17,7 +17,7 @@ class Base { } } -// CHECK-LABEL: define %swift.type* @_TMaC3foo12SuperDerived() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @_TMaC3foo12SuperDerived() // CHECK: [[CACHE:%.*]] = load %swift.type*, %swift.type** @_TMLC3foo12SuperDerived // CHECK-NEXT: [[COND:%.*]] = icmp eq %swift.type* [[CACHE]], null // CHECK-NEXT: br i1 [[COND]], label %cacheIsNull, label %cont @@ -33,7 +33,7 @@ class Base { class SuperDerived: Derived { } -// CHECK-LABEL: define %swift.type* @_TMaC3foo7Derived() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @_TMaC3foo7Derived() // CHECK: [[CACHE:%.*]] = load %swift.type*, %swift.type** @_TMLC3foo7Derived // CHECK-NEXT: [[COND:%.*]] = icmp eq %swift.type* [[CACHE]], null // CHECK-NEXT: br i1 [[COND]], label %cacheIsNull, label %cont @@ -69,7 +69,7 @@ presentBase(Derived(x: "two")) presentBase(Base(x: "two")) presentBase(Base(x: 2)) -// CHECK-LABEL: define private %swift.type* @create_generic_metadata_SuperDerived(%swift.type_pattern*, i8**) +// CHECK-LABEL: define{{( protected)?}} private %swift.type* @create_generic_metadata_SuperDerived(%swift.type_pattern*, i8**) // CHECK: [[TMP:%.*]] = call %swift.type* @_TMaC3foo7Derived() // CHECK-NEXT: [[SUPER:%.*]] = bitcast %swift.type* [[TMP:%.*]] to %objc_class* // CHECK-NEXT: [[METADATA:%.*]] = call %swift.type* @swift_allocateGenericClassMetadata(%swift.type_pattern* %0, i8** %1, %objc_class* [[SUPER]]) diff --git a/test/IRGen/dynamic_cast.sil b/test/IRGen/dynamic_cast.sil index 4e0d7b26137c6..144ea46e5a5d8 100644 --- a/test/IRGen/dynamic_cast.sil +++ b/test/IRGen/dynamic_cast.sil @@ -19,7 +19,7 @@ struct S { // CHECK: [[INT:%Si]] = type <{ [[LLVM_PTRSIZE_INT:i(32|64)]] }> -// CHECK-LABEL: define void @testUnconditional0( +// CHECK-LABEL: define{{( protected)?}} void @testUnconditional0( sil @testUnconditional0 : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): // CHECK: [[T0:%.*]] = alloca [[S:%.*]], align @@ -38,7 +38,7 @@ bb0(%0 : $*P): // CHECK-LABEL: define linkonce_odr hidden %swift.type* @_TMaP12dynamic_cast1P_() // CHECK: call %swift.type* @swift_getExistentialTypeMetadata( -// CHECK-LABEL: define void @testUnconditional1( +// CHECK-LABEL: define{{( protected)?}} void @testUnconditional1( sil @testUnconditional1 : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): // CHECK: [[T0:%.*]] = alloca [[S:%.*]], align @@ -54,7 +54,7 @@ bb0(%0 : $*P): return %2 : $() } -// CHECK-LABEL: define void @testUnconditional2( +// CHECK-LABEL: define{{( protected)?}} void @testUnconditional2( sil @testUnconditional2 : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): // CHECK: [[T0:%.*]] = alloca [[S:%.*]], align @@ -70,7 +70,7 @@ bb0(%0 : $*P): return %2 : $() } -// CHECK-LABEL: define void @testConditional0( +// CHECK-LABEL: define{{( protected)?}} void @testConditional0( sil @testConditional0 : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): // CHECK: [[T0:%.*]] = alloca [[S:%.*]], align @@ -90,7 +90,7 @@ bb2: return %2 : $() } -// CHECK-LABEL: define void @testConditional1( +// CHECK-LABEL: define{{( protected)?}} void @testConditional1( sil @testConditional1 : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): // CHECK: [[T0:%.*]] = alloca [[S:%.*]], align @@ -110,7 +110,7 @@ bb2: return %2 : $() } -// CHECK-LABEL: define void @testConditional2( +// CHECK-LABEL: define{{( protected)?}} void @testConditional2( sil @testConditional2 : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): // CHECK: [[T0:%.*]] = alloca [[S:%.*]], align diff --git a/test/IRGen/dynamic_init.sil b/test/IRGen/dynamic_init.sil index 0b200b4c98f8f..bcb7fc4321c86 100644 --- a/test/IRGen/dynamic_init.sil +++ b/test/IRGen/dynamic_init.sil @@ -16,7 +16,7 @@ sil @_TFC12dynamic_init1CcfMS0_FT_S0_ : $@convention(method) (@owned C) -> @owne sil @_TFC12dynamic_init1Cd : $@convention(method) (@owned C) -> @owned Builtin.NativeObject sil @_TFC12dynamic_init1CD : $@convention(method) (@owned C) -> () -// CHECK-LABEL: define void @_TF12dynamic_init15testDynamicInitFT2cmMCS_1C_T_ +// CHECK-LABEL: define{{( protected)?}} void @_TF12dynamic_init15testDynamicInitFT2cmMCS_1C_T_ sil @_TF12dynamic_init15testDynamicInitFT2cmMCS_1C_T_ : $@convention(thin) (@thick C.Type) -> () { bb0(%0 : $@thick C.Type): // CHECK: [[META:%[0-9]+]] = bitcast %swift.type* %0 to %C12dynamic_init1C* (%swift.type*)** diff --git a/test/IRGen/dynamic_lookup.sil b/test/IRGen/dynamic_lookup.sil index 00d73e4377645..a962f9c4f78d4 100644 --- a/test/IRGen/dynamic_lookup.sil +++ b/test/IRGen/dynamic_lookup.sil @@ -51,7 +51,7 @@ bb0(%0 : $X): return %7 : $Int } -// CHECK: define void @dynamic_lookup_br(%objc_object*) +// CHECK: define{{( protected)?}} void @dynamic_lookup_br(%objc_object*) sil @dynamic_lookup_br : $@convention(thin) (AnyObject) -> () { bb0(%0 : $AnyObject): %1 = alloc_box $AnyObject @@ -80,7 +80,7 @@ bb3: return %43 : $() } -// CHECK: define void @dynamic_lookup_static_br(%swift.type*) +// CHECK: define{{( protected)?}} void @dynamic_lookup_static_br(%swift.type*) sil @dynamic_lookup_static_br : $@convention(thin) (@thick AnyObject.Type) -> () { bb0(%0 : $@thick AnyObject.Type): // CHECK: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(g)", align {{(4|8)}} @@ -123,7 +123,7 @@ bb3: return %43 : $() } -// CHECK-LABEL: define void @_T1t16opt_to_subscriptFT3objPSo13AnyObject_1iSi_T_(%objc_object*, {{(i32|i64)}}) +// CHECK-LABEL: define{{( protected)?}} void @_T1t16opt_to_subscriptFT3objPSo13AnyObject_1iSi_T_(%objc_object*, {{(i32|i64)}}) sil @_T1t16opt_to_subscriptFT3objPSo13AnyObject_1iSi_T_ : $@convention(thin) (AnyObject, Int) -> () { bb0(%0 : $AnyObject, %1 : $Int): %2 = alloc_box $AnyObject diff --git a/test/IRGen/dynamic_self.sil b/test/IRGen/dynamic_self.sil index 981871540bb02..ac166999a9c86 100644 --- a/test/IRGen/dynamic_self.sil +++ b/test/IRGen/dynamic_self.sil @@ -11,7 +11,7 @@ protocol P { func f() -> Self } -// CHECK-LABEL: define void @_TF12dynamic_self23testExistentialDispatchFT1pPS_1P__T_ +// CHECK-LABEL: define{{( protected)?}} void @_TF12dynamic_self23testExistentialDispatchFT1pPS_1P__T_ sil @_TF12dynamic_self23testExistentialDispatchFT1pPS_1P__T_ : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): debug_value_addr %0 : $*P, let, name "p" // id: %1 diff --git a/test/IRGen/empty_array.sil b/test/IRGen/empty_array.sil index 734f86cbfade7..4d2716d121e6f 100644 --- a/test/IRGen/empty_array.sil +++ b/test/IRGen/empty_array.sil @@ -12,11 +12,11 @@ sil_stage canonical import Builtin -// CHECK-32-LABEL: define void @empty_array(%swift.opaque* noalias nocapture) {{.*}} { +// CHECK-32-LABEL: define{{( protected)?}} void @empty_array(%swift.opaque* noalias nocapture) {{.*}} { // CHECK-32: %1 = bitcast %swift.opaque* %0 to i8* // CHECK-32: %2 = getelementptr inbounds i8, i8* %1, i32 0 -// CHECK-64-LABEL: define void @empty_array(%swift.opaque* noalias nocapture) {{.*}} { +// CHECK-64-LABEL: define{{( protected)?}} void @empty_array(%swift.opaque* noalias nocapture) {{.*}} { // CHECK-64: %1 = bitcast %swift.opaque* %0 to i8* // CHECK-64: %2 = getelementptr inbounds i8, i8* %1, i64 0 diff --git a/test/IRGen/enum.sil b/test/IRGen/enum.sil index 096403a0c7eb3..2abe121869245 100644 --- a/test/IRGen/enum.sil +++ b/test/IRGen/enum.sil @@ -104,7 +104,7 @@ import Swift // FIXME: Strings should be unnamed_addr. rdar://problem/22674524 // CHECK: [[DYNAMICSINGLETON_FIELD_NAMES:@.*]] = private constant [7 x i8] c"value\00\00" // CHECK: [[DYNAMICSINGLETON_NAME:@.*]] = private constant [25 x i8] c"O4enum16DynamicSingleton\00" -// CHECK: @_TMnO4enum16DynamicSingleton = constant <{ {{.*}} i32 }> <{ +// CHECK: @_TMnO4enum16DynamicSingleton = {{(protected )?}}constant <{ {{.*}} i32 }> <{ // CHECK: [25 x i8]* [[DYNAMICSINGLETON_NAME]] // -- One payload // CHECK: i32 1, @@ -120,7 +120,7 @@ import Swift // CHECK: i32 1, i32 0 // CHECK: }> -// CHECK: @_TMPO4enum16DynamicSingleton = global <{ {{.*}}* }> <{ +// CHECK: @_TMPO4enum16DynamicSingleton = {{(protected )?}}global <{ {{.*}}* }> <{ // CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_DynamicSingleton // CHECK: @_TMnO4enum16DynamicSingleton // CHECK: i8* null @@ -129,7 +129,7 @@ import Swift // -- No-payload enums have extra inhabitants in // their value witness table. -// CHECK: @_TWVO4enum10NoPayloads = constant [26 x i8*] [ +// CHECK: @_TWVO4enum10NoPayloads = {{(protected )?}}constant [26 x i8*] [ // -- ... // -- size // CHECK: i8* inttoptr ([[WORD:i32|i64]] 1 to i8*), @@ -147,7 +147,7 @@ import Swift // -- Single-payload enums take unused extra inhabitants from their payload // as their own. -// CHECK: @_TWVO4enum19SinglePayloadNested = constant [26 x i8*] [ +// CHECK: @_TWVO4enum19SinglePayloadNested = {{(protected )?}}constant [26 x i8*] [ // -- ... // -- size // CHECK: i8* inttoptr ([[WORD]] 1 to i8*), @@ -164,13 +164,13 @@ import Swift // CHECK: ] -// CHECK: @_TMPO4enum20DynamicSinglePayload = global <{ {{.*}}* }> <{ +// CHECK: @_TMPO4enum20DynamicSinglePayload = {{(protected )?}}global <{ {{.*}}* }> <{ // CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_DynamicSinglePayload // CHECK: i8* null // CHECK: i8* bitcast (void (%swift.opaque*, i32, %swift.type*)* @_TwxsO4enum20DynamicSinglePayload to i8*) // CHECK: i8* bitcast (i32 (%swift.opaque*, %swift.type*)* @_TwxgO4enum20DynamicSinglePayload to i8*) -// CHECK: @_TWVO4enum18MultiPayloadNested = constant [26 x i8*] [ +// CHECK: @_TWVO4enum18MultiPayloadNested = {{(protected )?}}constant [26 x i8*] [ // CHECK: i8* inttoptr ([[WORD]] 9 to i8*), // CHECK: i8* inttoptr ([[WORD]] 16 to i8*) // CHECK: ] @@ -193,7 +193,7 @@ enum DynamicSingleton { case value(T) } -// CHECK: define void @singleton_switch(i64, i64) {{.*}} { +// CHECK: define{{( protected)?}} void @singleton_switch(i64, i64) {{.*}} { sil @singleton_switch : $(Singleton) -> () { // CHECK: entry: entry(%u : $Singleton): @@ -207,7 +207,7 @@ dest: return %x : $() } -// CHECK: define void @singleton_switch_arg(i64, i64) {{.*}} { +// CHECK: define{{( protected)?}} void @singleton_switch_arg(i64, i64) {{.*}} { sil @singleton_switch_arg : $(Singleton) -> () { // CHECK: entry: entry(%u : $Singleton): @@ -225,7 +225,7 @@ dest(%u2 : $(Builtin.Int64, Builtin.Int64)): return %x : $() } -// CHECK: define void @singleton_switch_indirect(%O4enum9Singleton* nocapture dereferenceable({{.*}})) {{.*}} { +// CHECK: define{{( protected)?}} void @singleton_switch_indirect(%O4enum9Singleton* nocapture dereferenceable({{.*}})) {{.*}} { // CHECK: entry: // CHECK: br label %[[DEST:[0-9]+]] // CHECK: ; (@owned SwiftClass, @in A, Int) -> () -// CHECK-LABEL: define { i8*, %swift.refcounted* } @partial_apply_indirect_non_fixed_layout(%C13partial_apply10SwiftClass*, %swift.opaque* noalias nocapture, i64, %swift.type* %T) +// CHECK-LABEL: define{{( protected)?}} { i8*, %swift.refcounted* } @partial_apply_indirect_non_fixed_layout(%C13partial_apply10SwiftClass*, %swift.opaque* noalias nocapture, i64, %swift.type* %T) // -- Round the base offset for the T field up to T's alignment. // CHECK: [[T_METADATA_BASE:%.*]] = bitcast %swift.type* %T to i8*** // CHECK: [[T_VWTABLE_ADDR:%.*]] = getelementptr {{.*}} [[T_METADATA_BASE]], [[WORD:i[0-9]+]] -1 @@ -471,7 +471,7 @@ bb0(%x : $Int32, %f : $@callee_owned (@out T, Int32) -> ()): return %p : $@callee_owned (@out T) -> () } -// CHECK-LABEL: define { i8*, %swift.refcounted* } @partial_apply_dynamic_with_out_param +// CHECK-LABEL: define{{( protected)?}} { i8*, %swift.refcounted* } @partial_apply_dynamic_with_out_param // CHECK: insertvalue {{.*}} [[FORWARDER:@_TPA[A-Za-z0-9_]*]] // CHECK: define internal void [[FORWARDER]] // CHECK: call void {{%.*}}(%swift.opaque* noalias nocapture sret @@ -493,7 +493,7 @@ bb0(%0 : $Base): sil public_external @receive_closure : $@convention(thin) (@owned @callee_owned () -> (@owned C)) -> () -// CHECK-LABEL: define void @test_partial_apply(%C13partial_apply4Base*) +// CHECK-LABEL: define{{( protected)?}} void @test_partial_apply(%C13partial_apply4Base*) // CHECK: [[CTX:%.*]] = bitcast %C13partial_apply4Base* %0 to %swift.refcounted* // CHECK: [[TYPE:%.*]] = call %swift.type* @_TMaC13partial_apply3Sub() // CHECK: call void @receive_closure(i8* bitcast (%C13partial_apply3Sub* (%swift.refcounted*)* @_TPA_parametric_casting_closure.28 to i8*), %swift.refcounted* [[CTX]], %swift.type* [[TYPE]]) @@ -524,7 +524,7 @@ bb0(%0 : $Base): sil public_external @partial_empty_box : $@convention(thin) (@owned @box (), @inout ()) -> () -// CHECK-LABEL: define void @empty_box() +// CHECK-LABEL: define{{( protected)?}} void @empty_box() sil @empty_box : $@convention(thin) () -> () { entry: // CHECK: store %swift.refcounted* null diff --git a/test/IRGen/playground.swift b/test/IRGen/playground.swift index 24df5de791dd5..19a4f1db6e516 100644 --- a/test/IRGen/playground.swift +++ b/test/IRGen/playground.swift @@ -13,12 +13,12 @@ public func anchor() {} anchor() -// CHECK-LABEL: define i32 @main +// CHECK-LABEL: define{{( protected)?}} i32 @main // CHECK: call void @runtime_registration // CHECK: call void @_TF10playground6anchorFT_T_ // CHECK: ret void // CHECK: } -// CHECK-LABEL: define private void @runtime_registration +// CHECK-LABEL: define{{( protected)?}} private void @runtime_registration // CHECK: call void @swift_instantiateObjCClass({{.*}} @_TMC10playground1C diff --git a/test/IRGen/protocol_extensions.sil b/test/IRGen/protocol_extensions.sil index f1b829ca1a1d3..45b1edc1db224 100644 --- a/test/IRGen/protocol_extensions.sil +++ b/test/IRGen/protocol_extensions.sil @@ -24,7 +24,7 @@ bb0(%0 : $*Self): return %5 : $() // id: %6 } -// CHECK-LABEL: define void @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ +// CHECK-LABEL: define{{( protected)?}} void @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ sil @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ : $@convention(method) (@in Self) -> () { bb0(%0 : $*Self): debug_value_addr %0 : $*Self, let, name "self" // id: %1 diff --git a/test/IRGen/protocol_metadata.swift b/test/IRGen/protocol_metadata.swift index f9c2305df1617..a75cf7eb089bd 100644 --- a/test/IRGen/protocol_metadata.swift +++ b/test/IRGen/protocol_metadata.swift @@ -18,19 +18,19 @@ protocol C : class { func c() } protocol AB : A, B { func ab() } protocol ABO : A, B, O { func abo() } -// CHECK: @_TMp17protocol_metadata1A = constant %swift.protocol { +// CHECK: @_TMp17protocol_metadata1A = {{(protected )?}}constant %swift.protocol { // -- size 72 // -- flags: 1 = Swift | 2 = Not Class-Constrained | 4 = Needs Witness Table // CHECK: i32 72, i32 7, // CHECK: i16 0, i16 0 // CHECK: } -// CHECK: @_TMp17protocol_metadata1B = constant %swift.protocol { +// CHECK: @_TMp17protocol_metadata1B = {{(protected )?}}constant %swift.protocol { // CHECK: i32 72, i32 7, // CHECK: i16 0, i16 0 // CHECK: } -// CHECK: @_TMp17protocol_metadata1C = constant %swift.protocol { +// CHECK: @_TMp17protocol_metadata1C = {{(protected )?}}constant %swift.protocol { // -- flags: 1 = Swift | 4 = Needs Witness Table // CHECK: i32 72, i32 5, // CHECK: i16 0, i16 0 @@ -62,7 +62,7 @@ protocol ABO : A, B, O { func abo() } // CHECK: %swift.protocol* @_TMp17protocol_metadata1A, // CHECK: %swift.protocol* @_TMp17protocol_metadata1B // CHECK: } -// CHECK: @_TMp17protocol_metadata2AB = constant %swift.protocol { +// CHECK: @_TMp17protocol_metadata2AB = {{(protected )?}}constant %swift.protocol { // CHECK: [[AB_INHERITED]] // CHECK: i32 72, i32 7, // CHECK: i16 0, i16 0 diff --git a/test/IRGen/protocol_resilience.sil b/test/IRGen/protocol_resilience.sil index 4211d8712d85f..f9353defd9ce8 100644 --- a/test/IRGen/protocol_resilience.sil +++ b/test/IRGen/protocol_resilience.sil @@ -49,13 +49,13 @@ protocol InternalProtocol { func f() } -// CHECK: @_TMp19protocol_resilience5Proto = constant %swift.protocol { +// CHECK: @_TMp19protocol_resilience5Proto = {{(protected )?}}constant %swift.protocol { // CHECK-SAME: i32 1031, // CHECK-SAME: i16 0, // CHECK-SAME: i16 0 // CHECK-SAME: } -// CHECK: @_TMp19protocol_resilience17ResilientProtocol = constant <{{.*}}> <{ +// CHECK: @_TMp19protocol_resilience17ResilientProtocol = {{(protected )?}}constant <{{.*}}> <{ // CHECK-SAME: i32 1031, // CHECK-SAME: i16 4, // CHECK-SAME: i16 2, @@ -63,7 +63,7 @@ protocol InternalProtocol { // CHECK-SAME: void (%swift.opaque*, %swift.type*)* @defaultD // CHECK-SAME: }> -// CHECK: @_TMp19protocol_resilience16InternalProtocol = constant %swift.protocol { +// CHECK: @_TMp19protocol_resilience16InternalProtocol = {{(protected )?}}constant %swift.protocol { // CHECK-SAME: i32 7, // CHECK-SAME: i16 0, // CHECK-SAME: i16 0 diff --git a/test/IRGen/readonly.sil b/test/IRGen/readonly.sil index aca469891d3b0..ca27cf68e694a 100644 --- a/test/IRGen/readonly.sil +++ b/test/IRGen/readonly.sil @@ -19,7 +19,7 @@ sil @_TFC8readonly3XXXCfMS0_FT_S0_ : $@convention(thin) (@thick XXX.Type) -> @ow //CHECK: target datalayout //CHECK: ; Function Attrs: readonly -//CHECK-NEXT: define void @function_foo( +//CHECK-NEXT: define{{( protected)?}} void @function_foo( sil [readonly] @function_foo : $@convention(thin) (Int) -> () { bb0(%0 : $Int): %1 = tuple () // user: %2 @@ -27,7 +27,7 @@ bb0(%0 : $Int): } //CHECK-NOT: ; Function Attrs: readonly -//CHECK: define void @function_bar( +//CHECK: define{{( protected)?}} void @function_bar( sil [readonly] @function_bar : $@convention(thin) (@owned XXX) -> () { bb0(%0 : $XXX): strong_release %0 : $XXX // id: %2 diff --git a/test/IRGen/same_type_constraints.swift b/test/IRGen/same_type_constraints.swift index 57f50ed615b89..1a5ee11d39bea 100644 --- a/test/IRGen/same_type_constraints.swift +++ b/test/IRGen/same_type_constraints.swift @@ -15,4 +15,4 @@ public extension P where Foo == DefaultFoo { } } -// CHECK: define void @_TFe21same_type_constraintsRxS_1Pwx3FoozGVS_10DefaultFoox_rS0_3foofT_GS2_x_ +// CHECK: define{{( protected)?}} void @_TFe21same_type_constraintsRxS_1Pwx3FoozGVS_10DefaultFoox_rS0_3foofT_GS2_x_ diff --git a/test/IRGen/select_enum.sil b/test/IRGen/select_enum.sil index 17035b8af7561..3bed793616a62 100644 --- a/test/IRGen/select_enum.sil +++ b/test/IRGen/select_enum.sil @@ -7,7 +7,7 @@ enum SinglePayloadSingleEmpty { case DataCase(Builtin.Word) } -// CHECK-LABEL: define void @select_enum_SinglePayloadSingleEmpty(%O11select_enum24SinglePayloadSingleEmpty* noalias nocapture dereferenceable({{.*}})) +// CHECK-LABEL: define{{( protected)?}} void @select_enum_SinglePayloadSingleEmpty(%O11select_enum24SinglePayloadSingleEmpty* noalias nocapture dereferenceable({{.*}})) sil @select_enum_SinglePayloadSingleEmpty : $@convention(thin) (@in SinglePayloadSingleEmpty) -> () { bb0(%0 : $*SinglePayloadSingleEmpty): %1 = load %0 : $*SinglePayloadSingleEmpty @@ -79,7 +79,7 @@ enum NoPayloadSingleton { case One } -// CHECK-LABEL: define i1 @testOptionalOfNoPayloadSingleton(i1) +// CHECK-LABEL: define{{( protected)?}} i1 @testOptionalOfNoPayloadSingleton(i1) sil @testOptionalOfNoPayloadSingleton : $@convention(thin) (MyOptional) -> Builtin.Int1 { bb0(%0 : $MyOptional): // CHECK: [[NOT:%.*]] = xor i1 %0, true diff --git a/test/IRGen/select_enum_single_payload.sil b/test/IRGen/select_enum_single_payload.sil index 6cb86c659ee36..29a4e121dd18d 100644 --- a/test/IRGen/select_enum_single_payload.sil +++ b/test/IRGen/select_enum_single_payload.sil @@ -9,7 +9,7 @@ enum ManyEmptyCases { case C(Builtin.Int32) } -// CHECK-LABEL: define i1 @select_enum_A(i32, i1) +// CHECK-LABEL: define{{( protected)?}} i1 @select_enum_A(i32, i1) // CHECK: [[PAYLOAD:%.*]] = icmp eq i32 %0, 0 // CHECK: [[EXTRA:%.*]] = and i1 %1, [[PAYLOAD]] // CHECK: ret i1 [[EXTRA]] @@ -21,7 +21,7 @@ entry(%0 : $ManyEmptyCases): return %6 : $Builtin.Int1 } -// CHECK-LABEL: define i1 @select_enum_B(i32, i1) +// CHECK-LABEL: define{{( protected)?}} i1 @select_enum_B(i32, i1) // CHECK: [[PAYLOAD:%.*]] = icmp eq i32 %0, 1 // CHECK: [[EXTRA:%.*]] = and i1 %1, [[PAYLOAD]] // CHECK: ret i1 [[EXTRA]] diff --git a/test/IRGen/sil_linkage.sil b/test/IRGen/sil_linkage.sil index 80e877a2fa7fe..8f05ce8650714 100644 --- a/test/IRGen/sil_linkage.sil +++ b/test/IRGen/sil_linkage.sil @@ -2,20 +2,20 @@ sil_stage canonical -// CHECK: define void @public_fragile_function_test() {{.*}} { -// CHECK: define void @hidden_fragile_function_test() {{.*}} { +// CHECK: define{{( protected)?}} void @public_fragile_function_test() {{.*}} { +// CHECK: define{{( protected)?}} void @hidden_fragile_function_test() {{.*}} { // CHECK: define linkonce_odr hidden void @shared_fragile_function_test() {{.*}} { -// CHECK: define void @private_fragile_function_test() {{.*}} { +// CHECK: define{{( protected)?}} void @private_fragile_function_test() {{.*}} { // CHECK: define linkonce_odr hidden void @public_external_fragile_function_def_test() {{.*}} { -// CHECK: define available_externally void @hidden_external_fragile_function_def_test() {{.*}} { +// CHECK: define{{( protected)?}} available_externally void @hidden_external_fragile_function_def_test() {{.*}} { // CHECK: define linkonce_odr hidden void @shared_external_fragile_function_def_test() {{.*}} { -// CHECK: define available_externally void @private_external_fragile_function_def_test() {{.*}} { -// CHECK: define void @public_resilient_function_test() {{.*}} { +// CHECK: define{{( protected)?}} available_externally void @private_external_fragile_function_def_test() {{.*}} { +// CHECK: define{{( protected)?}} void @public_resilient_function_test() {{.*}} { // CHECK: define hidden void @hidden_resilient_function_test() {{.*}} { // CHECK: define linkonce_odr hidden void @shared_resilient_function_test() {{.*}} { // CHECK: define internal void @private_resilient_function_test() {{.*}}{ // CHECK: define linkonce_odr hidden void @public_external_resilient_function_def_test() {{.*}} { -// CHECK: define available_externally hidden void @hidden_external_resilient_function_def_test() {{.*}} { +// CHECK: define{{( protected)?}} available_externally hidden void @hidden_external_resilient_function_def_test() {{.*}} { // CHECK: define linkonce_odr hidden void @shared_external_resilient_function_def_test() {{.*}} { sil public [fragile] @public_fragile_function_test : $@convention(thin) () -> () { diff --git a/test/IRGen/sil_witness_methods.sil b/test/IRGen/sil_witness_methods.sil index 1560faddf2d0a..849f19d41ddbf 100644 --- a/test/IRGen/sil_witness_methods.sil +++ b/test/IRGen/sil_witness_methods.sil @@ -19,14 +19,14 @@ protocol P { func generic_method(x: Z) } -// CHECK-LABEL: define %swift.type* @concrete_type_concrete_method_witness(%V19sil_witness_methods3Foo* noalias nocapture, %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @concrete_type_concrete_method_witness(%V19sil_witness_methods3Foo* noalias nocapture, %swift.type* %Self) sil @concrete_type_concrete_method_witness : $@convention(witness_method) (@in Foo) -> @thick Foo.Type { entry(%x : $*Foo): %m = metatype $@thick Foo.Type return %m : $@thick Foo.Type } -// CHECK-LABEL: define %swift.type* @generic_type_concrete_method_witness(%C19sil_witness_methods3Bar** noalias nocapture dereferenceable({{.*}}), %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @generic_type_concrete_method_witness(%C19sil_witness_methods3Bar** noalias nocapture dereferenceable({{.*}}), %swift.type* %Self) // CHECK: [[T0:%.*]] = bitcast %swift.type* %Self to %swift.type** // CHECK: [[T1:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[T0]], i64 10 // CHECK: %T = load %swift.type*, %swift.type** [[T1]], align 8 @@ -48,14 +48,14 @@ entry(%x : $*Bar): // TODO: %Self Type arg is redundant for static method witness -// CHECK-LABEL: define %swift.type* @concrete_type_concrete_static_method_witness(%swift.type*, %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @concrete_type_concrete_static_method_witness(%swift.type*, %swift.type* %Self) sil @concrete_type_concrete_static_method_witness : $@convention(witness_method) (@thick Foo.Type) -> @thick Foo.Type { entry(%x : $@thick Foo.Type): %m = metatype $@thick Foo.Type return %m : $@thick Foo.Type } -// CHECK-LABEL: define %swift.type* @generic_type_concrete_static_method_witness(%swift.type*, %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @generic_type_concrete_static_method_witness(%swift.type*, %swift.type* %Self) // CHECK: [[T0:%.*]] = bitcast %swift.type* %Self to %swift.type** // CHECK: [[T1:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[T0]], i64 10 // CHECK: %T = load %swift.type*, %swift.type** [[T1]], align 8 @@ -77,14 +77,14 @@ entry(%x : $@thick Bar.Type): // TODO: %Self Type arg is redundant for class method witness -// CHECK-LABEL: define %swift.type* @concrete_type_generic_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %V19sil_witness_methods3Foo* noalias nocapture, %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @concrete_type_generic_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %V19sil_witness_methods3Foo* noalias nocapture, %swift.type* %Self) sil @concrete_type_generic_method_witness : $@convention(witness_method) (@in Z, @in Foo) -> @thick Foo.Type { entry(%z : $*Z, %x : $*Foo): %m = metatype $@thick Foo.Type return %m : $@thick Foo.Type } -// CHECK-LABEL: define %swift.type* @generic_type_generic_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %C19sil_witness_methods3Bar** noalias nocapture dereferenceable({{.*}}), %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @generic_type_generic_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %C19sil_witness_methods3Bar** noalias nocapture dereferenceable({{.*}}), %swift.type* %Self) sil @generic_type_generic_method_witness : $@convention(witness_method) (@in Z, @in Bar) -> @thick Bar.Type { entry(%z : $*Z, %x : $*Bar): %t = metatype $@thick T.Type @@ -95,14 +95,14 @@ entry(%z : $*Z, %x : $*Bar): return %m : $@thick Bar.Type } -// CHECK-LABEL: define %swift.type* @concrete_type_generic_static_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %swift.type*, %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @concrete_type_generic_static_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %swift.type*, %swift.type* %Self) sil @concrete_type_generic_static_method_witness : $@convention(witness_method) (@in Z, @thick Foo.Type) -> @thick Foo.Type { entry(%z : $*Z, %x : $@thick Foo.Type): %m = metatype $@thick Foo.Type return %m : $@thick Foo.Type } -// CHECK-LABEL: define %swift.type* @generic_type_generic_static_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %swift.type*, %swift.type* %Self) +// CHECK-LABEL: define{{( protected)?}} %swift.type* @generic_type_generic_static_method_witness(%swift.opaque* noalias nocapture, %swift.type* %Z, %swift.type*, %swift.type* %Self) sil @generic_type_generic_static_method_witness : $@convention(witness_method) (@in Z, @thick Bar.Type) -> @thick Bar.Type { entry(%z : $*Z, %x : $@thick Bar.Type): %t = metatype $@thick T.Type @@ -113,7 +113,7 @@ entry(%z : $*Z, %x : $@thick Bar.Type): return %m : $@thick Bar.Type } -// CHECK-LABEL: define void @call_concrete_witness() {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @call_concrete_witness() {{.*}} { // CHECK: call %swift.type* @concrete_type_concrete_method_witness(%V19sil_witness_methods3Foo* {{.*}}, %swift.type* {{.*}} @_TMfV19sil_witness_methods3Foo, {{.*}}) sil @call_concrete_witness : $(Foo) -> () { entry(%x : $Foo): @@ -125,7 +125,7 @@ entry(%x : $Foo): return undef : $() } -// CHECK-LABEL: define void @call_concrete_static_witness() {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @call_concrete_static_witness() {{.*}} { // CHECK: call %swift.type* @concrete_type_concrete_static_method_witness(%swift.type* {{.*}} @_TMfV19sil_witness_methods3Foo, {{.*}} %swift.type* {{.*}} @_TMfV19sil_witness_methods3Foo, {{.*}}) sil @call_concrete_static_witness : $() -> () { entry: diff --git a/test/IRGen/sil_witness_tables.swift b/test/IRGen/sil_witness_tables.swift index 50225ce396f52..7238e8f988cd7 100644 --- a/test/IRGen/sil_witness_tables.swift +++ b/test/IRGen/sil_witness_tables.swift @@ -73,7 +73,7 @@ func externalErasure(c c: ExternalConformer) -> ExternalP { // FIXME: why do these have different linkages? -// CHECK-LABEL: define %swift.type* @_TMaV18sil_witness_tables14AssocConformer() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @_TMaV18sil_witness_tables14AssocConformer() // CHECK: ret %swift.type* bitcast (i64* getelementptr inbounds {{.*}} @_TMfV18sil_witness_tables14AssocConformer, i32 0, i32 1) to %swift.type*) // CHECK-LABEL: define hidden i8** @_TWaV18sil_witness_tables9ConformerS_1PS_() diff --git a/test/IRGen/special_protocols.sil b/test/IRGen/special_protocols.sil index fc80474f12bb6..e55ffa5e8758d 100644 --- a/test/IRGen/special_protocols.sil +++ b/test/IRGen/special_protocols.sil @@ -1,21 +1,21 @@ // RUN: %target-swift-frontend %s -emit-ir -parse-stdlib -module-name Swift | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize protocol AnyObject: class {} -// CHECK-LABEL: @_TMps9AnyObject = constant %swift.protocol { +// CHECK-LABEL: @_TMps9AnyObject = {{(protected )?}}constant %swift.protocol { // -- 0x0000_0049: special protocol 01, class, empty, swift // CHECK: i32 73, // CHECK: i16 0, // CHECK: i16 0 } protocol ErrorType {} -// CHECK-LABEL: @_TMps9ErrorType = constant %swift.protocol { +// CHECK-LABEL: @_TMps9ErrorType = {{(protected )?}}constant %swift.protocol { // -- 0x0000_0087: special protocol 02, non-class, witness, swift // CHECK: i32 135, // CHECK: i16 0, // CHECK: i16 0 } protocol PlainOldProtocol {} -// CHECK-LABEL: @_TMps16PlainOldProtocol = constant %swift.protocol { +// CHECK-LABEL: @_TMps16PlainOldProtocol = {{(protected )?}}constant %swift.protocol { // -- 0x0000_0007: no special protocol, non-class, witness, swift // CHECK: i32 7, // CHECK: i16 0, diff --git a/test/IRGen/static_initializer.sil b/test/IRGen/static_initializer.sil index dafe771087d02..d71d3c2758cb9 100644 --- a/test/IRGen/static_initializer.sil +++ b/test/IRGen/static_initializer.sil @@ -24,10 +24,10 @@ public struct S2 { // CHECK: %V18static_initializer1S = type <{ %Vs5Int32 }> sil_global @_Tv2ch1xSi : $Int32, @globalinit_func0 : $@convention(thin) () -> () -// CHECK: @_Tv2ch1xSi = global %Vs5Int32 <{ i32 2 }>, align 4 +// CHECK: @_Tv2ch1xSi = {{(protected )?}}global %Vs5Int32 <{ i32 2 }>, align 4 sil_global @_Tv6nested1xVS_2S2 : $S2, @globalinit_func1 : $@convention(thin) () -> () -// CHECK: @_Tv6nested1xVS_2S2 = global %V18static_initializer2S2 <{ %Vs5Int32 <{ i32 2 }>, %Vs5Int32 <{ i32 3 }>, %V18static_initializer1S <{ %Vs5Int32 <{ i32 4 }> }> }>, align 4 +// CHECK: @_Tv6nested1xVS_2S2 = {{(protected )?}}global %V18static_initializer2S2 <{ %Vs5Int32 <{ i32 2 }>, %Vs5Int32 <{ i32 3 }>, %V18static_initializer1S <{ %Vs5Int32 <{ i32 4 }> }> }>, align 4 sil private @globalinit_func0 : $@convention(thin) () -> () { bb0: @@ -39,7 +39,7 @@ bb0: return %4 : $() } -// CHECK-LABEL: define i8* @_TF2cha1xSi() {{.*}} { +// CHECK-LABEL: define{{( protected)?}} i8* @_TF2cha1xSi() {{.*}} { // CHECK-NEXT: entry: // CHECK-NEXT: ret i8* bitcast (%Vs5Int32* @_Tv2ch1xSi to i8*) sil [global_init] @_TF2cha1xSi : $@convention(thin) () -> Builtin.RawPointer { @@ -49,7 +49,7 @@ bb0: return %1 : $Builtin.RawPointer } -// CHECK-LABEL: define i32 @_TF2ch1fFT_Si() {{.*}} { +// CHECK-LABEL: define{{( protected)?}} i32 @_TF2ch1fFT_Si() {{.*}} { // CHECK-NEXT: entry: // CHECK-NEXT: load i32, i32* getelementptr inbounds (%Vs5Int32, %Vs5Int32* @_Tv2ch1xSi, i32 0, i32 0) // CHECK-NEXT: ret @@ -76,7 +76,7 @@ bb0: return %10 : $() } -// CHECK-LABEL: define i8* @_TF6nesteda1xVS_2S2() {{.*}} { +// CHECK-LABEL: define{{( protected)?}} i8* @_TF6nesteda1xVS_2S2() {{.*}} { // CHECK-NEXT: entry: // CHECK-NEXT: ret i8* bitcast (%V18static_initializer2S2* @_Tv6nested1xVS_2S2 to i8*) sil [global_init] @_TF6nesteda1xVS_2S2 : $@convention(thin) () -> Builtin.RawPointer { @@ -86,7 +86,7 @@ bb0: return %1 : $Builtin.RawPointer } -// CHECK-LABEL: define { i32, i32, i32 } @_TF6nested1fFT_VS_2S2() {{.*}} { +// CHECK-LABEL: define{{( protected)?}} { i32, i32, i32 } @_TF6nested1fFT_VS_2S2() {{.*}} { // CHECK-NEXT: entry: // CHECK-NEXT: load i32, i32* getelementptr inbounds (%V18static_initializer2S2, %V18static_initializer2S2* @_Tv6nested1xVS_2S2, i32 0, i32 0, i32 0) // CHECK-NEXT: load i32, i32* getelementptr inbounds (%V18static_initializer2S2, %V18static_initializer2S2* @_Tv6nested1xVS_2S2, i32 0, i32 1, i32 0) diff --git a/test/IRGen/struct_layout.sil b/test/IRGen/struct_layout.sil index 12f5a7ceecae3..9b6f6b6d5129f 100644 --- a/test/IRGen/struct_layout.sil +++ b/test/IRGen/struct_layout.sil @@ -9,9 +9,9 @@ import Swift // 64: %V4main14Rdar15410780_C = type <{ %Sq[[C:(\.[0-9]+)?]] }> // 64: %Sq[[C]] = type <{ [24 x i8], [1 x i8] }> -// 64: @_TWVV4main14Rdar15410780_A = constant {{.*}} (i64 257 -// 64: @_TWVV4main14Rdar15410780_B = constant {{.*}} (i64 258 -// 64: @_TWVV4main14Rdar15410780_C = constant {{.*}} (i64 25 +// 64: @_TWVV4main14Rdar15410780_A = {{(protected )?}}constant {{.*}} (i64 257 +// 64: @_TWVV4main14Rdar15410780_B = {{(protected )?}}constant {{.*}} (i64 258 +// 64: @_TWVV4main14Rdar15410780_C = {{(protected )?}}constant {{.*}} (i64 25 // 32: %V4main14Rdar15410780_A = type <{ i2048, %Vs4Int8 }> @@ -20,9 +20,9 @@ import Swift // 32: %V4main14Rdar15410780_C = type <{ %Sq[[C:(\.[0-9]+)?]] }> // 32: %Sq[[C]] = type <{ [12 x i8], [1 x i8] }> -// 32: @_TWVV4main14Rdar15410780_A = constant {{.*}} (i32 257 -// 32: @_TWVV4main14Rdar15410780_B = constant {{.*}} (i32 258 -// 32: @_TWVV4main14Rdar15410780_C = constant {{.*}} (i32 13 +// 32: @_TWVV4main14Rdar15410780_A = {{(protected )?}}constant {{.*}} (i32 257 +// 32: @_TWVV4main14Rdar15410780_B = {{(protected )?}}constant {{.*}} (i32 258 +// 32: @_TWVV4main14Rdar15410780_C = {{(protected )?}}constant {{.*}} (i32 13 // diff --git a/test/IRGen/struct_resilience.swift b/test/IRGen/struct_resilience.swift index 829cd32ab0ccf..b0f96fa8ce65e 100644 --- a/test/IRGen/struct_resilience.swift +++ b/test/IRGen/struct_resilience.swift @@ -6,12 +6,12 @@ import resilient_enum // CHECK: %Si = type <{ [[INT:i32|i64]] }> -// CHECK-LABEL: @_TMPV17struct_resilience26StructWithResilientStorage = global +// CHECK-LABEL: @_TMPV17struct_resilience26StructWithResilientStorage = {{(protected )?}}global // Resilient structs from outside our resilience domain are manipulated via // value witnesses -// CHECK-LABEL: define void @_TF17struct_resilience26functionWithResilientTypesFTV16resilient_struct4Size1fFS1_S1__S1_(%swift.opaque* noalias nocapture sret, %swift.opaque* noalias nocapture, i8*, %swift.refcounted*) +// CHECK-LABEL: define{{( protected)?}} void @_TF17struct_resilience26functionWithResilientTypesFTV16resilient_struct4Size1fFS1_S1__S1_(%swift.opaque* noalias nocapture sret, %swift.opaque* noalias nocapture, i8*, %swift.refcounted*) public func functionWithResilientTypes(s: Size, f: Size -> Size) -> Size { @@ -52,7 +52,7 @@ public func functionWithResilientTypes(s: Size, f: Size -> Size) -> Size { // Make sure we use a type metadata accessor function, and load indirect // field offsets from it. -// CHECK-LABEL: define void @_TF17struct_resilience26functionWithResilientTypesFV16resilient_struct9RectangleT_(%V16resilient_struct9Rectangle* noalias nocapture) +// CHECK-LABEL: define{{( protected)?}} void @_TF17struct_resilience26functionWithResilientTypesFV16resilient_struct9RectangleT_(%V16resilient_struct9Rectangle* noalias nocapture) public func functionWithResilientTypes(r: Rectangle) { // CHECK: [[METADATA:%.*]] = call %swift.type* @_TMaV16resilient_struct9Rectangle() @@ -81,7 +81,7 @@ public struct MySize { public let h: Int } -// CHECK-LABEL: define void @_TF17struct_resilience28functionWithMyResilientTypesFTVS_6MySize1fFS0_S0__S0_(%V17struct_resilience6MySize* {{.*}}, %V17struct_resilience6MySize* {{.*}}, i8*, %swift.refcounted*) +// CHECK-LABEL: define{{( protected)?}} void @_TF17struct_resilience28functionWithMyResilientTypesFTVS_6MySize1fFS0_S0__S0_(%V17struct_resilience6MySize* {{.*}}, %V17struct_resilience6MySize* {{.*}}, i8*, %swift.refcounted*) public func functionWithMyResilientTypes(s: MySize, f: MySize -> MySize) -> MySize { // CHECK: [[TEMP:%.*]] = alloca %V17struct_resilience6MySize @@ -111,7 +111,7 @@ public struct StructWithResilientStorage { // resilient layout, and go through the field offset vector in the // metadata when accessing stored properties. -// CHECK-LABEL: define {{i32|i64}} @_TFV17struct_resilience26StructWithResilientStorageg1nSi(%V17struct_resilience26StructWithResilientStorage* {{.*}}) +// CHECK-LABEL: define{{( protected)?}} {{i32|i64}} @_TFV17struct_resilience26StructWithResilientStorageg1nSi(%V17struct_resilience26StructWithResilientStorage* {{.*}}) // CHECK: [[METADATA:%.*]] = call %swift.type* @_TMaV17struct_resilience26StructWithResilientStorage() // CHECK-NEXT: [[METADATA_ADDR:%.*]] = bitcast %swift.type* [[METADATA]] to [[INT]]* // CHECK-NEXT: [[FIELD_OFFSET_VECTOR:%.*]] = getelementptr inbounds [[INT]], [[INT]]* [[METADATA_ADDR]], i32 3 @@ -133,7 +133,7 @@ public struct StructWithIndirectResilientEnum { } -// CHECK-LABEL: define {{i32|i64}} @_TFV17struct_resilience31StructWithIndirectResilientEnumg1nSi(%V17struct_resilience31StructWithIndirectResilientEnum* {{.*}}) +// CHECK-LABEL: define{{( protected)?}} {{i32|i64}} @_TFV17struct_resilience31StructWithIndirectResilientEnumg1nSi(%V17struct_resilience31StructWithIndirectResilientEnum* {{.*}}) // CHECK: [[FIELD_PTR:%.*]] = getelementptr inbounds %V17struct_resilience31StructWithIndirectResilientEnum, %V17struct_resilience31StructWithIndirectResilientEnum* %0, i32 0, i32 1 // CHECK-NEXT: [[FIELD_PAYLOAD_PTR:%.*]] = getelementptr inbounds %Si, %Si* [[FIELD_PTR]], i32 0, i32 0 // CHECK-NEXT: [[FIELD_PAYLOAD:%.*]] = load [[INT]], [[INT]]* [[FIELD_PAYLOAD_PTR]] @@ -142,13 +142,13 @@ public struct StructWithIndirectResilientEnum { // Public metadata accessor for our resilient struct -// CHECK-LABEL: define %swift.type* @_TMaV17struct_resilience6MySize() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @_TMaV17struct_resilience6MySize() // CHECK: ret %swift.type* bitcast ([[INT]]* getelementptr inbounds {{.*}} @_TMfV17struct_resilience6MySize, i32 0, i32 1) to %swift.type*) // FIXME: this should modify the template in-place instead of copying it -// CHECK-LABEL: define private %swift.type* @create_generic_metadata_StructWithResilientStorage(%swift.type_pattern*, i8**) +// CHECK-LABEL: define{{( protected)?}} private %swift.type* @create_generic_metadata_StructWithResilientStorage(%swift.type_pattern*, i8**) // CHECK: [[FIELDS:%.*]] = alloca [4 x i8**] // CHECK: [[RESULT:%.*]] = call %swift.type* @swift_allocateGenericValueMetadata(%swift.type_pattern* %0, i8** %1) // CHECK: [[RESULT_ADDR:%.*]] = bitcast %swift.type* [[RESULT]] to i8** diff --git a/test/IRGen/super.sil b/test/IRGen/super.sil index dc65e0a27ff70..7310e1b86051b 100644 --- a/test/IRGen/super.sil +++ b/test/IRGen/super.sil @@ -51,7 +51,7 @@ bb0(%0 : $ChildToResilientParent): } // ChildToResilientParent is in our resilience domain - can load the superclass's metadata directly. -// CHECK-LABEL: define void @_TFC5super22ChildToResilientParent6methodfT_T_(%C5super22ChildToResilientParent*) +// CHECK-LABEL: define{{( protected)?}} void @_TFC5super22ChildToResilientParent6methodfT_T_(%C5super22ChildToResilientParent*) // CHECK: [[SUPER_METADATA:%[0-9]+]] = call %swift.type* @_TMaC15resilient_class22ResilientOutsideParent() // CHECK: [[OPAQUE_SUPER_METADATA:%[0-9]+]] = bitcast %swift.type* [[SUPER_METADATA]] to void (%C15resilient_class22ResilientOutsideParent*)** // CHECK: [[VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%C15resilient_class22ResilientOutsideParent*)*, void (%C15resilient_class22ResilientOutsideParent*)** [[OPAQUE_SUPER_METADATA]] @@ -70,7 +70,7 @@ bb0(%0 : $@thick ChildToResilientParent.Type): } // ChildToResilientParent is in our resilience domain - can load the superclass's metadata directly. -// CHECK-LABEL: define void @_TZFC5super22ChildToResilientParent11classMethodfT_T_(%swift.type*) +// CHECK-LABEL: define{{( protected)?}} void @_TZFC5super22ChildToResilientParent11classMethodfT_T_(%swift.type*) // CHECK: [[SUPER_METADATA:%[0-9]+]] = call %swift.type* @_TMaC15resilient_class22ResilientOutsideParent() // CHECK: [[OPAQUE_SUPER_METADATA:%[0-9]+]] = bitcast %swift.type* [[SUPER_METADATA]] to void (%swift.type*)** // CHECK: [[VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%swift.type*)*, void (%swift.type*)** [[OPAQUE_SUPER_METADATA]] @@ -97,7 +97,7 @@ bb0(%0 : $ChildToFixedParent): return %7 : $() } -// CHECK-LABEL: define void @_TFC5super18ChildToFixedParent6methodfT_T_(%C5super18ChildToFixedParent*) +// CHECK-LABEL: define{{( protected)?}} void @_TFC5super18ChildToFixedParent6methodfT_T_(%C5super18ChildToFixedParent*) // CHECK: [[SUPER_METADATA:%[0-9]+]] = call %swift.type* @_TMaC15resilient_class13OutsideParent() // CHECK: [[OPAQUE_SUPER_METADATA:%[0-9]+]] = bitcast %swift.type* [[SUPER_METADATA]] to void (%C15resilient_class13OutsideParent*)** // CHECK: [[VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%C15resilient_class13OutsideParent*)*, void (%C15resilient_class13OutsideParent*)** [[OPAQUE_SUPER_METADATA]] @@ -117,7 +117,7 @@ bb0(%0 : $@thick ChildToFixedParent.Type): } // ChildToFixedParent is in our resilience domain - load super metadata directly. -// CHECK-LABEL: define void @_TZFC5super18ChildToFixedParent11classMethodfT_T_(%swift.type*) +// CHECK-LABEL: define{{( protected)?}} void @_TZFC5super18ChildToFixedParent11classMethodfT_T_(%swift.type*) // CHECK: [[SUPER_METADATA:%[0-9]+]] = call %swift.type* @_TMaC15resilient_class13OutsideParent() // CHECK: [[OPAQUE_SUPER_METADATA:%[0-9]+]] = bitcast %swift.type* [[SUPER_METADATA]] to void (%swift.type*)** // CHECK: [[VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%swift.type*)*, void (%swift.type*)** [[OPAQUE_SUPER_METADATA]] @@ -139,7 +139,7 @@ bb0(%0 : $ResilientOutsideChild): } // Extending a resilient class - load super metadata indirectly. -// CHECK-LABEL: define void @_TFE5superC15resilient_class21ResilientOutsideChild15callSuperMethodfT_T_(%C15resilient_class21ResilientOutsideChild*) +// CHECK-LABEL: define{{( protected)?}} void @_TFE5superC15resilient_class21ResilientOutsideChild15callSuperMethodfT_T_(%C15resilient_class21ResilientOutsideChild*) // CHECK: [[METADATA:%[0-9]+]] = call %swift.type* @_TMaC15resilient_class21ResilientOutsideChild() // CHECK: [[OPAQUE_METADATA:%[0-9]+]] = bitcast %swift.type* [[METADATA]] to %swift.type** // CHECK: [[SUPER_METADATA_PTR:%[0-9]+]] = getelementptr inbounds %swift.type*, %swift.type** [[OPAQUE_METADATA]], i32 1 @@ -162,7 +162,7 @@ bb0(%0 : $@thick ResilientOutsideChild.Type): } // Extending a resilient class - load super metadata indirectly. -// CHECK-LABEL: define void @_TZFE5superC15resilient_class21ResilientOutsideChild20callSuperClassMethodfT_T_(%swift.type*) +// CHECK-LABEL: define{{( protected)?}} void @_TZFE5superC15resilient_class21ResilientOutsideChild20callSuperClassMethodfT_T_(%swift.type*) // CHECK: [[METADATA:%[0-9]+]] = call %swift.type* @_TMaC15resilient_class21ResilientOutsideChild() // CHECK: [[OPAQUE_METADATA:%[0-9]+]] = bitcast %swift.type* [[METADATA]] to %swift.type** // CHECK: [[SUPER_METADATA_PTR:%[0-9]+]] = getelementptr inbounds %swift.type*, %swift.type** [[OPAQUE_METADATA]], i32 1 diff --git a/test/IRGen/swift_native_objc_runtime_base.sil b/test/IRGen/swift_native_objc_runtime_base.sil index d2211b299a3a1..6d76c6fab87f5 100644 --- a/test/IRGen/swift_native_objc_runtime_base.sil +++ b/test/IRGen/swift_native_objc_runtime_base.sil @@ -1,7 +1,7 @@ // RUN: %target-swift-frontend -emit-ir %s | FileCheck %s // REQUIRES: objc_interop -// CHECK-LABEL: @_TMmC30swift_native_objc_runtime_base1C = global %objc_class { +// CHECK-LABEL: @_TMmC30swift_native_objc_runtime_base1C = {{(protected )?}}global %objc_class { // -- metaclass "isa" is root metaclass // CHECK: %objc_class* @"OBJC_METACLASS_$_NSObject", // -- metaclass "super" is super metaclass diff --git a/test/IRGen/type_layout.swift b/test/IRGen/type_layout.swift index 6b9dff67294e2..b52ba52cd146c 100644 --- a/test/IRGen/type_layout.swift +++ b/test/IRGen/type_layout.swift @@ -16,8 +16,8 @@ enum EMult { case X(Int64), Y(Int64) } @_alignment(4) struct CommonLayout { var x,y,z,w: Int8 } -// CHECK: @_TMPV11type_layout14TypeLayoutTest = global {{.*}} @create_generic_metadata_TypeLayoutTest -// CHECK: define private %swift.type* @create_generic_metadata_TypeLayoutTest +// CHECK: @_TMPV11type_layout14TypeLayoutTest = {{(protected )?}}global {{.*}} @create_generic_metadata_TypeLayoutTest +// CHECK: define{{( protected)?}} private %swift.type* @create_generic_metadata_TypeLayoutTest struct TypeLayoutTest { // -- dynamic layout, projected from metadata // CHECK: [[T0:%.*]] = bitcast %swift.type* %T to i8*** diff --git a/test/IRGen/type_layout_objc.swift b/test/IRGen/type_layout_objc.swift index 6f9ea679b25d2..a1aafb914feb3 100644 --- a/test/IRGen/type_layout_objc.swift +++ b/test/IRGen/type_layout_objc.swift @@ -20,8 +20,8 @@ enum EMult { case X(Int64), Y(Int64) } @_alignment(4) struct CommonLayout { var x,y,z,w: Int8 } -// CHECK: @_TMPV16type_layout_objc14TypeLayoutTest = global {{.*}} @create_generic_metadata_TypeLayoutTest -// CHECK: define private %swift.type* @create_generic_metadata_TypeLayoutTest +// CHECK: @_TMPV16type_layout_objc14TypeLayoutTest = {{(protected )?}}global {{.*}} @create_generic_metadata_TypeLayoutTest +// CHECK: define{{( protected)?}} private %swift.type* @create_generic_metadata_TypeLayoutTest struct TypeLayoutTest { // -- dynamic layout, projected from metadata // CHECK: [[T0:%.*]] = bitcast %swift.type* %T to i8*** diff --git a/test/IRGen/type_layout_reference_storage.swift b/test/IRGen/type_layout_reference_storage.swift index f8097ec4d3eae..49c746f5d5b2a 100644 --- a/test/IRGen/type_layout_reference_storage.swift +++ b/test/IRGen/type_layout_reference_storage.swift @@ -4,8 +4,8 @@ class C {} protocol P: class {} protocol Q: class {} -// CHECK: @_TMPV29type_layout_reference_storage26ReferenceStorageTypeLayout = global {{.*}} @create_generic_metadata_ReferenceStorageTypeLayout -// CHECK: define private %swift.type* @create_generic_metadata_ReferenceStorageTypeLayout +// CHECK: @_TMPV29type_layout_reference_storage26ReferenceStorageTypeLayout = {{(protected )?}}global {{.*}} @create_generic_metadata_ReferenceStorageTypeLayout +// CHECK: define{{( protected)?}} private %swift.type* @create_generic_metadata_ReferenceStorageTypeLayout struct ReferenceStorageTypeLayout { var z: T diff --git a/test/IRGen/type_layout_reference_storage_objc.swift b/test/IRGen/type_layout_reference_storage_objc.swift index 7305f8be8036b..4ea7822c6086a 100644 --- a/test/IRGen/type_layout_reference_storage_objc.swift +++ b/test/IRGen/type_layout_reference_storage_objc.swift @@ -8,8 +8,8 @@ class C: NSObject {} @objc protocol Q {} protocol NonObjC: class {} -// CHECK: @_TMPV34type_layout_reference_storage_objc26ReferenceStorageTypeLayout = global {{.*}} @create_generic_metadata_ReferenceStorageTypeLayout -// CHECK: define private %swift.type* @create_generic_metadata_ReferenceStorageTypeLayout +// CHECK: @_TMPV34type_layout_reference_storage_objc26ReferenceStorageTypeLayout = {{(protected )?}}global {{.*}} @create_generic_metadata_ReferenceStorageTypeLayout +// CHECK: define{{( protected)?}} private %swift.type* @create_generic_metadata_ReferenceStorageTypeLayout struct ReferenceStorageTypeLayout { var z: T diff --git a/test/IRGen/typed_boxes.sil b/test/IRGen/typed_boxes.sil index a662817fdc6ff..2ea002c623723 100644 --- a/test/IRGen/typed_boxes.sil +++ b/test/IRGen/typed_boxes.sil @@ -4,7 +4,7 @@ sil_stage canonical import Builtin -// CHECK-LABEL: define void @pod_box_8_8_a +// CHECK-LABEL: define{{( protected)?}} void @pod_box_8_8_a sil @pod_box_8_8_a : $@convention(thin) () -> () { entry: // CHECK: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_allocObject(%swift.type* {{.*}} [[POD_8_8_METADATA:@metadata[0-9.]*]], {{.*}} [[WORD:i[0-9]+]] 24, [[WORD]] 7) @@ -20,7 +20,7 @@ entry: return undef : $() } -// CHECK-LABEL: define void @pod_box_8_8_b +// CHECK-LABEL: define{{( protected)?}} void @pod_box_8_8_b sil @pod_box_8_8_b : $@convention(thin) () -> () { entry: // CHECK: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_allocObject(%swift.type* {{.*}} [[POD_8_8_METADATA]], {{.*}} [[WORD]] 24, [[WORD]] 7) @@ -41,7 +41,7 @@ struct OverAligned { var x,y,z,w: Builtin.Int64 } -// CHECK-LABEL: define void @pod_box_32_32 +// CHECK-LABEL: define{{( protected)?}} void @pod_box_32_32 sil @pod_box_32_32 : $@convention(thin) () -> () { entry: // CHECK: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_allocObject(%swift.type* {{.*}} [[POD_32_32_METADATA:@metadata[0-9.]*]], {{.*}} [[WORD]] 64, [[WORD]] 31) @@ -62,7 +62,7 @@ sil_vtable C {} class D {} sil_vtable D {} -// CHECK-LABEL: define void @rc_box_a +// CHECK-LABEL: define{{( protected)?}} void @rc_box_a sil @rc_box_a : $@convention(thin) () -> () { entry: // CHECK-32: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_allocObject(%swift.type* {{.*}} [[NATIVE_RC_METADATA:@metadata[0-9.]*]], {{.*}} [[WORD]] 16, [[WORD]] 3) @@ -74,7 +74,7 @@ entry: return undef : $() } -// CHECK-LABEL: define void @rc_box_b +// CHECK-LABEL: define{{( protected)?}} void @rc_box_b sil @rc_box_b : $@convention(thin) () -> () { entry: // TODO: Should reuse metadata @@ -87,7 +87,7 @@ entry: return undef : $() } -// CHECK-LABEL: define void @unknown_rc_box +// CHECK-LABEL: define{{( protected)?}} void @unknown_rc_box sil @unknown_rc_box : $@convention(thin) () -> () { entry: // CHECK-32: [[BOX:%.*]] = call noalias %swift.refcounted* @swift_allocObject(%swift.type* {{.*}} [[UNKNOWN_RC_METADATA:@metadata[0-9.]*]], {{.*}} [[WORD]] 16, [[WORD]] 3) @@ -121,7 +121,7 @@ struct Dyn { sil @take_dyn : $@convention(thin) (@in Dyn) -> () sil @take_t : $@convention(thin) (@in T) -> () -// CHECK-LABEL: define void @dyn_box_a +// CHECK-LABEL: define{{( protected)?}} void @dyn_box_a sil @dyn_box_a : $@convention(thin) () -> () { entry: // CHECK: [[METADATA:%.*]] = call %swift.type* @_TMaV11typed_boxes3Dyn(%swift.type* %T) @@ -139,7 +139,7 @@ entry: return undef : $() } -// CHECK-LABEL: define void @dyn_box_b +// CHECK-LABEL: define{{( protected)?}} void @dyn_box_b sil @dyn_box_b : $@convention(thin) () -> () { entry: // CHECK: [[ALLOC:%.*]] = call { %swift.refcounted*, %swift.opaque* } @swift_allocBox(%swift.type* %T) @@ -155,7 +155,7 @@ entry: return undef : $() } -// CHECK-LABEL: define i64 @proj_box +// CHECK-LABEL: define{{( protected)?}} i64 @proj_box sil @proj_box : $@convention(thin) (@box Builtin.Int64) -> Builtin.Int64 { entry(%0 : $@box Builtin.Int64): // CHECK-32: [[BOX_RAW:%.*]] = bitcast %swift.refcounted* %0 to [[POD_8_8_LAYOUT:<\{ %swift.refcounted, \[4 x i8\], \[8 x i8\] \}>]]* @@ -170,7 +170,7 @@ entry(%0 : $@box Builtin.Int64): return %l : $Builtin.Int64 } -// CHECK-LABEL: define void @dyn_proj_box_a +// CHECK-LABEL: define{{( protected)?}} void @dyn_proj_box_a sil @dyn_proj_box_a : $@convention(thin) (@box Dyn) -> () { entry(%0 : $@box Dyn): // CHECK: [[PTR:%.*]] = call %swift.opaque* @swift_projectBox(%swift.refcounted* %0) @@ -183,7 +183,7 @@ entry(%0 : $@box Dyn): } -// CHECK-LABEL: define void @dyn_proj_box_b +// CHECK-LABEL: define{{( protected)?}} void @dyn_proj_box_b sil @dyn_proj_box_b : $@convention(thin) (@box T) -> () { entry(%0 : $@box T): // CHECK: [[PTR:%.*]] = call %swift.opaque* @swift_projectBox(%swift.refcounted* %0) diff --git a/test/IRGen/typemetadata.sil b/test/IRGen/typemetadata.sil index d6f9d9644bf56..546e87a6efbdc 100644 --- a/test/IRGen/typemetadata.sil +++ b/test/IRGen/typemetadata.sil @@ -25,7 +25,7 @@ bb0: return %100 : $() } -// CHECK-LABEL: define %swift.type* @_TMaC12typemetadata1C() +// CHECK-LABEL: define{{( protected)?}} %swift.type* @_TMaC12typemetadata1C() // CHECK: [[T0:%.*]] = load %swift.type*, %swift.type** @_TMLC12typemetadata1C, align 8 // CHECK-NEXT: [[T1:%.*]] = icmp eq %swift.type* [[T0]], null // CHECK-NEXT: br i1 [[T1]] diff --git a/test/IRGen/unconditional_checked_cast.sil b/test/IRGen/unconditional_checked_cast.sil index a06f38ab51521..81aff4b048868 100644 --- a/test/IRGen/unconditional_checked_cast.sil +++ b/test/IRGen/unconditional_checked_cast.sil @@ -10,7 +10,7 @@ sil_vtable C {} class D : C {} sil_vtable D {} -// CHECK-LABEL: define void @downcast_test(%C26unconditional_checked_cast1D** noalias nocapture sret, %C26unconditional_checked_cast1C** nocapture dereferenceable({{.*}})) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @downcast_test(%C26unconditional_checked_cast1D** noalias nocapture sret, %C26unconditional_checked_cast1C** nocapture dereferenceable({{.*}})) {{.*}} { // CHECK: entry: // CHECK-NEXT: [[INPUTPTR:%[0-9]+]] = load %C26unconditional_checked_cast1C*, %C26unconditional_checked_cast1C** [[INPUTPTRPTR:%[0-9]+]], align 8 // CHECK-NEXT: [[I8INPUTPTR:%[0-9]+]] = bitcast %C26unconditional_checked_cast1C* [[INPUTPTR]] to i8* diff --git a/test/IRGen/undef.sil b/test/IRGen/undef.sil index fed729920e914..f105eba6ed287 100644 --- a/test/IRGen/undef.sil +++ b/test/IRGen/undef.sil @@ -4,7 +4,7 @@ import Builtin -// CHECK: define void @undefined() {{.*}} { +// CHECK: define{{( protected)?}} void @undefined() {{.*}} { // CHECK: entry: // CHECK: store i64 undef, i64* undef, align 8 // CHECK: store i8 undef, i8* undef, align 8 diff --git a/test/IRGen/unowned.sil b/test/IRGen/unowned.sil index f07b7ef8294b6..aea3ad594382d 100644 --- a/test/IRGen/unowned.sil +++ b/test/IRGen/unowned.sil @@ -26,7 +26,7 @@ bb0(%0 : $@sil_unowned C): %3 = tuple () %4 = return %3 : $() } -// CHECK: define void @test_weak_rr_class([[C]]*) {{.*}} { +// CHECK: define{{( protected)?}} void @test_weak_rr_class([[C]]*) {{.*}} { // CHECK: call void bitcast (void ([[REF]]*)* @swift_unownedRetain to void ([[C]]*)*)([[C]]* %0) // CHECK-NEXT: call void bitcast (void ([[REF]]*)* @swift_unownedRelease to void ([[C]]*)*)([[C]]* %0) // CHECK-NEXT: ret void @@ -38,7 +38,7 @@ bb0(%0 : $@sil_unowned P): %3 = tuple () %4 = return %3 : $() } -// CHECK: define void @test_weak_rr_proto(%swift.refcounted*, i8**) {{.*}} { +// CHECK: define{{( protected)?}} void @test_weak_rr_proto(%swift.refcounted*, i8**) {{.*}} { // CHECK: call void @swift_unownedRetain(%swift.refcounted* %0) // CHECK: call void @swift_unownedRelease(%swift.refcounted* %0) // CHECK-NEXT: ret void diff --git a/test/IRGen/unowned_objc.sil b/test/IRGen/unowned_objc.sil index 44cf29c525d8b..708e32d23cdb3 100644 --- a/test/IRGen/unowned_objc.sil +++ b/test/IRGen/unowned_objc.sil @@ -33,12 +33,12 @@ bb0(%0 : $@sil_unowned C): %3 = tuple () %4 = return %3 : $() } -// CHECK: define void @test_weak_rr_class([[C]]*) {{.*}} { +// CHECK: define{{( protected)?}} void @test_weak_rr_class([[C]]*) {{.*}} { // CHECK: call void bitcast (void ([[REF]]*)* @swift_unownedRetain to void ([[C]]*)*)([[C]]* %0) // CHECK-NEXT: call void bitcast (void ([[REF]]*)* @swift_unownedRelease to void ([[C]]*)*)([[C]]* %0) // CHECK-NEXT: ret void -// CHECK: define void @test_unknown_unowned_copies([[UNKNOWN]]*, i8**, [[UNKNOWN]]*, i8**) +// CHECK: define{{( protected)?}} void @test_unknown_unowned_copies([[UNKNOWN]]*, i8**, [[UNKNOWN]]*, i8**) sil @test_unknown_unowned_copies : $@convention(thin) (@owned P, @owned P) -> () { bb0(%p : $P, %q : $P): diff --git a/test/IRGen/unused.sil b/test/IRGen/unused.sil index fb4f9ad03f2b2..0ee25ec6c9f45 100644 --- a/test/IRGen/unused.sil +++ b/test/IRGen/unused.sil @@ -50,7 +50,7 @@ bb0: // CHECK: define linkonce_odr hidden void @qux() // CHECK: define hidden void @fred() -// CHECK: define void @frieda() +// CHECK: define{{( protected)?}} void @frieda() // NEGATIVE-NOT: @foo // NEGATIVE-NOT: @bar diff --git a/test/IRGen/upcast.sil b/test/IRGen/upcast.sil index c99aa203e2f5e..3b85b47f73445 100644 --- a/test/IRGen/upcast.sil +++ b/test/IRGen/upcast.sil @@ -2,7 +2,7 @@ // Make sure that we are able to lower upcast addresses. -// CHECK-LABEL: define void @upcast_test(%C6upcast1D** nocapture dereferenceable({{.*}})) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @upcast_test(%C6upcast1D** nocapture dereferenceable({{.*}})) {{.*}} { // CHECK: entry: // CHECK-NEXT: bitcast %C6upcast1D** {{%[0-0]+}} to %C6upcast1C** // CHECK-NEXT: ret void diff --git a/test/IRGen/value_buffers.sil b/test/IRGen/value_buffers.sil index ffae572aff942..4a7f2f24cfb60 100644 --- a/test/IRGen/value_buffers.sil +++ b/test/IRGen/value_buffers.sil @@ -18,7 +18,7 @@ entry(%b : $*Builtin.UnsafeValueBuffer, %v : $Int): %r = tuple () return %r : $() } -// CHECK-LABEL: define void @alloc_small([24 x i8]* nocapture dereferenceable({{.*}}), i64) +// CHECK-LABEL: define{{( protected)?}} void @alloc_small([24 x i8]* nocapture dereferenceable({{.*}}), i64) // CHECK-NEXT: entry: // CHECK-NEXT: [[T0:%.*]] = bitcast [24 x i8]* %0 to %Si* // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds %Si, %Si* [[T0]], i32 0, i32 0 @@ -32,7 +32,7 @@ entry(%b : $*Builtin.UnsafeValueBuffer, %v : $Int): %r = tuple () return %r : $() } -// CHECK-LABEL: define void @project_small([24 x i8]* nocapture dereferenceable({{.*}}), i64) +// CHECK-LABEL: define{{( protected)?}} void @project_small([24 x i8]* nocapture dereferenceable({{.*}}), i64) // CHECK-NEXT: entry: // CHECK-NEXT: [[T0:%.*]] = bitcast [24 x i8]* %0 to %Si* // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds %Si, %Si* [[T0]], i32 0, i32 0 @@ -45,7 +45,7 @@ entry(%b : $*Builtin.UnsafeValueBuffer): %r = tuple () return %r : $() } -// CHECK-LABEL: define void @dealloc_small([24 x i8]* nocapture dereferenceable({{.*}})) +// CHECK-LABEL: define{{( protected)?}} void @dealloc_small([24 x i8]* nocapture dereferenceable({{.*}})) // CHECK-NEXT: entry: // CHECK-NEXT: ret void @@ -56,7 +56,7 @@ entry(%b : $*Builtin.UnsafeValueBuffer, %v : $BigStruct): %r = tuple () return %r : $() } -// CHECK-LABEL: define void @alloc_big([24 x i8]* nocapture dereferenceable({{.*}}), %V13value_buffers9BigStruct* noalias nocapture dereferenceable({{.*}})) +// CHECK-LABEL: define{{( protected)?}} void @alloc_big([24 x i8]* nocapture dereferenceable({{.*}}), %V13value_buffers9BigStruct* noalias nocapture dereferenceable({{.*}})) // CHECK-NEXT: entry: // CHECK: [[SLOT0:%.*]] = load i64 // CHECK: [[SLOT1:%.*]] = load i64 @@ -87,7 +87,7 @@ entry(%b : $*Builtin.UnsafeValueBuffer, %v : $BigStruct): %r = tuple () return %r : $() } -// CHECK-LABEL: define void @project_big([24 x i8]* nocapture dereferenceable({{.*}}), %V13value_buffers9BigStruct* noalias nocapture dereferenceable({{.*}})) +// CHECK-LABEL: define{{( protected)?}} void @project_big([24 x i8]* nocapture dereferenceable({{.*}}), %V13value_buffers9BigStruct* noalias nocapture dereferenceable({{.*}})) // CHECK-NEXT: entry: // CHECK: [[SLOT0:%.*]] = load i64 // CHECK: [[SLOT1:%.*]] = load i64 @@ -115,7 +115,7 @@ entry(%b : $*Builtin.UnsafeValueBuffer): %r = tuple () return %r : $() } -// CHECK-LABEL: define void @dealloc_big([24 x i8]* nocapture dereferenceable({{.*}})) +// CHECK-LABEL: define{{( protected)?}} void @dealloc_big([24 x i8]* nocapture dereferenceable({{.*}})) // CHECK-NEXT: entry: // CHECK-NEXT: [[T0:%.*]] = bitcast [24 x i8]* %0 to i8** // CHECK-NEXT: [[ADDR:%.*]] = load i8*, i8** [[T0]], align 8 diff --git a/test/IRGen/vtable.sil b/test/IRGen/vtable.sil index 9e87e2b615140..a1ff43578f9f9 100644 --- a/test/IRGen/vtable.sil +++ b/test/IRGen/vtable.sil @@ -29,7 +29,7 @@ sil @_TFC6vtable1CD : $@convention(method) (@owned C) -> () // CHECK-objc: i64 add (i64 ptrtoint ({ i32, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, i8* }* @_DATA__TtC6vtable1C to i64), i64 1), // CHECK-objc: i32 3, i32 0, i32 16, i16 7, i16 0, // CHECK-objc: i32 112, i32 16, -// CHECK-objc: @_TMnC6vtable1C, +// CHECK-objc: @_TMnC6vtable1C // CHECK-objc: [[C]]* (%swift.type*)* @_TFC6vtable1CCfMS0_FT_S0_, // CHECK-objc: [[C]]* ([[C]]*)* @_TFC6vtable1CcfMS0_FT_S0_ // CHECK-objc: }> @@ -44,7 +44,7 @@ sil @_TFC6vtable1CD : $@convention(method) (@owned C) -> () // CHECK-native: i64 1, // CHECK-native: i32 3, i32 0, i32 16, i16 7, i16 0, // CHECK-native: i32 112, i32 16, -// CHECK-native: @_TMnC6vtable1C, +// CHECK-native: @_TMnC6vtable1C // CHECK-native: [[C]]* (%swift.type*)* @_TFC6vtable1CCfMS0_FT_S0_, // CHECK-native: [[C]]* ([[C]]*)* @_TFC6vtable1CcfMS0_FT_S0_ // CHECK-native: }> diff --git a/test/IRGen/weak.sil b/test/IRGen/weak.sil index c6e600ea69526..2ef612ef40044 100644 --- a/test/IRGen/weak.sil +++ b/test/IRGen/weak.sil @@ -41,7 +41,7 @@ bb0(%0 : $*A, %1 : $Optional): %4 = tuple () return %4 : $() } -// CHECK: define void @test_weak_load_store([[A]]* nocapture dereferenceable({{.*}}), i64) {{.*}} { +// CHECK: define{{( protected)?}} void @test_weak_load_store([[A]]* nocapture dereferenceable({{.*}}), i64) {{.*}} { // CHECK: [[X:%.*]] = getelementptr inbounds [[A]], [[A]]* %0, i32 0, i32 0 // CHECK-NEXT: [[T0:%.*]] = call [[C]]* bitcast ([[REF]]* ([[WEAK]]*)* @swift_weakLoadStrong to [[C]]* ([[WEAK]]*)*)([[WEAK]]* [[X]]) // CHECK-NEXT: %3 = ptrtoint %C4weak1C* %2 to i64 @@ -64,7 +64,7 @@ bb0(%0 : $*B, %1 : $Optional

): %4 = tuple () return %4 : $() } -// CHECK: define void @test_weak_load_store_proto([[B]]* nocapture dereferenceable({{.*}}), i64, i64) +// CHECK: define{{( protected)?}} void @test_weak_load_store_proto([[B]]* nocapture dereferenceable({{.*}}), i64, i64) // CHECK: [[X:%.*]] = getelementptr inbounds [[B]], [[B]]* %0, i32 0, i32 0 // CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds { [[WEAK]], i8** }, { [[WEAK]], i8** }* [[X]], i32 0, i32 0 // CHECK-NEXT: [[T1:%.*]] = call [[UNKNOWN]]* @swift_unknownWeakLoadStrong([[WEAK]]* [[T0]]) @@ -88,7 +88,7 @@ bb0(%0 : $Optional

): %4 = tuple () return %4 : $() } -// CHECK: define void @test_weak_alloc_stack(i64, i64) +// CHECK: define{{( protected)?}} void @test_weak_alloc_stack(i64, i64) // CHECK: [[X:%.*]] = alloca { [[WEAK]], i8** }, align 8 // CHECK: [[TMPOBJ:%.*]] = inttoptr {{.*}} to %objc_object* // CHECK: [[TMPTAB:%.*]] = inttoptr {{.*}} to i8** diff --git a/test/IRGen/weak_class_protocol.sil b/test/IRGen/weak_class_protocol.sil index e2288ab35a347..e70d0089799f5 100644 --- a/test/IRGen/weak_class_protocol.sil +++ b/test/IRGen/weak_class_protocol.sil @@ -6,7 +6,7 @@ import Swift protocol Foo: class { } -// CHECK-LABEL: define void @store_weak({ %swift.weak, i8** }* noalias nocapture sret, i64, i64) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @store_weak({ %swift.weak, i8** }* noalias nocapture sret, i64, i64) {{.*}} { // CHECK: entry: // CHECK-objc: [[INSTANCE:%.*]] = inttoptr i64 %1 to %objc_object* // CHECK-native: [[INSTANCE:%.*]] = inttoptr i64 %1 to %swift.refcounted* diff --git a/test/IRGen/witness_method.sil b/test/IRGen/witness_method.sil index 8635b82fb8bc3..1d46dc2f24ee8 100644 --- a/test/IRGen/witness_method.sil +++ b/test/IRGen/witness_method.sil @@ -9,7 +9,7 @@ protocol DefCon { } -// CHECK-LABEL: define void @defcon(%swift.opaque* noalias nocapture sret, %swift.type*, %swift.type* %T, i8** %T.DefCon) {{.*}} { +// CHECK-LABEL: define{{( protected)?}} void @defcon(%swift.opaque* noalias nocapture sret, %swift.type*, %swift.type* %T, i8** %T.DefCon) {{.*}} { sil @defcon : $@convention(thin) (@out T, @thick T.Type) -> () { entry(%0: $*T, %1: $@thick T.Type): @@ -31,7 +31,7 @@ struct ImplementsDerived : Derived { func foo() {} } -// CHECK-LABEL: define void @testInheritedConformance +// CHECK-LABEL: define{{( protected)?}} void @testInheritedConformance sil @testInheritedConformance : $@convention(thin) (@in ImplementsDerived) -> () { entry(%0: $*ImplementsDerived): // CHECK: [[WITNESS:%.*]] = load i8*, i8** @_TWPV14witness_method17ImplementsDerivedS_4BaseS_ diff --git a/test/LLVMPasses/basic.ll b/test/LLVMPasses/basic.ll index 16a60223e79fb..31b7b7d8c37cc 100644 --- a/test/LLVMPasses/basic.ll +++ b/test/LLVMPasses/basic.ll @@ -139,7 +139,7 @@ define void @objc_retain_release_opt(%objc_object* %P, i32* %IP) { ret void } -; CHECK-LABEL: define void @swift_fixLifetimeTest +; CHECK-LABEL: define{{( protected)?}} void @swift_fixLifetimeTest ; CHECK: swift_retain ; CHECK: swift_fixLifetime ; CHECK: swift_release diff --git a/test/LLVMPasses/contract.ll b/test/LLVMPasses/contract.ll index 63a48e8927d5f..476ac4f5bd23b 100644 --- a/test/LLVMPasses/contract.ll +++ b/test/LLVMPasses/contract.ll @@ -20,7 +20,7 @@ declare void @user(%swift.refcounted*) declare void @noread_user_bridged(%swift.bridge*) readnone declare void @user_bridged(%swift.bridge*) -; CHECK-LABEL: define void @fixlifetime_removal(i8*) { +; CHECK-LABEL: define{{( protected)?}} void @fixlifetime_removal(i8*) { ; CHECK-NOT: call void swift_fixLifetime define void @fixlifetime_removal(i8*) { entry: @@ -29,7 +29,7 @@ entry: ret void } -; CHECK-LABEL: define %swift.refcounted* @swift_contractRetainN(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractRetainN(%swift.refcounted* %A) { ; CHECK: entry: ; CHECK-NEXT: br i1 undef ; CHECK: bb1: @@ -67,7 +67,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractRetainNWithRCIdentity(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractRetainNWithRCIdentity(%swift.refcounted* %A) { ; CHECK: entry: ; CHECK-NEXT: br i1 undef ; CHECK: bb1: @@ -99,7 +99,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractReleaseN(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractReleaseN(%swift.refcounted* %A) { ; CHECK: entry: ; CHECK-NEXT: br i1 undef ; CHECK: bb1: @@ -137,7 +137,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractReleaseNWithRCIdentity(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractReleaseNWithRCIdentity(%swift.refcounted* %A) { ; CHECK: entry: ; CHECK-NEXT: br i1 undef ; CHECK: bb1: @@ -173,7 +173,7 @@ bb3: ; Make sure that we do not form retainN,releaseN over uses that may ; read the reference count of the object. -; CHECK-LABEL: define %swift.refcounted* @swift_contractRetainNWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractRetainNWithUnknown(%swift.refcounted* %A) { ; CHECK-NOT: call %swift.refcounted* @swift_retain_n define %swift.refcounted* @swift_contractRetainNWithUnknown(%swift.refcounted* %A) { entry: @@ -197,7 +197,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractReleaseNWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractReleaseNWithUnknown(%swift.refcounted* %A) { ; CHECK-NOT: call void @swift_release_n define %swift.refcounted* @swift_contractReleaseNWithUnknown(%swift.refcounted* %A) { entry: @@ -222,7 +222,7 @@ bb3: } ; But do make sure that we can form retainN, releaseN in between such uses -; CHECK-LABEL: define %swift.refcounted* @swift_contractRetainNInterleavedWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractRetainNInterleavedWithUnknown(%swift.refcounted* %A) { ; CHECK: bb1: ; CHECK: tail call void @swift_retain(%swift.refcounted* %A) ; CHECK-NEXT: call void @user(%swift.refcounted* %A) @@ -274,7 +274,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { ; CHECK: bb1: ; CHECK-NEXT: @swift_release( ; CHECK-NEXT: @user @@ -306,7 +306,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractRetainReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractRetainReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { ; CHECK: bb1: ; CHECK-NEXT: tail call void @swift_retain(%swift.refcounted* %A) ; CHECK-NEXT: call void @user(%swift.refcounted* %A) @@ -362,7 +362,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractUnknownRetainNInterleavedWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractUnknownRetainNInterleavedWithUnknown(%swift.refcounted* %A) { ; CHECK: bb1: ; CHECK: tail call void @swift_unknownRetain(%swift.refcounted* %A) ; CHECK-NEXT: call void @user(%swift.refcounted* %A) @@ -414,7 +414,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractUnknownReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractUnknownReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { ; CHECK: bb1: ; CHECK-NEXT: @swift_unknownRelease( ; CHECK-NEXT: @user @@ -446,7 +446,7 @@ bb3: ret %swift.refcounted* %A } -; CHECK-LABEL: define %swift.refcounted* @swift_contractUnknownRetainReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.refcounted* @swift_contractUnknownRetainReleaseNInterleavedWithUnknown(%swift.refcounted* %A) { ; CHECK: bb1: ; CHECK-NEXT: tail call void @swift_unknownRetain(%swift.refcounted* %A) ; CHECK-NEXT: call void @user(%swift.refcounted* %A) @@ -502,7 +502,7 @@ bb3: } -; CHECK-LABEL: define %swift.bridge* @swift_contractBridgeRetainWithBridge(%swift.bridge* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.bridge* @swift_contractBridgeRetainWithBridge(%swift.bridge* %A) { ; CHECK: bb1: ; CHECK-NEXT: [[RET0:%.+]] = tail call %swift.bridge* @swift_bridgeObjectRetain_n(%swift.bridge* %A, i32 2) ; CHECK-NEXT: tail call void @swift_bridgeObjectRelease(%swift.bridge* [[RET0:%.+]]) @@ -517,7 +517,7 @@ bb1: ret %swift.bridge* %A } -; CHECK-LABEL: define %swift.bridge* @swift_contractBridgeRetainReleaseNInterleavedWithBridge(%swift.bridge* %A) { +; CHECK-LABEL: define{{( protected)?}} %swift.bridge* @swift_contractBridgeRetainReleaseNInterleavedWithBridge(%swift.bridge* %A) { ; CHECK: bb1: ; CHECK-NEXT: [[RET0:%.+]] = tail call %swift.bridge* @swift_bridgeObjectRetain(%swift.bridge* %A) ; CHECK-NEXT: call void @user_bridged(%swift.bridge* %A) diff --git a/test/LLVMPasses/llvm-aa.ll b/test/LLVMPasses/llvm-aa.ll index 2ef1c9441cf7a..cf903735fadf3 100644 --- a/test/LLVMPasses/llvm-aa.ll +++ b/test/LLVMPasses/llvm-aa.ll @@ -5,7 +5,7 @@ target triple = "x86_64-apple-macosx10.9" declare void @swift_retain(i8 *) nounwind -; CHECK-LABEL: define i8 @test_eliminate_loads_over_retain(i8*) { +; CHECK-LABEL: define{{( protected)?}} i8 @test_eliminate_loads_over_retain(i8*) { ; CHECK: load ; CHECK-NOT: load define i8 @test_eliminate_loads_over_retain(i8*) { diff --git a/test/LLVMPasses/stack_promotion.ll b/test/LLVMPasses/stack_promotion.ll index f55383658e02f..8e0394674e2b6 100644 --- a/test/LLVMPasses/stack_promotion.ll +++ b/test/LLVMPasses/stack_promotion.ll @@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.9" %swift.type = type { i64 } %objc_object = type opaque -; CHECK-LABEL: define void @promote_buffer() +; CHECK-LABEL: define{{( protected)?}} void @promote_buffer() ; CHECK: [[B:%.+]] = alloca i8, i32 48, align 8 ; CHECK: [[M:%.+]] = call %swift.type* @get_buffer_metadata() ; CHECK: [[BC:%.+]] = bitcast i8* [[B]] to %objc_object* @@ -22,7 +22,7 @@ entry: ret void } -; CHECK-LABEL: define void @dont_promote_buffer_exceeding_limit() +; CHECK-LABEL: define{{( protected)?}} void @dont_promote_buffer_exceeding_limit() ; CHECK: [[M:%.+]] = call %swift.type* @get_buffer_metadata() ; CHECK: call %objc_object* @swift_bufferAllocate(%swift.type* [[M]], i64 48, i64 7) ; CHECK-NEXT: ret void diff --git a/test/SIL/Parser/apply_with_conformance.sil b/test/SIL/Parser/apply_with_conformance.sil index 7567f484516c9..02a03919f3836 100644 --- a/test/SIL/Parser/apply_with_conformance.sil +++ b/test/SIL/Parser/apply_with_conformance.sil @@ -18,7 +18,7 @@ struct S { // test.S.foo (test.S)(A) -> () sil @_TFV4test1S3foofS0_US_1P__FQ_T_ : $@convention(method) (@in T, S) -> () -// CHECK-LABEL: define void @_TF4test3barFTVS_1SVS_1X_T_() +// CHECK-LABEL: define{{( protected)?}} void @_TF4test3barFTVS_1SVS_1X_T_() // CHECK: call // test.bar (test.S, test.X) -> () sil @_TF4test3barFTVS_1SVS_1X_T_ : $@convention(thin) (S, X) -> () { diff --git a/test/SILGen/NSApplicationMain.swift b/test/SILGen/NSApplicationMain.swift index 742153e90bd71..bc89acf52dc16 100644 --- a/test/SILGen/NSApplicationMain.swift +++ b/test/SILGen/NSApplicationMain.swift @@ -11,7 +11,7 @@ class MyDelegate: NSApplicationDelegate {} // CHECK-LABEL: sil @main // CHECK: function_ref @NSApplicationMain -// IR-LABEL: define i32 @main +// IR-LABEL: define{{( protected)?}} i32 @main // IR: call i32 @NSApplicationMain // Ensure that we coexist with normal references to the functions we diff --git a/test/SILGen/UIApplicationMain.swift b/test/SILGen/UIApplicationMain.swift index e606290ff066f..3a0ded981978a 100644 --- a/test/SILGen/UIApplicationMain.swift +++ b/test/SILGen/UIApplicationMain.swift @@ -12,7 +12,7 @@ class MyDelegate : UIApplicationDelegate {} // CHECK-LABEL: sil @main // CHECK: function_ref @UIApplicationMain -// IR-LABEL: define i32 @main +// IR-LABEL: define{{( protected)?}} i32 @main // IR: call i32 @UIApplicationMain // Ensure that we coexist with normal references to the functions we diff --git a/test/SILGen/enum_derived.swift b/test/SILGen/enum_derived.swift index cbbda00f79de9..76313733d24d9 100644 --- a/test/SILGen/enum_derived.swift +++ b/test/SILGen/enum_derived.swift @@ -19,14 +19,14 @@ enum E { // Check if the hashValue getter can be compiled to a simple zext instruction. // CHECK-NORMAL-LABEL:define hidden i{{.*}} @_TFO12enum_derived1Eg9hashValueSi(i2) -// CHECK-TESTABLE-LABEL:define i{{.*}} @_TFO12enum_derived1Eg9hashValueSi(i2) +// CHECK-TESTABLE-LABEL:define{{( protected)?}} i{{.*}} @_TFO12enum_derived1Eg9hashValueSi(i2) // CHECK: %1 = zext i2 %0 to i{{.*}} // CHECK: ret i{{.*}} %1 // Check if the == comparison can be compiled to a simple icmp instruction. // CHECK-NORMAL-LABEL:define hidden i1 @_TZF12enum_derivedoi2eeFTOS_1ES0__Sb(i2, i2) -// CHECK-TESTABLE-LABEL:define i1 @_TZF12enum_derivedoi2eeFTOS_1ES0__Sb(i2, i2) +// CHECK-TESTABLE-LABEL:define{{( protected)?}} i1 @_TZF12enum_derivedoi2eeFTOS_1ES0__Sb(i2, i2) // CHECK: %2 = icmp eq i2 %0, %1 // CHECK: ret i1 %2 @@ -35,13 +35,13 @@ enum E { extension def_enum.TrafficLight : ErrorType {} -// CHECK-LABEL: define i{{32|64}} @_TFE12enum_derivedO8def_enum12TrafficLightg5_codeSi(i2) +// CHECK-LABEL: define{{( protected)?}} i{{32|64}} @_TFE12enum_derivedO8def_enum12TrafficLightg5_codeSi(i2) extension def_enum.Term : ErrorType {} // CHECK-NORMAL-LABEL: define hidden i64 @_TFO12enum_derived7Phantomg8rawValueVs5Int64(i1, %swift.type* nocapture readnone %T) #1 -// CHECK-TESTABLE-LABEL: define i64 @_TFO12enum_derived7Phantomg8rawValueVs5Int64(i1, %swift.type* nocapture readnone %T) #1 +// CHECK-TESTABLE-LABEL: define{{( protected)?}} i64 @_TFO12enum_derived7Phantomg8rawValueVs5Int64(i1, %swift.type* nocapture readnone %T) #1 enum Phantom : Int64 { case Up diff --git a/unittests/runtime/Metadata.cpp b/unittests/runtime/Metadata.cpp index b544f8fc2bbf0..30a323938b398 100644 --- a/unittests/runtime/Metadata.cpp +++ b/unittests/runtime/Metadata.cpp @@ -156,22 +156,22 @@ T RaceTest_ExpectEqual(std::function code) } /// Some unique global pointers. -char Global1 = 0; -char Global2 = 0; -char Global3 = 0; +uint32_t Global1 = 0; +uint32_t Global2 = 0; +uint32_t Global3 = 0; /// The general structure of a generic metadata. -template +template struct GenericMetadataTest { GenericMetadata Header; - void *Fields[NumFields]; + Instance Template; }; -GenericMetadataTest<3> MetadataTest1 = { +GenericMetadataTest MetadataTest1 = { // Header { // allocation function - [](GenericMetadata *pattern, const void *args) { + [](GenericMetadata *pattern, const void *args) -> Metadata * { auto metadata = swift_allocateGenericValueMetadata(pattern, args); auto metadataWords = reinterpret_cast(metadata); auto argsWords = reinterpret_cast(args); @@ -186,8 +186,8 @@ GenericMetadataTest<3> MetadataTest1 = { // Fields { - (void*) MetadataKind::Struct, - &Global1, + MetadataKind::Struct, + reinterpret_cast(&Global1), nullptr } }; @@ -239,11 +239,15 @@ TEST(MetadataTest, getGenericMetadata) { auto result1 = RaceTest_ExpectEqual( [&]() -> const Metadata * { - auto inst = swift_getGenericMetadata(metadataTemplate, args); + auto inst = static_cast + (swift_getGenericMetadata(metadataTemplate, args)); auto fields = reinterpret_cast(inst); - EXPECT_EQ((void*) MetadataKind::Struct, fields[0]); - EXPECT_EQ(&Global1, fields[1]); + + EXPECT_EQ(MetadataKind::Struct, inst->getKind()); + EXPECT_EQ((const NominalTypeDescriptor*)&Global1, + inst->Description.get()); + EXPECT_EQ(&Global2, fields[2]); return inst; @@ -253,12 +257,15 @@ TEST(MetadataTest, getGenericMetadata) { RaceTest_ExpectEqual( [&]() -> const Metadata * { - auto inst = swift_getGenericMetadata(metadataTemplate, args); + auto inst = static_cast + (swift_getGenericMetadata(metadataTemplate, args)); EXPECT_NE(inst, result1); auto fields = reinterpret_cast(inst); - EXPECT_EQ((void*) MetadataKind::Struct, fields[0]); - EXPECT_EQ(&Global1, fields[1]); + EXPECT_EQ(MetadataKind::Struct, inst->getKind()); + EXPECT_EQ((const NominalTypeDescriptor*)&Global1, + inst->Description.get()); + EXPECT_EQ(&Global3, fields[2]); return inst; @@ -267,7 +274,7 @@ TEST(MetadataTest, getGenericMetadata) { FullMetadata MetadataTest2 = { { { nullptr }, { &_TWVBo } }, - { { { MetadataKind::Class } }, nullptr, 0, ClassFlags(), nullptr, nullptr, 0, 0, 0, 0, 0 } + { { { MetadataKind::Class } }, nullptr, 0, ClassFlags(), nullptr, 0, 0, 0, 0, 0 } }; TEST(MetadataTest, getMetatypeMetadata) { @@ -521,7 +528,7 @@ struct { { &Global1, &Global3, &Global2, &Global3 }, { { { &destroySuperclass }, { &_TWVBo } }, { { { MetadataKind::Class } }, nullptr, /*rodata*/ 1, ClassFlags(), nullptr, - nullptr, 0, 0, 0, sizeof(SuperclassWithPrefix), + 0, 0, 0, sizeof(SuperclassWithPrefix), sizeof(SuperclassWithPrefix.Prefix) + sizeof(HeapMetadataHeader) } } }; ClassMetadata * const SuperclassWithPrefix_AddressPoint = @@ -553,7 +560,7 @@ struct { }, { { { &destroySubclass }, { &_TWVBo } }, { { { MetadataKind::Class } }, nullptr, /*rodata*/ 1, ClassFlags(), nullptr, - nullptr, 0, 0, 0, + 0, 0, 0, sizeof(GenericSubclass.Pattern) + sizeof(GenericSubclass.Suffix), sizeof(HeapMetadataHeader) } }, { &Global2, &Global1, &Global2 } diff --git a/unittests/runtime/Refcounting.cpp b/unittests/runtime/Refcounting.cpp index b760fd0e4c235..124a57de313d1 100644 --- a/unittests/runtime/Refcounting.cpp +++ b/unittests/runtime/Refcounting.cpp @@ -32,7 +32,7 @@ static void destroyTestObject(HeapObject *_object) { static const FullMetadata TestClassObjectMetadata = { { { &destroyTestObject }, { &_TWVBo } }, { { { MetadataKind::Class } }, 0, /*rodata*/ 1, - ClassFlags::UsesSwift1Refcounting, nullptr, nullptr, 0, 0, 0, 0, 0 } + ClassFlags::UsesSwift1Refcounting, nullptr, 0, 0, 0, 0, 0 } }; /// Create an object that, when deallocated, stores the given value to