Skip to content

Commit

Permalink
fix naot-llvm abi (dotnet#109224)
Browse files Browse the repository at this point in the history
Co-authored-by: egorbot <egorbot@build.foo>
  • Loading branch information
EgorBo and egorbot authored Oct 28, 2024
1 parent f1ad214 commit efbb417
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2643,7 +2643,7 @@ GenTree* Compiler::optVNBasedFoldExpr_Call_Memmove(GenTreeCall* call)

// if dstArg is not simple, we replace the arg directly with a temp assignment and
// continue using that temp - it allows us reliably extract all side effects.
GenTree* dst = fgMakeMultiUse(&dstArg->LateNodeRef());
GenTree* dst = fgMakeMultiUse(&dstArg->NodeRef());

// Now we're going to emit a chain of STOREIND via COMMA nodes.
// the very first tree is expected to be side-effects from the original call (including all args)
Expand Down Expand Up @@ -2714,7 +2714,7 @@ GenTree* Compiler::optVNBasedFoldExpr_Call(BasicBlock* block, GenTree* parent, G
{
// if castObjArg is not simple, we replace the arg with a temp assignment and
// continue using that temp - it allows us reliably extract all side effects
castObjArg = fgMakeMultiUse(&castObjCallArg->LateNodeRef());
castObjArg = fgMakeMultiUse(&castObjCallArg->NodeRef());
return gtWrapWithSideEffects(castObjArg, call, GTF_ALL_EFFECT, true);
}

Expand All @@ -2731,7 +2731,7 @@ GenTree* Compiler::optVNBasedFoldExpr_Call(BasicBlock* block, GenTree* parent, G
{
// if castObjArg is not simple, we replace the arg with a temp assignment and
// continue using that temp - it allows us reliably extract all side effects
castObjArg = fgMakeMultiUse(&castObjCallArg->LateNodeRef());
castObjArg = fgMakeMultiUse(&castObjCallArg->NodeRef());
return gtWrapWithSideEffects(castObjArg, call, GTF_ALL_EFFECT, true);
}
}
Expand Down Expand Up @@ -5217,7 +5217,7 @@ GenTree* Compiler::optAssertionProp_Call(ASSERT_VALARG_TP assertions, GenTreeCal

// if castObjArg is not simple, we replace the arg with a temp assignment and
// continue using that temp - it allows us reliably extract all side effects
objArg = fgMakeMultiUse(&objCallArg->LateNodeRef());
objArg = fgMakeMultiUse(&objCallArg->NodeRef());
objArg = gtWrapWithSideEffects(objArg, call, GTF_SIDE_EFFECT, true);
return optAssertionProp_Update(objArg, call, stmt);
}
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -4808,6 +4808,11 @@ class CallArg
// This is the same as GetEarlyNode() until morph.
// After lowering, this is a PUTARG_* node.
GenTree* GetNode()
{
return NodeRef();
}

GenTree*& NodeRef()
{
return m_lateNode == nullptr ? m_earlyNode : m_lateNode;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/helperexpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2462,7 +2462,7 @@ bool Compiler::fgLateCastExpansionForCall(BasicBlock** pBlock, Statement* stmt,
GenTree* storeCseVal = nullptr;
if (candidateId == 0)
{
GenTree*& castArg = call->gtArgs.GetUserArgByIndex(0)->LateNodeRef();
GenTree*& castArg = call->gtArgs.GetUserArgByIndex(0)->NodeRef();
if (GenTree::Compare(castArg, expectedClsNode))
{
const unsigned clsTmp = lvaGrabTemp(true DEBUGARG("CSE for expectedClsNode"));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2856,7 +2856,7 @@ void Compiler::fgMorphMultiregStructArgs(GenTreeCall* call)
if ((arg.AbiInfo.ArgType == TYP_STRUCT) && !arg.AbiInfo.PassedByRef)
{
foundStructArg = true;
GenTree*& argx = (arg.GetLateNode() != nullptr) ? arg.LateNodeRef() : arg.EarlyNodeRef();
GenTree*& argx = arg.NodeRef();

if (!argx->OperIs(GT_FIELD_LIST))
{
Expand Down

0 comments on commit efbb417

Please # to comment.