Module 14: Approaches to Control Flow Analysis
  Lecture 27: Algorithm and Interval
 


Algorithm to Find Dominators

D(n0) := {n0};
for n in N-{n0} do D(n) := N;
while changes to any D(n) occur do
for n in N-{n0} do
D(n) := {n} ∪ ∩ D(p);


Loop Detection

  • Search for a back-edge such that a → b is an edge and b dom a.
  • Given a back edge a → b
    • Find set of nodes that can reach node a without going through node b
    • And node b
  • These nodes form a natural loop with b as header.
  • Given back edge a → b natural loop is a sub graph which contains a, b and all the nodes which can reach a without passing through b