Skip to content

Commit c4076be

Browse files
committed
---
yaml --- r: 284606 b: refs/heads/swift-5.1-branch-04-24-2019 c: cb2fcb6 h: refs/heads/master
1 parent ffc1ba9 commit c4076be

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,4 +1319,4 @@ refs/heads/revert-24065-raj-es-perf-bench: acd6c09b6bd8c5aa922845ee4465bf1333e4f
13191319
refs/heads/rxwei-patch-3: d5f349dedfb5fcaf84c5ac788ad33ea47e502d11
13201320
refs/heads/rxwei-patch-4: d60ed33a03d398b956e1aa81f37b04d0b1cf101e
13211321
refs/heads/rxwei-patch-4-1: b7adfa58fd761906363d280fe323578f61097822
1322-
refs/heads/swift-5.1-branch-04-24-2019: f2d63ef2b2a82a953ad33e48b9fe076fc53efe3c
1322+
refs/heads/swift-5.1-branch-04-24-2019: cb2fcb6e5624163cc7f7526991eda23e10f195e4

branches/swift-5.1-branch-04-24-2019/lib/IRGen/GenDecl.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,17 +1149,21 @@ void IRGenerator::addLazyFunction(SILFunction *f) {
11491149
DefaultIGMForFunction.insert(std::make_pair(f, CurrentIGM));
11501150
}
11511151

1152-
bool IRGenerator::hasLazyMetadata(NominalTypeDecl *type) {
1152+
bool IRGenerator::hasLazyMetadata(TypeDecl *type) {
11531153
auto found = HasLazyMetadata.find(type);
11541154
if (found != HasLazyMetadata.end())
11551155
return found->second;
11561156

11571157
auto canBeLazy = [&]() -> bool {
1158-
if (isa<ClangModuleUnit>(type->getModuleScopeContext())) {
1159-
return requiresForeignTypeMetadata(type);
1160-
} else if (type->getParentModule() == SIL.getSwiftModule()) {
1161-
// When compiling with -Onone keep all metadata for the debugger. Even if it
1162-
// is not used by the program itself.
1158+
if (isa<ClangModuleUnit>(type->getInnermostDeclContext()
1159+
->getModuleScopeContext())) {
1160+
if (auto nominal = dyn_cast<NominalTypeDecl>(type)) {
1161+
return requiresForeignTypeMetadata(nominal);
1162+
}
1163+
} else if (type->getInnermostDeclContext()->getParentModule()
1164+
== SIL.getSwiftModule()) {
1165+
// When compiling with -Onone keep all metadata for the debugger. Even if
1166+
// it is not used by the program itself.
11631167
if (!Opts.shouldOptimize())
11641168
return false;
11651169
if (Opts.UseJIT)

branches/swift-5.1-branch-04-24-2019/lib/IRGen/GenStruct.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ void IRGenModule::emitStructDecl(StructDecl *st) {
882882
void IRGenModule::emitFuncDecl(FuncDecl *fd) {
883883
// If there's an opaque return type for this function, emit its descriptor.
884884
if (auto opaque = fd->getOpaqueResultTypeDecl()) {
885-
if (!IRGen.tryEnableLazyTypeMetadata(opaque))
885+
if (!IRGen.hasLazyMetadata(opaque))
886886
emitOpaqueTypeDecl(opaque);
887887
}
888888
}

branches/swift-5.1-branch-04-24-2019/lib/IRGen/IRGenModule.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class IRGenerator {
214214
bool FinishedEmittingLazyDefinitions = false;
215215

216216
/// A map recording if metadata can be emitted lazily for each nominal type.
217-
llvm::DenseMap<NominalTypeDecl *, bool> HasLazyMetadata;
217+
llvm::DenseMap<TypeDecl *, bool> HasLazyMetadata;
218218

219219
struct LazyTypeGlobalsInfo {
220220
/// Is there a use of the type metadata?
@@ -356,8 +356,7 @@ class IRGenerator {
356356
/// Checks if metadata for this type can be emitted lazily. This is true for
357357
/// non-public types as well as imported types, except for classes and
358358
/// protocols which are always emitted eagerly.
359-
bool hasLazyMetadata(NominalTypeDecl *type);
360-
bool hasLazyMetadata(OpaqueTypeDecl *type);
359+
bool hasLazyMetadata(TypeDecl *type);
361360

362361
/// Emit everything which is reachable from already emitted IR.
363362
void emitLazyDefinitions();

0 commit comments

Comments
 (0)