@@ -595,9 +595,9 @@ void FlowGraph::constructFlowGraph(INST_LIST& instlist)
595595 // create the entry block of the flow graph
596596 //
597597 G4_BB* fstartBB = NULL ;
598- G4_BB* curr_BB = entryBB = fstartBB = beginBB (labelMap, instlist.front ());
598+ G4_BB* curr_BB = fstartBB = beginBB (labelMap, instlist.front ());
599599
600- kernelInfo = new (mem)FuncInfo (UINT_MAX, entryBB , NULL );
600+ kernelInfo = new (mem)FuncInfo (UINT_MAX, curr_BB , NULL );
601601
602602 std::vector<G4_BB*> subroutineStartBB; // needed by handleExit()
603603
@@ -837,7 +837,7 @@ void FlowGraph::constructFlowGraph(INST_LIST& instlist)
837837 // Ensure each block other than entry starts with a label.
838838 for (auto bb : BBs)
839839 {
840- if (bb != entryBB && !bb->empty ())
840+ if (bb != getEntryBB () && !bb->empty ())
841841 {
842842 G4_INST *inst = bb->front ();
843843 if (inst->isLabel ())
@@ -1833,7 +1833,7 @@ void FlowGraph::removeUnreachableBlocks()
18331833 //
18341834 // assign DFS based pre/rpost ids to all blocks in the main program
18351835 //
1836- doDFS (entryBB , preId);
1836+ doDFS (getEntryBB () , preId);
18371837
18381838 for (BB_LIST_ITER it = BBs.begin (), itEnd = BBs.end (); it != itEnd; ++it)
18391839 {
@@ -1972,7 +1972,7 @@ void FlowGraph::removeRedundantLabels()
19721972 for (BB_LIST_ITER it = BBs.begin (); it != BBs.end ();)
19731973 {
19741974 G4_BB* bb = *it;
1975- if (bb == entryBB )
1975+ if (bb == getEntryBB () )
19761976 {
19771977 it++;
19781978 continue ;
@@ -4818,7 +4818,7 @@ void FlowGraph::findBackEdges()
48184818 unsigned postID = 0 ;
48194819 backEdges.clear ();
48204820
4821- DFSTraverse (entryBB , preId, postID, kernelInfo);
4821+ DFSTraverse (getEntryBB () , preId, postID, kernelInfo);
48224822
48234823 for (auto fn : funcInfoTable)
48244824 {
@@ -4860,7 +4860,9 @@ void FlowGraph::findNaturalLoops()
48604860 loopBody.insert (loopBlock->BBBeforeCall ());
48614861 }
48624862 }
4863- else {
4863+ else
4864+ {
4865+ auto entryBB = getEntryBB ();
48644866 for (auto predBB : loopBlock->Preds )
48654867 {
48664868 if (!predBB->isInNaturalLoop ())
0 commit comments