Skip to content
Closed
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/coreclr/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11264,7 +11264,8 @@ void LinearScan::RegisterSelection::try_SPILL_COST()
RefPosition* recentRefPosition = spillCandidateRegRecord->assignedInterval != nullptr
? spillCandidateRegRecord->assignedInterval->recentRefPosition
: nullptr;
if ((recentRefPosition != nullptr) && (recentRefPosition->RegOptional() &&
if ((recentRefPosition != nullptr) &&

@kunalspathak kunalspathak Jul 8, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad for not spotting this formatting error in #55247. I also missed one more change to hoist spillCandidateRegRecord->assignedInterval. Do you mind changing that as well?

Interval* assignedInterval = spillCandidateRegRecord->assignedInterval;

// and then use assingedInterval at multiple places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@kunalspathak kunalspathak Jul 8, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need to define it after the line:

RegRecord* spillCandidateRegRecord = &linearScan->physRegs[spillCandidateRegNum];
Interval*    assignedInterval      = spillCandidateRegRecord->assignedInterval;

so that you can use it in condition on line 11254 as well.

if ((linearScan->getNextIntervalRef(spillCandidateRegNum, regType) == currentLocation) &&
            !assignedInterval->getNextRefPosition()->RegOptional())
        {
            continue;
        }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please open a PR with a fix? I think it would be faster and less confusing for the history/blame.

(recentRefPosition->RegOptional() &&
!(spillCandidateRegRecord->assignedInterval->isLocalVar && recentRefPosition->IsActualRef())))
{
// We do not "spillAfter" if previous (recent) refPosition was regOptional or if it
Expand Down