Skip to content

Commit

Permalink
Avoiding creating a new debug range when previous is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Bohe committed Oct 21, 2022
1 parent 609605a commit a11fd5d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8740,18 +8740,24 @@ void CodeGenInterface::VariableLiveKeeper::VariableLiveDescriptor::startLiveRang
}
else
{
if (!m_VariableLiveRanges->empty() && isLastRangeEmpty())
{
removeLastRange();
}
JITDUMP("New debug range: %s\n",
m_VariableLiveRanges->empty()
? "first"
: siVarLoc::Equals(&varLocation, &(m_VariableLiveRanges->back().m_VarLocation))
? "new var or location"
: "not adjacent");
// Creates new live range with invalid end
m_VariableLiveRanges->emplace_back(varLocation, emitLocation(), emitLocation());
// If we can tell from emitLocations that the previous debug range was empty
// we are replacing it with the new one, otherwise creating a space of it.
// The new range has undefined end.
if (isLastRangeEmpty())
{
m_VariableLiveRanges->back().m_VarLocation = varLocation;
m_VariableLiveRanges->back().m_EndEmitLocation.Init();
}
else
{
m_VariableLiveRanges->emplace_back(varLocation, emitLocation(), emitLocation());
}
m_VariableLiveRanges->back().m_StartEmitLocation.CaptureLocation(emit);
}

Expand Down

0 comments on commit a11fd5d

Please sign in to comment.