Skip to content

Commit 0e7b7e5

Browse files
committed
Do proper parallel walks of orig+subst types when computing type
properties for struct and enum types.
1 parent 7d315d4 commit 0e7b7e5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -749,11 +749,12 @@ namespace {
749749
RetTy visitTupleType(CanTupleType type, AbstractionPattern origType,
750750
IsTypeExpansionSensitive_t isSensitive) {
751751
RecursiveProperties props;
752-
for (unsigned i = 0, e = type->getNumElements(); i < e; ++i) {
753-
props.addSubobject(classifyType(origType.getTupleElementType(i),
754-
type.getElementType(i),
755-
TC, Expansion));
756-
}
752+
origType.forEachExpandedTupleElement(type,
753+
[&](AbstractionPattern origEltType, CanType substEltType,
754+
const TupleTypeElt &elt) {
755+
props.addSubobject(
756+
classifyType(origEltType, substEltType, TC, Expansion));
757+
});
757758
props = mergeIsTypeExpansionSensitive(isSensitive, props);
758759
return asImpl().handleAggregateByProperties(type, props);
759760
}
@@ -2250,12 +2251,12 @@ namespace {
22502251
AbstractionPattern origType,
22512252
IsTypeExpansionSensitive_t isSensitive) {
22522253
RecursiveProperties properties;
2253-
for (unsigned i = 0, e = tupleType->getNumElements(); i < e; ++i) {
2254-
auto eltType = tupleType.getElementType(i);
2255-
auto origEltType = origType.getTupleElementType(i);
2256-
auto &lowering = TC.getTypeLowering(origEltType, eltType, Expansion);
2257-
properties.addSubobject(lowering.getRecursiveProperties());
2258-
}
2254+
origType.forEachExpandedTupleElement(tupleType,
2255+
[&](AbstractionPattern origEltType, CanType substEltType,
2256+
const TupleTypeElt &elt) {
2257+
properties.addSubobject(
2258+
classifyType(origEltType, substEltType, TC, Expansion));
2259+
});
22592260
properties = mergeIsTypeExpansionSensitive(isSensitive, properties);
22602261

22612262
return handleAggregateByProperties<LoadableTupleTypeLowering>(tupleType,

0 commit comments

Comments
 (0)