Skip to content
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
15 changes: 8 additions & 7 deletions src/coreclr/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2598,17 +2598,18 @@ class CSE_Heuristic
cse_use_cost *= slotCount;
}

// If this CSE is live across a call then we may need to spill an additional caller save register
// If this CSE is live across a call then we may have additional costs
//
if (candidate->LiveAcrossCall())
{
if (candidate->Expr()->IsCnsFltOrDbl() && (CNT_CALLEE_SAVED_FLOAT == 0) &&
(candidate->CseDsc()->csdUseWtCnt <= 4))
// If we have a floating-point CSE that is both live across a call and there
// are no callee-saved FP registers available, the RA will have to spill at
// the def site and reload at the (first) use site, if the variable is a register
// candidate. Account for that.
if (varTypeIsFloating(candidate->Expr()) && (CNT_CALLEE_SAVED_FLOAT == 0) && !candidate->IsConservative())
{
// Floating point constants are expected to be contained, so unless there are more than 4 uses
// we better not to CSE them, especially on platforms without callee-saved registers
// for values living across calls
return false;
cse_def_cost += 1;
cse_use_cost += 1;
}

// If we don't have a lot of variables to enregister or we have a floating point type
Expand Down