Skip to content

Handle MultiRegNode in gtGetRegMask() #93576

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

Merged
merged 12 commits into from
Oct 20, 2023
14 changes: 9 additions & 5 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,11 @@ regNumber CodeGen::genConsumeReg(GenTree* tree, unsigned multiRegIndex)
}
else
{
gcInfo.gcMarkRegSetNpt(tree->gtGetRegMask());
regNumber regAtIndex = tree->GetRegByIndex(multiRegIndex);
if (regAtIndex != REG_NA)
{
gcInfo.gcMarkRegSetNpt(genRegMask(regAtIndex));
}
}
return reg;
}
Expand Down Expand Up @@ -2230,14 +2234,14 @@ void CodeGen::genProduceReg(GenTree* tree)
else if (tree->IsMultiRegLclVar())
{
assert(compiler->lvaEnregMultiRegVars);
GenTreeLclVar* lclNode = tree->AsLclVar();
LclVarDsc* varDsc = compiler->lvaGetDesc(lclNode);
unsigned regCount = varDsc->lvFieldCnt;
const GenTreeLclVar* lclNode = tree->AsLclVar();
LclVarDsc* varDsc = compiler->lvaGetDesc(lclNode);
unsigned regCount = varDsc->lvFieldCnt;
for (unsigned i = 0; i < regCount; i++)
{
if (!lclNode->IsLastUse(i))
{
regNumber reg = lclNode->GetRegByIndex(i);
regNumber reg = lclNode->GetRegNumByIdx(i);
if (reg != REG_NA)
{
var_types type = compiler->lvaGetDesc(varDsc->lvFieldLclStart + i)->TypeGet();
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ bool GenTree::gtHasReg(Compiler* comp) const
{
assert(comp != nullptr);
const GenTreeLclVar* lclNode = AsLclVar();
const unsigned regCount = GetMultiRegCount(comp);
const unsigned regCount = lclNode->GetFieldCount(comp);
// A Multi-reg local vars is said to have regs,
// if it has valid regs in any of the positions.
for (unsigned i = 0; i < regCount; i++)
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/jit/lsraarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,10 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree, int* pDstCou
assert(intrin.op2 != nullptr);
assert(intrin.op3 != nullptr);
assert(isRMW);
srcCount += BuildOperandUses(intrin.op2);
if (!intrin.op2->isContainedIntOrIImmed())
{
srcCount += BuildOperandUses(intrin.op2);
}

assert(intrinsicTree->OperIsMemoryLoadOrStore());
srcCount += BuildAddrUses(intrin.op3);
Expand Down