[Lldb-commits] [lldb] r298530 - [analyze deps] Also show cycle islands.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 22 11:04:20 PDT 2017

Author: zturner
Date: Wed Mar 22 13:04:20 2017
New Revision: 298530

URL: http://llvm.org/viewvc/llvm-project?rev=298530&view=rev
[analyze deps] Also show cycle islands.

We currently display a list of all minimal cycles, but it's
useful to be able to see the big picture impact of these cycles
by merging them all together into groups of interconnected

Because the cycle discovery algorithm only considers "minimal"
cycles, it discards all information for dependencies which are
not considered part of the minimal cycle.  So all we know is that
the components of each island definitely all depend on each other
but it's still possible that there are hidden dependencies due
to transitive includes.

The cycle list should still be the authoritative reference for
deciding where the easiest places to break cycles are, though.


Modified: lldb/trunk/scripts/analyze-project-deps.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/analyze-project-deps.py?rev=298530&r1=298529&r2=298530&view=diff
--- lldb/trunk/scripts/analyze-project-deps.py (original)
+++ lldb/trunk/scripts/analyze-project-deps.py Wed Mar 22 13:04:20 2017
@@ -105,6 +105,7 @@ def expand(path_queue, path_lengths, cyc
         next_len = path_lengths.pop(0) + 1
         last_component = cur_path[-1]
         for item in src_map[last_component]:
             if item.startswith("clang"):
@@ -177,5 +178,18 @@ if args.discover_cycles:
         for cycle in cycles:
             print " -> ".join(cycle)
+    print "Analyzing islands..."
+    islands = []
+    for cycle in cycles:
+        this_cycle = set(cycle)
+        disjoints = [x for x in islands if this_cycle.isdisjoint(x)]
+        overlaps = [x for x in islands if not this_cycle.isdisjoint(x)]
+        islands = disjoints + [set.union(this_cycle, *overlaps)]
+    print "Found {} disjoint cycle islands...".format(len(islands))
+    for island in islands:
+        print "Island ({} elements)".format(len(island))
+        for node in island:
+            print "  {0}".format(node)
\ No newline at end of file

More information about the lldb-commits mailing list