Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/swift/IRGen/GenericRequirement.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ class GenericRequirement {
bool isAnyWitnessTable() const {
return kind == Kind::WitnessTable || kind == Kind::WitnessTablePack;
}

bool isAnyPack() const {
return kind == Kind::MetadataPack || kind == Kind::WitnessTablePack;
}

bool isValue() const {
return kind == Kind::Value;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/IRGen/GenMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2993,8 +2993,9 @@ void irgen::emitLazyMetadataAccessor(IRGenModule &IGM,
if (IGM.getOptions().optimizeForSize())
accessor->addFnAttr(llvm::Attribute::NoInline);

bool isReadNone = (genericArgs.Types.size() <=
NumDirectGenericTypeMetadataAccessFunctionArgs);
bool isReadNone =
!genericArgs.hasPacks && (genericArgs.Types.size() <=
NumDirectGenericTypeMetadataAccessFunctionArgs);

emitCacheAccessFunction(
IGM, accessor, /*cache*/ nullptr, /*cache type*/ nullptr,
Expand Down
4 changes: 3 additions & 1 deletion lib/IRGen/GenericArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ struct GenericArguments {
/// The values to use to initialize the arguments structure.
SmallVector<llvm::Value *, 8> Values;
SmallVector<llvm::Type *, 8> Types;
bool hasPacks = false;

void collectTypes(IRGenModule &IGM, NominalTypeDecl *nominal) {
void collectTypes(IRGenModule &IGM, NominalTypeDecl *nominal) {
GenericTypeRequirements requirements(IGM, nominal);
collectTypes(IGM, requirements);
}

void collectTypes(IRGenModule &IGM,
const GenericTypeRequirements &requirements) {
for (auto &requirement : requirements.getRequirements()) {
hasPacks = hasPacks || requirement.isAnyPack();
Types.push_back(requirement.getType(IGM));
}
}
Expand Down
8 changes: 8 additions & 0 deletions validation-test/IRGen/rdar161606892.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %target-swift-frontend %s -target %target-swift-5.9-abi-triple -emit-irgen | %IRGenFileCheck %s

// CHECK: Attrs: noinline nounwind{{$}}
// CHECK-NEXT: define {{.*}}@"$s13rdar1616068921PVMa"

public struct P<each T> {
public var teas: (repeat each T)
}