Skip to content

JIT: Delay creation of scratch block needed by backend #110396

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

Closed
wants to merge 3 commits into from
Closed
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
9 changes: 0 additions & 9 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2307,15 +2307,6 @@ PhaseStatus Compiler::fgAddInternal()
// type with a runtime lookup
madeChanges |= fgCreateFiltersForGenericExceptions();

// The backend requires a scratch BB into which it can safely insert a P/Invoke method prolog if one is
// required. Similarly, we need a scratch BB for poisoning and when we have Swift parameters to reassemble.
// Create it here.
if (compMethodRequiresPInvokeFrame() || compShouldPoisonFrame() || lvaHasAnySwiftStackParamToReassemble())
{
madeChanges |= fgEnsureFirstBBisScratch();
fgFirstBB->SetFlags(BBF_DONT_REMOVE);
}

/*
<BUGNUM> VSW441487 </BUGNUM>

Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7812,6 +7812,18 @@ void Lowering::WidenSIMD12IfNecessary(GenTreeLclVarCommon* node)

PhaseStatus Lowering::DoPhase()
{
// We need a scratch BB into which it can safely insert a P/Invoke method
// prolog if one is required. Similarly, we need a scratch BB for poisoning
// and when we have Swift parameters to reassemble. Create it here.
if (comp->compMethodRequiresPInvokeFrame() || comp->compShouldPoisonFrame() ||
comp->lvaHasAnySwiftStackParamToReassemble())
{
if (comp->fgEnsureFirstBBisScratch())
{
comp->fgInvalidateDfsTree();
}
}

// If we have any PInvoke calls, insert the one-time prolog code. We'll insert the epilog code in the
// appropriate spots later. NOTE: there is a minor optimization opportunity here, as we still create p/invoke
// data structures and setup/teardown even if we've eliminated all p/invoke calls due to dead code elimination.
Expand Down
Loading