@@ -69,6 +69,8 @@ PhaseStatus Compiler::fgSsaBuild()
6969    JitTestCheckSSA ();
7070#endif  //  DEBUG
7171
72+     fgSSAPostOrder = builder.GetPostOrder (&fgSSAPostOrderCount);
73+ 
7274    return  PhaseStatus::MODIFIED_EVERYTHING;
7375}
7476
@@ -144,7 +146,7 @@ SsaBuilder::SsaBuilder(Compiler* pCompiler)
144146//   Return Value:
145147//      The number of nodes visited while performing DFS on the graph.
146148// 
147- int  SsaBuilder::TopologicalSort (BasicBlock** postOrder, int  count)
149+ unsigned  SsaBuilder::TopologicalSort (BasicBlock** postOrder, int  count)
148150{
149151    Compiler* comp = m_pCompiler;
150152
@@ -179,7 +181,7 @@ int SsaBuilder::TopologicalSort(BasicBlock** postOrder, int count)
179181    };
180182
181183    //  Compute order.
182-     int           postIndex = 0 ;
184+     unsigned     postIndex = 0 ;
183185    BasicBlock* block     = comp->fgFirstBB ;
184186    BitVecOps::AddElemD (&m_visitedTraits, m_visited, block->bbNum );
185187
@@ -206,16 +208,13 @@ int SsaBuilder::TopologicalSort(BasicBlock** postOrder, int count)
206208            //  all successors have been visited
207209            blocks.Pop ();
208210
209-             DBG_SSA_JITDUMP (" [SsaBuilder::TopologicalSort] postOrder[%d ] = " " \n " bbNum );
211+             DBG_SSA_JITDUMP (" [SsaBuilder::TopologicalSort] postOrder[%u ] = " " \n " bbNum );
210212            postOrder[postIndex]  = block;
211213            block->bbPostorderNum  = postIndex;
212214            postIndex++;
213215        }
214216    }
215217
216-     //  In the absence of EH (because catch/finally have no preds), this should be valid.
217-     //  assert(postIndex == (count - 1));
218- 
219218    return  postIndex;
220219}
221220
@@ -1500,16 +1499,7 @@ void SsaBuilder::Build()
15001499
15011500    //  Allocate the postOrder array for the graph.
15021501
1503-     BasicBlock** postOrder;
1504- 
1505-     if  (blockCount > DEFAULT_MIN_OPTS_BB_COUNT)
1506-     {
1507-         postOrder = new  (m_allocator) BasicBlock*[blockCount];
1508-     }
1509-     else 
1510-     {
1511-         postOrder = (BasicBlock**)_alloca (blockCount * sizeof (BasicBlock*));
1512-     }
1502+     m_postOrder = new  (m_allocator) BasicBlock*[blockCount];
15131503
15141504    m_visitedTraits = BitVecTraits (blockCount, m_pCompiler);
15151505    m_visited       = BitVecOps::MakeEmpty (&m_visitedTraits);
@@ -1527,12 +1517,12 @@ void SsaBuilder::Build()
15271517    }
15281518
15291519    //  Topologically sort the graph.
1530-     int  count  = TopologicalSort (postOrder , blockCount);
1520+     m_postOrderCount  = TopologicalSort (m_postOrder , blockCount);
15311521    JITDUMP (" [SsaBuilder] Topologically sorted the graph.\n " 
15321522    EndPhase (PHASE_BUILD_SSA_TOPOSORT);
15331523
15341524    //  Compute IDom(b).
1535-     ComputeImmediateDom (postOrder, count );
1525+     ComputeImmediateDom (m_postOrder, m_postOrderCount );
15361526
15371527    m_pCompiler->fgSsaDomTree  = m_pCompiler->fgBuildDomTree ();
15381528    EndPhase (PHASE_BUILD_SSA_DOMS);
@@ -1551,7 +1541,7 @@ void SsaBuilder::Build()
15511541    }
15521542
15531543    //  Insert phi functions.
1554-     InsertPhiFunctions (postOrder, count );
1544+     InsertPhiFunctions (m_postOrder, m_postOrderCount );
15551545
15561546    //  Rename local variables and collect UD information for each ssa var.
15571547    RenameVariables ();
0 commit comments