@@ -3519,7 +3519,7 @@ class LargeLoadableHeuristic {
35193519 " Expected only two categories: address and object" );
35203520 assert (!canType->hasTypeParameter ());
35213521
3522- auto & entry = largeTypeProperties[ty];
3522+ auto entry = largeTypeProperties[ty];
35233523 auto cached = entry.getNumRegisters ();
35243524 if (cached)
35253525 return cached;
@@ -3532,6 +3532,7 @@ class LargeLoadableHeuristic {
35323532 auto explosionSchema = TI.getSchema ();
35333533 auto res = std::max (nativeSchemaOrigParam.size (), explosionSchema.size ());
35343534 entry.setNumRegisters (res);
3535+ largeTypeProperties[ty] = entry;
35353536 return entry.getNumRegisters ();
35363537 }
35373538
@@ -3545,15 +3546,18 @@ void LargeLoadableHeuristic::visit(SILArgument *arg) {
35453546 if (numRegisters (objType) < NumRegistersLargeType)
35463547 return ;
35473548
3548- auto & entry = largeTypeProperties[objType];
3549+ auto entry = largeTypeProperties[objType];
35493550 for (auto *use : arg->getUses ()) {
35503551 auto *usr = use->getUser ();
35513552 switch (usr->getKind ()) {
35523553 case SILInstructionKind::TupleExtractInst:
35533554 case SILInstructionKind::StructExtractInst: {
35543555 auto projectionTy = cast<SingleValueInstruction>(usr)->getType ();
3555- if (numRegisters (projectionTy) >= NumRegistersLargeType)
3556+ if (numRegisters (projectionTy) >= NumRegistersLargeType) {
35563557 entry.addProjection ();
3558+
3559+ largeTypeProperties[objType] = entry;
3560+ }
35573561 break ;
35583562 }
35593563 default :
@@ -3575,8 +3579,9 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
35753579 auto resTy = bitcast->getType ();
35763580 if (numRegisters (resTy) > NumRegistersLargeType) {
35773581 // Force the source type to be indirect.
3578- auto & entry = largeTypeProperties[opdTy];
3582+ auto entry = largeTypeProperties[opdTy];
35793583 entry.setNumRegisters (65535 );
3584+ largeTypeProperties[opdTy] = entry;
35803585 return ;
35813586 }
35823587 }
@@ -3589,7 +3594,7 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
35893594 if (registerCount < NumRegistersLargeType)
35903595 continue ;
35913596
3592- auto & entry = largeTypeProperties[objType];
3597+ auto entry = largeTypeProperties[objType];
35933598
35943599 switch (i->getKind ()) {
35953600 case SILInstructionKind::TupleExtractInst:
@@ -3639,6 +3644,8 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
36393644 entry.addUse ();
36403645 break ;
36413646 }
3647+
3648+ largeTypeProperties[objType] = entry;
36423649 }
36433650}
36443651
0 commit comments