@@ -3519,7 +3519,7 @@ class LargeLoadableHeuristic {
3519
3519
" Expected only two categories: address and object" );
3520
3520
assert (!canType->hasTypeParameter ());
3521
3521
3522
- auto & entry = largeTypeProperties[ty];
3522
+ auto entry = largeTypeProperties[ty];
3523
3523
auto cached = entry.getNumRegisters ();
3524
3524
if (cached)
3525
3525
return cached;
@@ -3532,6 +3532,7 @@ class LargeLoadableHeuristic {
3532
3532
auto explosionSchema = TI.getSchema ();
3533
3533
auto res = std::max (nativeSchemaOrigParam.size (), explosionSchema.size ());
3534
3534
entry.setNumRegisters (res);
3535
+ largeTypeProperties[ty] = entry;
3535
3536
return entry.getNumRegisters ();
3536
3537
}
3537
3538
@@ -3545,15 +3546,18 @@ void LargeLoadableHeuristic::visit(SILArgument *arg) {
3545
3546
if (numRegisters (objType) < NumRegistersLargeType)
3546
3547
return ;
3547
3548
3548
- auto & entry = largeTypeProperties[objType];
3549
+ auto entry = largeTypeProperties[objType];
3549
3550
for (auto *use : arg->getUses ()) {
3550
3551
auto *usr = use->getUser ();
3551
3552
switch (usr->getKind ()) {
3552
3553
case SILInstructionKind::TupleExtractInst:
3553
3554
case SILInstructionKind::StructExtractInst: {
3554
3555
auto projectionTy = cast<SingleValueInstruction>(usr)->getType ();
3555
- if (numRegisters (projectionTy) >= NumRegistersLargeType)
3556
+ if (numRegisters (projectionTy) >= NumRegistersLargeType) {
3556
3557
entry.addProjection ();
3558
+
3559
+ largeTypeProperties[objType] = entry;
3560
+ }
3557
3561
break ;
3558
3562
}
3559
3563
default :
@@ -3575,8 +3579,9 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
3575
3579
auto resTy = bitcast->getType ();
3576
3580
if (numRegisters (resTy) > NumRegistersLargeType) {
3577
3581
// Force the source type to be indirect.
3578
- auto & entry = largeTypeProperties[opdTy];
3582
+ auto entry = largeTypeProperties[opdTy];
3579
3583
entry.setNumRegisters (65535 );
3584
+ largeTypeProperties[opdTy] = entry;
3580
3585
return ;
3581
3586
}
3582
3587
}
@@ -3589,7 +3594,7 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
3589
3594
if (registerCount < NumRegistersLargeType)
3590
3595
continue ;
3591
3596
3592
- auto & entry = largeTypeProperties[objType];
3597
+ auto entry = largeTypeProperties[objType];
3593
3598
3594
3599
switch (i->getKind ()) {
3595
3600
case SILInstructionKind::TupleExtractInst:
@@ -3639,6 +3644,8 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
3639
3644
entry.addUse ();
3640
3645
break ;
3641
3646
}
3647
+
3648
+ largeTypeProperties[objType] = entry;
3642
3649
}
3643
3650
}
3644
3651
0 commit comments