@@ -2527,13 +2527,9 @@ static void emitTupleShuffleExprInto(RValueEmitter &emitter,
2527
2527
// Map outer initializations into a tuple of inner initializations:
2528
2528
// - fill out the initialization elements with null
2529
2529
TupleInitialization innerTupleInit;
2530
- if (E->isSourceScalar ()) {
2531
- innerTupleInit.SubInitializations .push_back (nullptr );
2532
- } else {
2533
- CanTupleType innerTuple =
2534
- cast<TupleType>(E->getSubExpr ()->getType ()->getCanonicalType ());
2535
- innerTupleInit.SubInitializations .resize (innerTuple->getNumElements ());
2536
- }
2530
+ CanTupleType innerTuple =
2531
+ cast<TupleType>(E->getSubExpr ()->getType ()->getCanonicalType ());
2532
+ innerTupleInit.SubInitializations .resize (innerTuple->getNumElements ());
2537
2533
2538
2534
// Map all the outer initializations to their appropriate targets.
2539
2535
for (unsigned outerIndex = 0 ; outerIndex != outerInits.size (); outerIndex++) {
@@ -2551,18 +2547,16 @@ static void emitTupleShuffleExprInto(RValueEmitter &emitter,
2551
2547
#endif
2552
2548
2553
2549
// Emit the sub-expression into the tuple initialization we just built.
2554
- if (E->isSourceScalar ()) {
2555
- emitter.SGF .emitExprInto (E->getSubExpr (),
2556
- innerTupleInit.SubInitializations [0 ].get ());
2557
- } else {
2558
- emitter.SGF .emitExprInto (E->getSubExpr (), &innerTupleInit);
2559
- }
2550
+ emitter.SGF .emitExprInto (E->getSubExpr (), &innerTupleInit);
2560
2551
2561
2552
outerTupleInit->finishInitialization (emitter.SGF );
2562
2553
}
2563
2554
2564
2555
RValue RValueEmitter::visitTupleShuffleExpr (TupleShuffleExpr *E,
2565
2556
SGFContext C) {
2557
+ assert (!E->isSourceScalar ());
2558
+ assert (!E->isResultScalar ());
2559
+
2566
2560
// If we're emitting into an initialization, we can try shuffling the
2567
2561
// elements of the initialization.
2568
2562
if (Initialization *I = C.getEmitInto ()) {
@@ -2574,11 +2568,7 @@ RValue RValueEmitter::visitTupleShuffleExpr(TupleShuffleExpr *E,
2574
2568
2575
2569
// Emit the sub-expression tuple and destructure it into elements.
2576
2570
SmallVector<RValue, 4 > elements;
2577
- if (E->isSourceScalar ()) {
2578
- elements.push_back (visit (E->getSubExpr ()));
2579
- } else {
2580
- visit (E->getSubExpr ()).extractElements (elements);
2581
- }
2571
+ visit (E->getSubExpr ()).extractElements (elements);
2582
2572
2583
2573
// Prepare a new tuple to hold the shuffled result.
2584
2574
RValue result (E->getType ()->getCanonicalType ());
0 commit comments