llvm-project/llvm/unittests/Analysis
Chandler Carruth 49d728ad21 [LCG] Redesign the lazy post-order iteration mechanism for the
LazyCallGraph to support repeated, stable iterations, even in the face
of graph updates.

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,
really bad.

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.

Differential Revision: https://reviews.llvm.org/D24219

llvm-svn: 281716
2016-09-16 10:20:17 +00:00
..
AliasAnalysisTest.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
BlockFrequencyInfoTest.cpp Revert r272891 "[JumpThreading] Prevent dangling pointer problems in BranchProbabilityInfo" 2016-06-16 16:25:53 +00:00
CFGTest.cpp Remove every uses of getGlobalContext() in LLVM (but the C API) 2016-04-14 21:59:01 +00:00
CGSCCPassManagerTest.cpp [PM] Revert r280447: Add a unittest for invalidating module analyses with an SCC pass. 2016-09-04 08:42:31 +00:00
CMakeLists.txt Add getBlockProfileCount method to BlockFrequencyInfo 2016-03-23 18:18:26 +00:00
CallGraphTest.cpp [GraphTraits] Replace all NodeType usage with NodeRef 2016-08-22 21:09:30 +00:00
LazyCallGraphTest.cpp [LCG] Redesign the lazy post-order iteration mechanism for the 2016-09-16 10:20:17 +00:00
LoopPassManagerTest.cpp Consistently use LoopAnalysisManager 2016-08-09 00:28:52 +00:00
MixedTBAATest.cpp [PM/AA] Port alias analysis evaluator to the new pass manager, and use 2016-02-20 03:46:03 +00:00
ScalarEvolutionTest.cpp Add a C++ unittest to test the fix for PR30213. 2016-09-15 04:06:44 +00:00
UnrollAnalyzer.cpp Revert "Revert "[Unroll] Implement a conservative and monotonically increasing cost tracking system during the full unroll heuristic analysis that avoids counting any instruction cost until that instruction becomes "live" through a side-effect or use outside the..."" 2016-05-13 21:23:25 +00:00
ValueTrackingTest.cpp Remove every uses of getGlobalContext() in LLVM (but the C API) 2016-04-14 21:59:01 +00:00