mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-11 02:13:38 +09:00
JIT: Factor SSA's DFS and profile synthesis's loop finding (#95251)
Factor out SSA's general DFS (that takes EH into account) and encapsulate it in a `FlowGraphDfsTree` class. Factor out profile synthesis's loop finding and encapsulate it in a `FlowGraphNaturalLoops` class. Switch construction of it to use the general DFS instead of the restricted one (that does not account for exceptional flow). Optimize a few things in the process: * Avoid storing loop blocks in a larger than necessary bit vector; store them starting from the loop header's postorder index instead. * Provide post-order and reverse post-order visitors for the loop blocks; switch profile synthesis to use this in a place No diffs are expected. A small amount of diffs are expected when profile synthesis is enabled due to the modelling of exceptional flow and also from handling unreachable predecessors (which would reject some loops as unnatural loops before). My future plans are to proceed to replace the loop representation of loops with this factored version, removing the lexicality requirement in the process, and hopefully fixing some of our deficiencies.
This commit is contained in:
parent
8ba8da3e9e
commit
f106d7ecd1
15 changed files with 1054 additions and 635 deletions
|
@ -9668,8 +9668,7 @@ public:
|
|||
//
|
||||
bool IsReachable(BasicBlock* bb)
|
||||
{
|
||||
return (bb->bbPostorderNum < m_comp->fgSSAPostOrderCount) &&
|
||||
(m_comp->fgSSAPostOrder[bb->bbPostorderNum] == bb) &&
|
||||
return m_comp->m_dfs->Contains(bb) &&
|
||||
!BitVecOps::IsMember(&m_blockTraits, m_provenUnreachableBlocks, bb->bbNum);
|
||||
}
|
||||
|
||||
|
@ -9850,9 +9849,11 @@ PhaseStatus Compiler::fgValueNumber()
|
|||
// SSA has already computed a post-order taking EH successors into account.
|
||||
// Visiting that in reverse will ensure we visit a block's predecessors
|
||||
// before itself whenever possible.
|
||||
for (unsigned i = fgSSAPostOrderCount; i != 0; i--)
|
||||
BasicBlock** postOrder = m_dfs->GetPostOrder();
|
||||
unsigned postOrderCount = m_dfs->GetPostOrderCount();
|
||||
for (unsigned i = postOrderCount; i != 0; i--)
|
||||
{
|
||||
BasicBlock* block = fgSSAPostOrder[i - 1];
|
||||
BasicBlock* block = postOrder[i - 1];
|
||||
JITDUMP("Visiting " FMT_BB "\n", block->bbNum);
|
||||
|
||||
if (block != fgFirstBB)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue