Skip to content

Commit

Permalink
Always invalidate DFS tree after layout
Browse files Browse the repository at this point in the history
  • Loading branch information
amanasifkhalid committed Feb 7, 2025
1 parent f062f0b commit ce79655
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5227,6 +5227,13 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
DoPhase(this, PHASE_OPTIMIZE_LAYOUT, &Compiler::fgSearchImprovedLayout);
}

// 3-opt will mess with post-order numbers regardless of whether it modifies anything,
// so we always need to invalidate the flowgraph annotations after.
// If we didn't run 3-opt, we might still have a profile-aware DFS tree computed during LSRA available.
// This tree's presence can trigger asserts if pre/postorder numbers are recomputed,
// so invalidate the tree in both cases.
fgInvalidateDfsTree();

// Now that the flowgraph is finalized, run post-layout optimizations.
//
DoPhase(this, PHASE_OPTIMIZE_POST_LAYOUT, &Compiler::optOptimizePostLayout);
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5295,9 +5295,6 @@ PhaseStatus Compiler::fgSearchImprovedLayout()
JITDUMP("No hot blocks found. Skipping reordering.\n");
}

// 3-opt will mess with post-order numbers regardless of whether it modifies anything,
// so we always need to invalidate the flowgraph annotations after.
fgInvalidateDfsTree();
return modified ? PhaseStatus::MODIFIED_EVERYTHING : PhaseStatus::MODIFIED_NOTHING;
}

Expand Down

0 comments on commit ce79655

Please # to comment.