[PATCH] D24219: [LCG] Redesign the lazy post-order iteration mechanism for the LazyCallGraph to support repeated, stable iterations, even in the face of graph updates.
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 4 02:13:11 PDT 2016
chandlerc created this revision.
chandlerc added a reviewer: sanjoy.
chandlerc added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.
This is particularly important to allow the CGSCC pass manager to walk
the RefSCCs (and thus everything else) in a module more than once. Lots
of unittests and other tests were hard or impossible to write because
repeated CGSCC pass managers which didn't invalidate the LazyCallGraph
would conclude the module was empty after the first one. =[ Really,
The interesting thing is that in many ways this simplifies the code. We
can now re-use the same code for handling reference edge insertion
updates of the RefSCC graph as we use for handling call edge insertion
updates of the SCC graph. Outside of adapting to the shared logic for
this (which isn't trivial, but is *much* simpler than the DFS it
replaces!), the new code involves putting newly created RefSCCs when
deleting a reference edge into the cached list in the correct way, and
to re-formulate the iterator to be stable and effective even in the face
of these kinds of updates.
I've updated the unittests for the LazyCallGraph to re-iterate the
postorder sequence and verify that this all works. We even check for
using alternating iterators to trigger the lazy formation of RefSCCs
after mutation has occured.
It's worth noting that there are a reasonable number of likely simplifications
we can make past this. It isn't clear that we need to keep the "LeafRefSCCs"
around any more. But I've not removed that mostly because I want this to be
a more isolated change.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 22039 bytes
Desc: not available
More information about the llvm-commits