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 isByteReg() assert for x86 #48830

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
20 changes: 18 additions & 2 deletions src/coreclr/jit/lsrabuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3207,8 +3207,24 @@ void LinearScan::BuildStoreLocDef(GenTreeLclVarCommon* storeLoc,
srcInterval->assignRelatedInterval(varDefInterval);
}
}
RefPosition* def =
newRefPosition(varDefInterval, currentLoc + 1, RefTypeDef, storeLoc, allRegs(varDsc->TypeGet()), index);

regMaskTP defCandidates = RBM_NONE;
var_types type = varDsc->TypeGet();

#ifdef TARGET_X86
if (varTypeIsByte(type))
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be correct to add this logic into allRegs(type) instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

That sounds to be appropriate fix, but currently there are too many usage of allRegs(type) and I am not sure how that suggestion would impact other flows. My recommendation is to get this fix and generalize it in future if we find more cases like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add an assert to allRegs(type) that type != TYP_BYTE to see if any other calls are impacted, if it fails then it should show other existing issues.

{
defCandidates = allByteRegs();
}
else
{
defCandidates = allRegs(type);
}
#else
defCandidates = allRegs(type);
#endif // TARGET_X86

RefPosition* def = newRefPosition(varDefInterval, currentLoc + 1, RefTypeDef, storeLoc, defCandidates, index);
if (varDefInterval->isWriteThru)
{
// We always make write-thru defs reg-optional, as we can store them if they don't
Expand Down