@@ -3422,6 +3422,9 @@ struct Properties {
34223422 uint16_t numRegisters = 0 ;
34233423
34243424public:
3425+ static uint16_t MaxNumUses = 65535 ;
3426+ static uint16_t MaxNumRegisters = 65535 ;
3427+
34253428 void addConstructor () {
34263429 sawConstructor = true ;
34273430 }
@@ -3458,17 +3461,19 @@ struct Properties {
34583461 }
34593462
34603463 void addUse () {
3461- if (use == 65535 )
3464+ if (use == MaxNumUses )
34623465 return ;
34633466 ++use;
34643467 }
34653468 uint16_t numUses () const {
34663469 return use;
34673470 }
3468-
3471+ void setAsVeryLargeType () {
3472+ setNumRegisters (MaxNumRegisters);
3473+ }
34693474 void setNumRegisters (unsigned regs) {
3470- if (regs > 65535 ) {
3471- regs = 65535 ;
3475+ if (regs > MaxNumRegisters ) {
3476+ numRegisters = MaxNumRegisters ;
34723477 return ;
34733478 }
34743479 numRegisters = regs;
@@ -3560,7 +3565,7 @@ void LargeLoadableHeuristic::propagate(PostOrderFunctionInfo &po) {
35603565 if (isLargeLoadableType (proj.getType ())) {
35613566 auto opdTy = proj.getOperand (0 )->getType ();
35623567 auto entry = largeTypeProperties[opdTy];
3563- entry.setNumRegisters ( 65535 );
3568+ entry.setAsVeryLargeType ( );
35643569 largeTypeProperties[opdTy] = entry;
35653570 }
35663571 }
@@ -3612,7 +3617,7 @@ void LargeLoadableHeuristic::visit(SILInstruction *i) {
36123617 if (numRegisters (resTy) > NumRegistersLargeType) {
36133618 // Force the source type to be indirect.
36143619 auto entry = largeTypeProperties[opdTy];
3615- entry.setNumRegisters ( 65535 );
3620+ entry.setAsVeryLargeType ( );
36163621 largeTypeProperties[opdTy] = entry;
36173622 return ;
36183623 }
0 commit comments