Find all backedges of CFG by MachineDominatorTree. please look at my jpg.

Hi, Dear Boissinot:

1. When I have irreducible CFG, I travel its nodes by DFS.
   search backedge for every node. After I finish one node,
   push it into a stack.
   [0, 1, 2, M] <---push.
   [0, 1, 2, M,...N] <---push.
   When resolving node M, find a edge from node N to node M,
   N is not in stack(M < N), It is a backedge.
   N is in stack(M > N), It is NOT a backedge.

   I treat these backedges as loop-edges. M is Loop header node.
   If I cut these edges from CFG, CFG can be topological sort.

   Am I right???
--- 10年1月26日,周二, Benoit Boissinot <> 写道:

yes, exactly.