Skip to content

Commit 8a5bfd5

Browse files
committed
[NFC] Be more precise in some parameter types
1 parent fb6a811 commit 8a5bfd5

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

lib/SILGen/SILGenPoly.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,13 +2733,13 @@ class ResultPlanner : public ExpanderBase<ResultPlanner> {
27332733
SmallVector<SILValue, 4> &innerDirectResults);
27342734

27352735
void expandInnerTuple(AbstractionPattern innerOrigType,
2736-
CanType innerSubstType,
2736+
CanTupleType innerSubstType,
27372737
AbstractionPattern outerOrigType,
27382738
CanType outerSubstType);
27392739
void expandOuterTuple(AbstractionPattern innerOrigType,
27402740
CanType innerSubstType,
27412741
AbstractionPattern outerOrigType,
2742-
CanType outerSubstType);
2742+
CanTupleType outerSubstType);
27432743

27442744
void expandSingle(AbstractionPattern innerOrigType,
27452745
CanType innerSubstType,
@@ -3138,9 +3138,9 @@ void ExpanderBase<Impl>::expand(AbstractionPattern innerOrigType,
31383138
outerOrigType, outerSubstType);
31393139
} else if (outerIsExpanded) {
31403140
asImpl().expandOuterTuple(innerOrigType, innerSubstType,
3141-
outerOrigType, outerSubstType);
3141+
outerOrigType, cast<TupleType>(outerSubstType));
31423142
} else if (innerIsExpanded) {
3143-
asImpl().expandInnerTuple(innerOrigType, innerSubstType,
3143+
asImpl().expandInnerTuple(innerOrigType, cast<TupleType>(innerSubstType),
31443144
outerOrigType, outerSubstType);
31453145
} else {
31463146
asImpl().expandSingle(innerOrigType, innerSubstType,
@@ -3480,7 +3480,7 @@ void ResultPlanner::Operation::emitReabstractTupleIntoPackExpansion(
34803480
void ResultPlanner::expandOuterTuple(AbstractionPattern innerOrigType,
34813481
CanType innerSubstType,
34823482
AbstractionPattern outerOrigType,
3483-
CanType outerSubstType) {
3483+
CanTupleType outerSubstType) {
34843484
assert(outerOrigType.isTuple());
34853485
assert(!outerOrigType.doesTupleVanish());
34863486
assert(!innerOrigType.isTuple());
@@ -3489,7 +3489,6 @@ void ResultPlanner::expandOuterTuple(AbstractionPattern innerOrigType,
34893489
// plan function filters that out), so the outer subst type must be a
34903490
// tuple. The inner subst type must also be a tuple because only tuples
34913491
// convert to tuples.
3492-
auto outerSubstTupleType = cast<TupleType>(outerSubstType);
34933492
auto innerSubstTupleType = cast<TupleType>(innerSubstType);
34943493

34953494
// The next inner result is not expanded, so there's a single result.
@@ -3498,30 +3497,27 @@ void ResultPlanner::expandOuterTuple(AbstractionPattern innerOrigType,
34983497
if (SGF.silConv.isSILIndirect(innerResult)) {
34993498
SILValue innerResultAddr = addInnerIndirectResultTemporary(innerResult);
35003499
expandParallelTuplesInnerIndirect(innerOrigType, innerSubstTupleType,
3501-
outerOrigType, outerSubstTupleType,
3500+
outerOrigType, outerSubstType,
35023501
ManagedValue::forLValue(innerResultAddr));
35033502
} else {
35043503
assert(!SGF.silConv.useLoweredAddresses() &&
35053504
"Formal Indirect Results that are not SIL Indirect are only "
35063505
"allowed in opaque values mode");
35073506
planExpandedFromDirect(innerOrigType, innerSubstTupleType,
3508-
outerOrigType, outerSubstTupleType,
3507+
outerOrigType, outerSubstType,
35093508
innerResult);
35103509
}
35113510
}
35123511

35133512
void ResultPlanner::expandInnerTuple(AbstractionPattern innerOrigType,
3514-
CanType innerSubstType,
3513+
CanTupleType innerSubstType,
35153514
AbstractionPattern outerOrigType,
35163515
CanType outerSubstType) {
35173516
assert(innerOrigType.isTuple());
35183517
assert(!innerOrigType.doesTupleVanish());
35193518
assert(!outerOrigType.isTuple());
35203519

3521-
// We know that the inner tuple is not vanishing (because the top-level
3522-
// plan function filters that out), so the inner subst type must be a
3523-
// tuple. The outer subst type might not be a tuple if it's e.g. Any.
3524-
auto innerSubstTupleType = cast<TupleType>(innerSubstType);
3520+
// The outer subst type might not be a tuple if it's e.g. Any.
35253521

35263522
// The next outer result is not expanded, so there's a single result.
35273523
auto outerResultPair = claimNextOuterResult();
@@ -3531,12 +3527,12 @@ void ResultPlanner::expandInnerTuple(AbstractionPattern innerOrigType,
35313527
// Base the plan on whether the single result is direct or indirect.
35323528
if (SGF.silConv.isSILIndirect(outerResult)) {
35333529
assert(outerResultAddr);
3534-
expandInnerTupleOuterIndirect(innerOrigType, innerSubstTupleType,
3530+
expandInnerTupleOuterIndirect(innerOrigType, innerSubstType,
35353531
outerOrigType, outerSubstType,
35363532
ManagedValue::forLValue(outerResultAddr));
35373533
} else {
35383534
assert(!outerResultAddr);
3539-
planExpandedIntoDirect(innerOrigType, innerSubstTupleType,
3535+
planExpandedIntoDirect(innerOrigType, innerSubstType,
35403536
outerOrigType, outerSubstType,
35413537
outerResult);
35423538
}

0 commit comments

Comments
 (0)