@@ -357,9 +357,6 @@ ManagedValue Transform::transform(ManagedValue v,
357
357
AbstractionPattern outputOrigType,
358
358
CanType outputSubstType,
359
359
SGFContext ctxt) {
360
- // Look through inout types.
361
- inputSubstType = inputSubstType->getInOutObjectType ()->getCanonicalType ();
362
-
363
360
// Load if the result isn't address-only. All the translation routines
364
361
// expect this.
365
362
if (v.getType ().isAddress ()) {
@@ -816,16 +813,6 @@ static void emitForceInto(SILGenFunction &SGF, SILLocation loc,
816
813
temp.finishInitialization (SGF);
817
814
}
818
815
819
- // / If the type is a single-element tuple, return the element type.
820
- static CanType getSingleTupleElement (CanType type) {
821
- if (auto tupleType = dyn_cast<TupleType>(type)) {
822
- if (tupleType->getNumElements () == 1 )
823
- return tupleType.getElementType (0 );
824
- }
825
-
826
- return type;
827
- }
828
-
829
816
namespace {
830
817
class TranslateIndirect : public Cleanup {
831
818
AbstractionPattern InputOrigType, OutputOrigType;
@@ -1042,42 +1029,6 @@ namespace {
1042
1029
auto inputTupleType = dyn_cast<TupleType>(inputSubstType);
1043
1030
auto outputTupleType = dyn_cast<TupleType>(outputSubstType);
1044
1031
1045
- // Look inside one-element exploded tuples, but not if both input
1046
- // and output types are *both* one-element tuples.
1047
- if (!(inputTupleType && outputTupleType &&
1048
- inputTupleType.getElementTypes ().size () == 1 &&
1049
- outputTupleType.getElementTypes ().size () == 1 )) {
1050
- if (inputOrigType.isTuple () &&
1051
- inputOrigType.getNumTupleElements () == 1 ) {
1052
- inputOrigType = inputOrigType.getTupleElementType (0 );
1053
- inputSubstType = getSingleTupleElement (inputSubstType);
1054
- return translate (inputOrigType, inputSubstType,
1055
- outputOrigType, outputSubstType);
1056
- }
1057
-
1058
- if (outputOrigType.isTuple () &&
1059
- outputOrigType.getNumTupleElements () == 1 ) {
1060
- outputOrigType = outputOrigType.getTupleElementType (0 );
1061
- outputSubstType = getSingleTupleElement (outputSubstType);
1062
- return translate (inputOrigType, inputSubstType,
1063
- outputOrigType, outputSubstType);
1064
- }
1065
- }
1066
-
1067
- // Special-case: tuples containing inouts, __shared or __owned,
1068
- // and one-element vararg tuples.
1069
- if (inputTupleType && shouldExpandTupleType (inputTupleType)) {
1070
- // Non-materializable tuple types cannot be bound as generic
1071
- // arguments, so none of the remaining transformations apply.
1072
- // Instead, the outermost tuple layer is exploded, even when
1073
- // they are being passed opaquely. See the comment in
1074
- // AbstractionPattern.h for a discussion.
1075
- return translateParallelExploded (inputOrigType,
1076
- inputTupleType,
1077
- outputOrigType,
1078
- outputTupleType);
1079
- }
1080
-
1081
1032
// Case where the input type is an exploded tuple.
1082
1033
if (inputOrigType.isTuple ()) {
1083
1034
if (outputOrigType.isTuple ()) {
@@ -1338,11 +1289,7 @@ namespace {
1338
1289
CanTupleType outputSubstType) {
1339
1290
assert (inputOrigType.matchesTuple (inputSubstType));
1340
1291
assert (outputOrigType.matchesTuple (outputSubstType));
1341
- // Non-materializable input and materializable output occurs
1342
- // when witness method thunks re-abstract a non-mutating
1343
- // witness for a mutating requirement. The inout self is just
1344
- // loaded to produce a value in this case.
1345
- assert (inputSubstType->hasElementWithOwnership () ||
1292
+ assert (!inputSubstType->hasElementWithOwnership () &&
1346
1293
!outputSubstType->hasElementWithOwnership ());
1347
1294
assert (inputSubstType->getNumElements () ==
1348
1295
outputSubstType->getNumElements ());
@@ -1547,13 +1494,6 @@ namespace {
1547
1494
translateIntoGuaranteed (inputOrigType, inputSubstType, outputOrigType,
1548
1495
outputSubstType, input);
1549
1496
return ;
1550
- case ParameterConvention::Indirect_Inout:
1551
- translateInOut (inputOrigType.getWithoutSpecifierType (),
1552
- inputSubstType.getWithoutSpecifierType (),
1553
- outputOrigType.getWithoutSpecifierType (),
1554
- outputSubstType.getWithoutSpecifierType (),
1555
- input, result);
1556
- return ;
1557
1497
case ParameterConvention::Indirect_In: {
1558
1498
if (SGF.silConv .useLoweredAddresses ()) {
1559
1499
translateIndirect (inputOrigType, inputSubstType, outputOrigType,
@@ -1576,6 +1516,8 @@ namespace {
1576
1516
assert (Outputs.back ().getType () == SGF.getSILType (result));
1577
1517
return ;
1578
1518
}
1519
+ case ParameterConvention::Indirect_Inout:
1520
+ llvm_unreachable (" inout reabstraction handled elsewhere" );
1579
1521
case ParameterConvention::Indirect_InoutAliasable:
1580
1522
llvm_unreachable (" abstraction difference in aliasable argument not "
1581
1523
" allowed" );
0 commit comments