[PATCH] D67970: [DDG] Data Dependence Graph - Root Node

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 13:46:41 PDT 2019


Meinersbur accepted this revision.
Meinersbur added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Analysis/DependenceGraphBuilder.cpp:60
+    for (auto I : depth_first_ext(N, Visited))
+      if (I == N)
+        createDefUseEdge(RootNode, *N);
----------------
bmahjour wrote:
> Meinersbur wrote:
> > The algorithm here seems to add redundant edges depending on the iteration order over the node list (for a graph "A -> B", an edge from the root node is added to both if B is visited before A).
> > 
> > Please add some comment lines about how this algorithm works. The way it is written is somewhat confusing. `depth_first_ext` will always visit `N` first if not yet in the visited list. This makes `I = N` is a test for whether `N` has been visited yet.
> Yes it's possible to add redundant edges depending on the order. This algorithm does not result in minimal edges from the root node but it does try to reduce redundant edges to some extent. An algorithm that would result in truly minimal number of edges from the root would be more complicated requiring more cpu cycles. I used this algorithm because it seems to be a reasonable compromise between compute cost and number of edges created. Please let me know if you don't agree with this approach, otherwise I'll add a comment to clarify.
> 
> 
> 
Thanks for adding some documentation.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67970/new/

https://reviews.llvm.org/D67970





More information about the llvm-commits mailing list