Skip to content

Commit 109f91c

Browse files
authored
Merge pull request #42449 from atrick/5.7-fix-escape-analysis-type-lookup
[5.7] Fix a compile-time issue in EscapeAnalysis
2 parents 9919c68 + 5dde814 commit 109f91c

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)