Skip to content

Commit aa974c7

Browse files
JIT: Remove some early fgReorderBlocks calls (#97012)
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 #93020's goal of deferring block reordering until late in the JIT's optimization phases.
1 parent 3c4b628 commit aa974c7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/coreclr/jit/flowgraph.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,11 @@ PhaseStatus Compiler::fgInsertGCPolls()
150150
block = curBasicBlock;
151151
}
152152

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

src/coreclr/jit/helperexpansion.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,6 @@ PhaseStatus Compiler::fgExpandHelper(bool skipRarelyRunBlocks)
867867

868868
if ((result == PhaseStatus::MODIFIED_EVERYTHING) && opts.OptimizationEnabled())
869869
{
870-
fgReorderBlocks(/* useProfileData */ false);
871870
fgUpdateChangedFlowGraph(FlowGraphUpdates::COMPUTE_BASICS);
872871
}
873872

0 commit comments

Comments
 (0)