Skip to content

Commit

Permalink
Reduce calli address spilling
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalPetryka committed Apr 26, 2023
1 parent 2430618 commit b7efcce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25862,7 +25862,7 @@ bool GenTreeLclFld::IsOffsetMisaligned() const

bool GenTree::IsInvariant() const
{
return OperIsConst() || OperIs(GT_LCL_ADDR);
return OperIsConst() || OperIs(GT_LCL_ADDR) || OperIs(GT_FTN_ADDR);
}

//------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12758,7 +12758,7 @@ void Compiler::impFixPredLists()
//
bool Compiler::impIsInvariant(const GenTree* tree)
{
return tree->OperIsConst() || impIsAddressInLocal(tree);
return tree->OperIsConst() || impIsAddressInLocal(tree) || tree->OperIs(GT_FTN_ADDR);
}

//------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1631,8 +1631,9 @@ GenTreeCall* Compiler::impImportIndirectCall(CORINFO_SIG_INFO* sig, const DebugI
* it may cause registered args to be spilled. Simply spill it.
*/

// Ignore this trivial case.
if (impStackTop().val->gtOper != GT_LCL_VAR)
// Ignore no args or trivial cases.
if ((sig->callConv != CORINFO_CALLCONV_DEFAULT || sig->totalILArgs() > 0) &&
!impStackTop().val->OperIs(GT_LCL_VAR, GT_FTN_ADDR, GT_CNS_INT))
{
impSpillStackEntry(verCurrentState.esStackDepth - 1,
BAD_VAR_NUM DEBUGARG(false) DEBUGARG("impImportIndirectCall"));
Expand Down

0 comments on commit b7efcce

Please sign in to comment.