}
if (regNum == REG_NA)
{
+ // If this interval is still assigned to a register
+ if (interval->physReg != REG_NA)
+ {
+ // then unassign it if no new register was assigned to the RefTypeDef
+ if (RefTypeIsDef(currentRefPosition->refType))
+ {
+ assert(interval->assignedReg != nullptr);
+ if (interval->assignedReg->assignedInterval == interval)
+ {
+ interval->assignedReg->assignedInterval = nullptr;
+ }
+ interval->physReg = REG_NA;
+ interval->assignedReg = nullptr;
+ }
+ }
+
dumpLsraAllocationEvent(LSRA_EVENT_NO_REG_ALLOCATED, interval);
}
else if (RefTypeIsDef(currentRefPosition->refType))
{
assert(!currentRefPosition->spillAfter || currentRefPosition->IsActualRef());
+ if (RefTypeIsDef(currentRefPosition->refType))
+ {
+ // If an interval got assigned to a different register (while the different
+ // register got spilled), then clear the assigned interval of current register.
+ if (interval->physReg != REG_NA && interval->physReg != regNum)
+ {
+ interval->assignedReg->assignedInterval = nullptr;
+ }
+ }
+
interval->physReg = REG_NA;
interval->assignedReg = nullptr;