Skip to content

Commit 4a63007

Browse files
committed
SIL: Don't ask for stored properties of resilient types in TypeSubElementCount::TypeSubElementCount
1 parent fc80b51 commit 4a63007

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/SIL/Utils/FieldSensitivePrunedLiveness.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ TypeSubElementCount::TypeSubElementCount(SILType type, SILModule &mod,
6666
}
6767

6868
if (auto *structDecl = getFullyReferenceableStruct(type)) {
69+
// A resilient struct has 1 element.
70+
if (structDecl->isResilient(mod.getSwiftModule(),
71+
ResilienceExpansion::Maximal)) {
72+
number = 1;
73+
return;
74+
}
75+
6976
unsigned numElements = 0;
7077
for (auto *fieldDecl : structDecl->getStoredProperties())
7178
numElements += TypeSubElementCount(

0 commit comments

Comments
 (0)