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

Forward-substitute long calls on 32 bit targets #74502

Merged
merged 1 commit into from
Aug 26, 2022
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
14 changes: 3 additions & 11 deletions src/coreclr/jit/forwardsub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,32 +673,24 @@ bool Compiler::fgForwardSubStatement(Statement* stmt)
// Eg if fwdSubNode is a multi-reg call, parent node must be GT_ASG and the
// local being defined must be specially marked up.
//
if (fwdSubNode->IsMultiRegCall())
if (varTypeIsStruct(fwdSubNode) && fwdSubNode->IsMultiRegCall())
{
GenTree* const parentNode = fsv.GetParentNode();

if (!parentNode->OperIs(GT_ASG))
{
JITDUMP(" multi-reg call, parent not asg\n");
JITDUMP(" multi-reg struct call, parent not asg\n");
return false;
}

GenTree* const parentNodeLHS = parentNode->gtGetOp1();

if (!parentNodeLHS->OperIs(GT_LCL_VAR))
{
JITDUMP(" multi-reg call, parent not asg(lcl, ...)\n");
JITDUMP(" multi-reg struct call, parent not asg(lcl, ...)\n");
return false;
}

#if defined(TARGET_X86) || defined(TARGET_ARM)
if (fwdSubNode->TypeGet() == TYP_LONG)
{
JITDUMP(" TYP_LONG fwd sub node, target is x86/arm\n");
return false;
}
#endif // defined(TARGET_X86) || defined(TARGET_ARM)

Comment on lines -694 to -701
Copy link
Member

Choose a reason for hiding this comment

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

Just a question. Why do we delete this code that skips TYP_LONG forward substitute node on x86 and arm target?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should not be necessary.

The restriction on substituting multi-reg nodes stems from the fact the backend (LSRA and codegen) can only handle a few select forms of uses for them:

  1. STORE_LCL_VAR(multi-reg node)
  2. RETURN(matching multi-reg call | LCL_VAR)

For structs, these restrictions are enforced by the frontend (mainly importer). For LONGs - by decomposition, which means we don't need to worry about them here.

GenTreeLclVar* const parentNodeLHSLocal = parentNodeLHS->AsLclVar();

unsigned const lhsLclNum = parentNodeLHSLocal->GetLclNum();
Expand Down