This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix initialization of resolution sets #8840
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1914,6 +1914,14 @@ bool LinearScan::isRegCandidate(LclVarDsc* varDsc) | |
|
||
void LinearScan::identifyCandidates() | ||
{ | ||
|
||
// Initialize the sets of lclVars that are used to determine whether, and for which lclVars, | ||
// we need to perform resolution across basic blocks. | ||
// Note that we can't do this in the constructor because the number of tracked lclVars may | ||
// change between the constructor and the actual allocation. | ||
VarSetOps::AssignNoCopy(compiler, resolutionCandidateVars, VarSetOps::MakeEmpty(compiler)); | ||
VarSetOps::AssignNoCopy(compiler, splitOrSpilledVars, VarSetOps::MakeEmpty(compiler)); | ||
|
||
if (compiler->lvaCount == 0) | ||
{ | ||
return; | ||
|
@@ -1950,8 +1958,6 @@ void LinearScan::identifyCandidates() | |
// for vectors on Arm64, though the actual value may differ. | ||
|
||
VarSetOps::AssignNoCopy(compiler, fpCalleeSaveCandidateVars, VarSetOps::MakeEmpty(compiler)); | ||
VarSetOps::AssignNoCopy(compiler, resolutionCandidateVars, VarSetOps::MakeEmpty(compiler)); | ||
VarSetOps::AssignNoCopy(compiler, splitOrSpilledVars, VarSetOps::MakeEmpty(compiler)); | ||
VARSET_TP VARSET_INIT_NOCOPY(fpMaybeCandidateVars, VarSetOps::MakeEmpty(compiler)); | ||
unsigned int floatVarCount = 0; | ||
unsigned int thresholdFPRefCntWtd = 4 * BB_UNITY_WEIGHT; | ||
|
@@ -10412,11 +10418,21 @@ void LinearScan::lsraDispNode(GenTreePtr tree, LsraTupleDumpMode mode, bool hasD | |
} | ||
if (!hasDest && tree->gtHasReg()) | ||
{ | ||
// This can be true for the "localDefUse" case - defining a reg, but | ||
// pushing it on the stack | ||
assert(spillChar == ' '); | ||
spillChar = '*'; | ||
hasDest = true; | ||
// A node can define a register, but not produce a value for a parent to consume, | ||
// i.e. in the "localDefUse" case. | ||
// There used to be an assert here that we wouldn't spill such a node. | ||
// However, we can have unused lclVars that wind up being the node at which | ||
// it is spilled. This probably indicates a bug, but we don't realy want to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Typo "realy" instead of "really" |
||
// assert during a dump. | ||
if (spillChar == 'S') | ||
{ | ||
spillChar = '$'; | ||
} | ||
else | ||
{ | ||
spillChar = '*'; | ||
} | ||
hasDest = true; | ||
} | ||
} | ||
printf("%c N%03u. ", spillChar, tree->gtSeqNum); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this cannot be done in the class constructor or do you prefer having these here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me awhile to track this down but it can't be done in the constructor because at that point the set of tracked lclVars hasn't been finalized, so the epoch on the bit sets doesn't match. I've added a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me awhile to track this down but it can't be done in the constructor because at that point the set of tracked lclVars hasn't been finalized, so the epoch on the bit sets doesn't match. I've added a comment.