Skip to content

Commit 99f363a

Browse files
committed
Fix a compile-time issue in EscapeAnalysis
Replace a loop with a call to findCachedClassPropertiesKind. This was the original intention, but it looks like the refactoring was incorrectly merged. Noticed by Slava Pestov based on Erik Eckstein's compile time trace.
1 parent f339fdc commit 99f363a

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

lib/SILOptimizer/Analysis/EscapeAnalysis.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,23 +1035,10 @@ EscapeAnalysis::ConnectionGraph::getOrCreateReferenceContent(SILValue refVal,
10351035

10361036
// Determine whether the object that refVal refers to only contains
10371037
// references.
1038-
bool contentHasReferenceOnly = false;
1039-
if (refVal) {
1040-
SILType refType = refVal->getType();
1041-
if (auto *C = refType.getClassOrBoundGenericClass()) {
1042-
PointerKind aggregateKind = NoPointer;
1043-
for (auto *field : C->getStoredProperties()) {
1044-
SILType fieldType = refType
1045-
.getFieldType(field, F->getModule(),
1046-
F->getTypeExpansionContext())
1047-
.getObjectType();
1048-
PointerKind fieldKind = EA->findCachedPointerKind(fieldType, *F);
1049-
if (fieldKind > aggregateKind)
1050-
aggregateKind = fieldKind;
1051-
}
1052-
contentHasReferenceOnly = canOnlyContainReferences(aggregateKind);
1053-
}
1054-
}
1038+
bool contentHasReferenceOnly =
1039+
refVal ? canOnlyContainReferences(
1040+
EA->findCachedClassPropertiesKind(refVal->getType(), *F))
1041+
: false;
10551042
getOrCreateContentNode(objNode, false, contentHasReferenceOnly);
10561043
return objNode;
10571044
}

0 commit comments

Comments
 (0)