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

fixed the split error for LoongArch64. #101656

Merged
merged 4 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/coreclr/jit/abi.cpp
Expand Up @@ -258,16 +258,12 @@ bool ABIPassingInformation::HasExactlyOneStackSegment() const
//
bool ABIPassingInformation::IsSplitAcrossRegistersAndStack() const
{
if (NumSegments < 2)
return false;

bool isFirstInReg = Segments[0].IsPassedInRegister();
for (unsigned i = 1; i < NumSegments; i++)
if (NumSegments != 2)
{
if (isFirstInReg != Segments[i].IsPassedInRegister())
return true;
return false;
}
return false;

return Segments[0].IsPassedInRegister() && Segments[1].IsPassedOnStack();
}
shushanhf marked this conversation as resolved.
Show resolved Hide resolved

//-----------------------------------------------------------------------------
Expand Down
35 changes: 22 additions & 13 deletions src/coreclr/jit/codegencommon.cpp
Expand Up @@ -4261,25 +4261,34 @@ void CodeGen::genHomeStackPartOfSplitParameter(regNumber initReg, bool* initRegS
for (; lclNum < compiler->info.compArgsCount; lclNum++)
{
LclVarDsc* var = compiler->lvaGetDesc(lclNum);
if (!var->lvIsSplit || !var->lvOnFrame)
if (!var->lvOnFrame || !varTypeIsStruct(var))
{
continue;
}

JITDUMP("Homing stack part of split parameter V%02u\n", lclNum);

assert(varTypeIsStruct(var));
assert(!compiler->lvaIsImplicitByRefLocal(lclNum));
const ABIPassingInformation& abiInfo = compiler->lvaGetParameterABIInfo(lclNum);
assert(abiInfo.NumSegments == 2);
assert(abiInfo.Segments[0].GetRegister() == REG_ARG_LAST);
const ABIPassingSegment& seg = abiInfo.Segments[1];
if (abiInfo.IsSplitAcrossRegistersAndStack())
{
assert(var->lvIsSplit);
JITDUMP("Homing stack part of split parameter V%02u\n", lclNum);

genHomeStackSegment(lclNum, seg, initReg, initRegStillZeroed);
assert(abiInfo.NumSegments == 2);
assert(abiInfo.Segments[0].GetRegister() == REG_ARG_LAST);
assert(abiInfo.Segments[1].GetStackOffset() == 0);
const ABIPassingSegment& seg = abiInfo.Segments[1];

for (lclNum += 1; lclNum < compiler->info.compArgsCount; lclNum++)
{
assert(!compiler->lvaGetDesc(lclNum)->lvIsSplit); // There should be only one split parameter
genHomeStackSegment(lclNum, seg, initReg, initRegStillZeroed);

#ifdef DEBUG
for (lclNum += 1; lclNum < compiler->info.compArgsCount; lclNum++)
{
abiInfo = compiler->lvaGetParameterABIInfo(lclNum);
// There should be only one split parameter
assert(!abiInfo.IsSplitAcrossRegistersAndStack());
}
#endif
break;
}
break;
}
#endif // TARGET_RISCV64 || TARGET_LOONGARCH64
}
Expand Down