Skip to content

Commit

Permalink
JIT: Remove some early fgReorderBlocks calls (dotnet#97012)
Browse files Browse the repository at this point in the history
Before finalizing the block layout with optOptimizeLayout, we call fgReorderBlocks in a few optimization passes that modify the flowgraph (though without the intent to actually reorder any blocks, by passing useProfile=false). Removing all of these early calls -- except for the one in optOptimizeFlow, which can probably be replaced by moving fgReorderBlocks's branch optimization logic to fgUpdateFlowGraph -- incurs relatively few diffs, and gets us closer to dotnet#93020's goal of deferring block reordering until late in the JIT's optimization phases.
  • Loading branch information
amanasifkhalid authored and tmds committed Jan 23, 2024
1 parent 6160277 commit 791ae08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,11 @@ PhaseStatus Compiler::fgInsertGCPolls()
block = curBasicBlock;
}

// If we split a block to create a GC Poll, then rerun fgReorderBlocks to push the rarely run blocks out
// past the epilog. We should never split blocks unless we're optimizing.
// If we split a block to create a GC Poll, call fgUpdateChangedFlowGraph.
// We should never split blocks unless we're optimizing.
if (createdPollBlocks)
{
noway_assert(opts.OptimizationEnabled());
fgReorderBlocks(/* useProfileData */ false);
fgUpdateChangedFlowGraph(FlowGraphUpdates::COMPUTE_BASICS);
}

Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/helperexpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,6 @@ PhaseStatus Compiler::fgExpandHelper(bool skipRarelyRunBlocks)

if ((result == PhaseStatus::MODIFIED_EVERYTHING) && opts.OptimizationEnabled())
{
fgReorderBlocks(/* useProfileData */ false);
fgUpdateChangedFlowGraph(FlowGraphUpdates::COMPUTE_BASICS);
}

Expand Down

0 comments on commit 791ae08

Please sign in to comment.