]> granicus.if.org Git - llvm/commitdiff
[LCG] Add a previously missing assert about the relationship of RefSCCs.
authorChandler Carruth <chandlerc@gmail.com>
Tue, 22 Nov 2016 21:40:10 +0000 (21:40 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 22 Nov 2016 21:40:10 +0000 (21:40 +0000)
No intended change, everything seems to be in working order already.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287705 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LazyCallGraph.cpp

index 9377fcb0d60ad7d36e5d2d97db9f6c5718a2a641..6111bba9d24bc39ee5951c6a07eaa7c4f824e3fa 100644 (file)
@@ -1435,6 +1435,13 @@ void LazyCallGraph::RefSCC::insertTrivialRefEdge(Node &SourceN, Node &TargetN) {
 #ifndef NDEBUG
   // Check that the RefSCC is still valid when we finish.
   auto ExitVerifier = make_scope_exit([this] { verify(); });
+
+  // Check that we aren't breaking some invariants of the RefSCC graph.
+  RefSCC &SourceRC = *G->lookupRefSCC(SourceN);
+  RefSCC &TargetRC = *G->lookupRefSCC(TargetN);
+  if (&SourceRC != &TargetRC)
+    assert(SourceRC.isAncestorOf(TargetRC) &&
+           "Ref edge is not trivial in the RefSCC graph!");
 #endif
   // First insert it into the source or find the existing edge.
   auto InsertResult = SourceN.EdgeIndexMap.insert(