Skip to content

JIT: Don't use Compiler::compFloatingPointUsed to check if FP kills are needed #112668

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

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/coreclr/jit/lsra.h
Original file line number Diff line number Diff line change
Expand Up @@ -741,15 +741,16 @@ class LinearScan : public LinearScanInterface
void updateMaxSpill(RefPosition* refPosition);
void recordMaxSpill();

private:
// max simultaneous spill locations used of every type
unsigned int maxSpill[TYP_COUNT];
unsigned int currentSpill[TYP_COUNT];
bool needFloatTmpForFPCall;
bool needDoubleTmpForFPCall;
bool needNonIntegerRegisters;
bool needToKillFloatRegs;

#ifdef DEBUG
private:
//------------------------------------------------------------------------
// Should we stress lsra? This uses the DOTNET_JitStressRegs variable.
//
Expand Down
10 changes: 6 additions & 4 deletions src/coreclr/jit/lsrabuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,9 @@ regMaskTP LinearScan::getKillSetForCall(GenTreeCall* call)
}

// if there is no FP used, we can ignore the FP kills
if (!compiler->compFloatingPointUsed)
if (!needToKillFloatRegs)
{
assert(!compiler->compFloatingPointUsed || !enregisterLocalVars);
#if defined(TARGET_XARCH)

#ifdef TARGET_AMD64
Expand Down Expand Up @@ -2332,7 +2333,6 @@ void LinearScan::buildIntervals()
// live-in at the entry to each block (this will include the incoming args on
// the first block).
VarSetOps::AssignNoCopy(compiler, currentLiveVars, VarSetOps::MakeEmpty(compiler));
const bool floatingPointUsed = compiler->compFloatingPointUsed;

for (block = startBlockSequence(); block != nullptr; block = moveToNextBlock())
{
Expand All @@ -2341,6 +2341,7 @@ void LinearScan::buildIntervals()

if (localVarsEnregistered)
{
needToKillFloatRegs = compiler->compFloatingPointUsed;
bool predBlockIsAllocated = false;
BasicBlock* const predBlock = findPredBlockForLiveIn(block, prevBlock DEBUGARG(&predBlockIsAllocated));
if (predBlock != nullptr)
Expand Down Expand Up @@ -2412,8 +2413,8 @@ void LinearScan::buildIntervals()
}
else
{
// If state isn't live across blocks, then reset any global Compiler state.
compiler->compFloatingPointUsed = floatingPointUsed;
// If state isn't live across blocks, set FP register kill switch per block.
needToKillFloatRegs = false;
}

// Add a dummy RefPosition to mark the block boundary.
Expand Down Expand Up @@ -3012,6 +3013,7 @@ RefPosition* LinearScan::BuildDef(GenTree* tree, SingleTypeRegSet dstCandidates,
if (!varTypeUsesIntReg(type))
{
compiler->compFloatingPointUsed = true;
needToKillFloatRegs = true;
}

Interval* interval = newInterval(type);
Expand Down
Loading