Skip to content
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
22 changes: 11 additions & 11 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4389,6 +4389,13 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
DoPhase(this, PHASE_IBCPREP, &Compiler::fgPrepareToInstrumentMethod);
}

// If we are doing OSR, update flow to initially reach the appropriate IL offset.
//
if (opts.IsOSR())
{
fgFixEntryFlowForOSR();
}

// Enable the post-phase checks that use internal logic to decide when checking makes sense.
//
activePhaseChecks =
Expand All @@ -4398,17 +4405,17 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
//
DoPhase(this, PHASE_IMPORTATION, &Compiler::fgImport);

// Expand any patchpoints
//
DoPhase(this, PHASE_PATCHPOINTS, &Compiler::fgTransformPatchpoints);

// If instrumenting, add block and class probes.
//
if (compileFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR))
{
DoPhase(this, PHASE_IBCINSTR, &Compiler::fgInstrumentMethod);
}

// Expand any patchpoints
//
DoPhase(this, PHASE_PATCHPOINTS, &Compiler::fgTransformPatchpoints);

// Transform indirect calls that require control flow expansion.
//
DoPhase(this, PHASE_INDXCALL, &Compiler::fgTransformIndirectCalls);
Expand Down Expand Up @@ -6577,13 +6584,6 @@ int Compiler::compCompileHelper(CORINFO_MODULE_HANDLE classPtr,
{
// We are jitting the root method, or inlining.
fgFindBasicBlocks();

// If we are doing OSR, update flow to initially reach the appropriate IL offset.
//
if (opts.IsOSR())
{
fgFixEntryFlowForOSR();
}
}

// If we're inlining and the candidate is bad, bail out.
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3619,6 +3619,11 @@ void Compiler::fgFixEntryFlowForOSR()
fgFirstBB->bbJumpDest = osrEntry;
fgAddRefPred(osrEntry, fgFirstBB);

// Give the method entry (which will be a scratch BB)
// the same weight as the OSR Entry.
//
fgFirstBB->inheritWeight(fgOSREntryBB);

JITDUMP("OSR: redirecting flow at entry from entry " FMT_BB " to OSR entry " FMT_BB " for the importer\n",
fgFirstBB->bbNum, osrEntry->bbNum);
}
Expand Down
Loading