Can a control dependency graph have loops?

I am trying to understand exactly the concept of a dependency graph. Suppose I have the following control flow graph (in DOT notation):

graph g { 1 -> 2; 2 -> 3; 3 -> 2; 2 -> 4; 1 -> 4 } 

It has a unique entry node (1) and a unique output node (4), and a loop 2 → 3 → 2.

My question is: Does the control dependency graph for this CFG edge of the loop from 2 to itself?

Allen and Kennedy "Optimizing Compilers for Modern Architectures" have an algorithm that creates such an edge to the loop. However, the Mchnick Compilation and Compiler Implementation algorithm for control dependency does not create such an edge. In addition, I could not find examples in the literature where a CDG is drawn with such a loop edge. I am inclined to believe that such an edge does not exist, but, according to the formal definition of the control dependence and according to the Allen and Kennedy algorithm, it should!

If you can give me an example where there is such a loop in the CDG (preferably in a peer-reviewed article or any lectures by a professor, etc.), or if you can argue why the Allen and Kennedy algorithm should be incorrect, I would be glad discover.

+6
source share
2 answers

According to Ferrante 1987 , control dependency loops may exist. In case 2 on page 325, the author indicates that

All nodes of the post-dominator tree on the path from A to B, including A and B, should be controlled depending on A. (This case captures the dependence of the loop.)

So in this case there will be a loop in node A.

+2
source

The usefulness of such a dependency graph is determined by how to streamline operations, right? In this sense, it is not useful to know that an element depends on itself. You can draw loops if you want, but what's really important is all the other edges.

+3
source

Source: https://habr.com/ru/post/907029/


All Articles