@@ -10755,8 +10755,6 @@ void LinearScan::verifyFinalAllocation()
1075510755
1075610756    BasicBlock*  currentBlock                = nullptr ;
1075710757    GenTree*     firstBlockEndResolutionNode = nullptr ;
10758-     regMaskTP    regsToFree                  = RBM_NONE;
10759-     regMaskTP    delayRegsToFree             = RBM_NONE;
1076010758    LsraLocation currentLocation             = MinLocation;
1076110759    for  (RefPosition& refPosition : refPositions)
1076210760    {
@@ -10766,12 +10764,7 @@ void LinearScan::verifyFinalAllocation()
1076610764        regNumber    regNum             = REG_NA;
1076710765        activeRefPosition               = currentRefPosition;
1076810766
10769-         if  (currentRefPosition->refType  == RefTypeBB)
10770-         {
10771-             regsToFree |= delayRegsToFree;
10772-             delayRegsToFree = RBM_NONE;
10773-         }
10774-         else 
10767+         if  (currentRefPosition->refType  != RefTypeBB)
1077510768        {
1077610769            if  (currentRefPosition->IsPhysRegRef ())
1077710770            {
@@ -10800,24 +10793,7 @@ void LinearScan::verifyFinalAllocation()
1080010793        }
1080110794
1080210795        LsraLocation newLocation = currentRefPosition->nodeLocation ;
10803- 
10804-         if  (newLocation > currentLocation)
10805-         {
10806-             //  Free Registers.
10807-             //  We could use the freeRegisters() method, but we'd have to carefully manage the active intervals.
10808-             for  (regNumber reg = REG_FIRST; reg < ACTUAL_REG_COUNT; reg = REG_NEXT (reg))
10809-             {
10810-                 regMaskTP regMask = genRegMask (reg);
10811-                 if  ((regsToFree & regMask) != RBM_NONE)
10812-                 {
10813-                     RegRecord* physRegRecord        = getRegisterRecord (reg);
10814-                     physRegRecord->assignedInterval  = nullptr ;
10815-                 }
10816-             }
10817-             regsToFree = delayRegsToFree;
10818-             regsToFree = RBM_NONE;
10819-         }
10820-         currentLocation = newLocation;
10796+         currentLocation          = newLocation;
1082110797
1082210798        switch  (currentRefPosition->refType )
1082310799        {
@@ -10984,6 +10960,7 @@ void LinearScan::verifyFinalAllocation()
1098410960                else  if  (RefTypeIsDef (currentRefPosition->refType ))
1098510961                {
1098610962                    interval->isActive  = true ;
10963+ 
1098710964                    if  (VERBOSE)
1098810965                    {
1098910966                        if  (interval->isConstant  && (currentRefPosition->treeNode  != nullptr ) &&
@@ -11055,11 +11032,17 @@ void LinearScan::verifyFinalAllocation()
1105511032                    }
1105611033                    else 
1105711034                    {
11058-                         if  (! currentRefPosition->copyReg )
11035+                         if  (RefTypeIsDef ( currentRefPosition->refType ) )
1105911036                        {
11060-                             interval->physReg      = regNum;
11061-                             interval->assignedReg  = regRecord;
11037+                             //  Interval was assigned to a different register.
11038+                             //  Clear the assigned interval of current register.
11039+                             if  (interval->physReg  != REG_NA && interval->physReg  != regNum)
11040+                             {
11041+                                 interval->assignedReg ->assignedInterval  = nullptr ;
11042+                             }
1106211043                        }
11044+                         interval->physReg            = regNum;
11045+                         interval->assignedReg        = regRecord;
1106311046                        regRecord->assignedInterval  = interval;
1106411047                    }
1106511048                }
0 commit comments