The control flow graph traverses between vertices from the start to the last block using DFS. If it reaches a block where not all of his dependencies are calculated (A block after a condition where not all the preceding branches were visited yet), then it returns up the graph, and the block will be reached again later from a different path.
Loops pose a problem since the graph is cyclic (due to the back edge between the loop body and header). As a result, the dependencies can't be calculated since each vertice depends on the other.
The traversing function should be improved to support such cases.
Proposal
The control flow graph traverses between vertices from the start to the last block using DFS. If it reaches a block where not all of his dependencies are calculated (A block after a condition where not all the preceding branches were visited yet), then it returns up the graph, and the block will be reached again later from a different path. Loops pose a problem since the graph is cyclic (due to the back edge between the loop body and header). As a result, the dependencies can't be calculated since each vertice depends on the other. The traversing function should be improved to support such cases.
For more details: https://en.wikipedia.org/wiki/Control-flow_graph