Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
14 changes: 10 additions & 4 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5235,8 +5235,7 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
m_pLowering->FinalizeOutgoingArgSpace();

// We can not add any new tracked variables after this point.
lvaTrackedFixed = true;
const unsigned numBlocksBeforeLSRA = fgBBcount;
lvaTrackedFixed = true;

// Now that lowering is completed we can proceed to perform register allocation
//
Expand All @@ -5250,8 +5249,10 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl

if (opts.OptimizationEnabled())
{
// LSRA may introduce new blocks. If it does, rerun layout.
if ((fgBBcount != numBlocksBeforeLSRA) && JitConfig.JitDoReversePostOrderLayout())
// We won't introduce new blocks from here on out,
// so run the new block layout.
//
if (JitConfig.JitDoReversePostOrderLayout())
{
auto lateLayoutPhase = [this] {
fgDoReversePostOrderLayout();
Expand All @@ -5272,7 +5273,12 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
DoPhase(this, PHASE_DETERMINE_FIRST_COLD_BLOCK, &Compiler::fgDetermineFirstColdBlock);

// Now that the flowgraph is finalized, run post-layout optimizations.
//
DoPhase(this, PHASE_OPTIMIZE_POST_LAYOUT, &Compiler::optOptimizePostLayout);

// Determine start of cold region if we are hot/cold splitting
//
DoPhase(this, PHASE_DETERMINE_FIRST_COLD_BLOCK, &Compiler::fgDetermineFirstColdBlock);
}

#if FEATURE_LOOP_ALIGN
Expand Down
18 changes: 4 additions & 14 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3341,22 +3341,12 @@ bool Compiler::fgReorderBlocks(bool useProfile)

if (useProfile)
{
// Don't run the new layout until we get to the backend,
// since LSRA can introduce new blocks, and lowering can churn the flowgraph.
//
if (JitConfig.JitDoReversePostOrderLayout())
{
fgDoReversePostOrderLayout();
fgMoveColdBlocks();

if (compHndBBtabCount != 0)
{
fgFindEHRegionEnds();
}

// Renumber blocks to facilitate LSRA's order of block visitation
// TODO: Consider removing this, and using traversal order in lSRA
//
fgRenumberBlocks();

return true;
return (newRarelyRun || movedBlocks || optimizedSwitches);
}

// We will be reordering blocks, so ensure the false target of a BBJ_COND block is its next block
Expand Down
Loading