Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix majority of failures in libraries-jitstressregs after EHWriteThru enabled #48829

Merged
merged 3 commits into from
Mar 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 12 additions & 29 deletions src/coreclr/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10723,8 +10723,6 @@ void LinearScan::verifyFinalAllocation()

BasicBlock* currentBlock = nullptr;
GenTree* firstBlockEndResolutionNode = nullptr;
regMaskTP regsToFree = RBM_NONE;
regMaskTP delayRegsToFree = RBM_NONE;
LsraLocation currentLocation = MinLocation;
for (RefPosition& refPosition : refPositions)
{
Expand All @@ -10734,12 +10732,7 @@ void LinearScan::verifyFinalAllocation()
regNumber regNum = REG_NA;
activeRefPosition = currentRefPosition;

if (currentRefPosition->refType == RefTypeBB)
{
regsToFree |= delayRegsToFree;
delayRegsToFree = RBM_NONE;
}
else
if (currentRefPosition->refType != RefTypeBB)
{
if (currentRefPosition->IsPhysRegRef())
{
Expand Down Expand Up @@ -10768,24 +10761,7 @@ void LinearScan::verifyFinalAllocation()
}

LsraLocation newLocation = currentRefPosition->nodeLocation;

if (newLocation > currentLocation)
{
// Free Registers.
// We could use the freeRegisters() method, but we'd have to carefully manage the active intervals.
for (regNumber reg = REG_FIRST; reg < ACTUAL_REG_COUNT; reg = REG_NEXT(reg))
{
regMaskTP regMask = genRegMask(reg);
if ((regsToFree & regMask) != RBM_NONE)
{
RegRecord* physRegRecord = getRegisterRecord(reg);
physRegRecord->assignedInterval = nullptr;
}
}
regsToFree = delayRegsToFree;
regsToFree = RBM_NONE;
}
currentLocation = newLocation;
currentLocation = newLocation;

switch (currentRefPosition->refType)
{
Expand Down Expand Up @@ -10952,6 +10928,7 @@ void LinearScan::verifyFinalAllocation()
else if (RefTypeIsDef(currentRefPosition->refType))
{
interval->isActive = true;

if (VERBOSE)
{
if (interval->isConstant && (currentRefPosition->treeNode != nullptr) &&
Expand Down Expand Up @@ -11023,11 +11000,17 @@ void LinearScan::verifyFinalAllocation()
}
else
{
if (!currentRefPosition->copyReg)
if (RefTypeIsDef(currentRefPosition->refType))
{
interval->physReg = regNum;
interval->assignedReg = regRecord;
// Interval was assigned to a different register.
// Clear the assigned interval of current register.
if (interval->physReg != REG_NA && interval->physReg != regNum)
{
interval->assignedReg->assignedInterval = nullptr;
}
}
interval->physReg = regNum;
interval->assignedReg = regRecord;
regRecord->assignedInterval = interval;
}
}
Expand Down