summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LazyCallGraph.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2017-08-10 03:05:21 +0000
committerChandler Carruth <chandlerc@gmail.com>2017-08-10 03:05:21 +0000
commit9c161e894af3dd7f54dd29218a476bc270864d24 (patch)
tree16221f33d61563f35849afe9cc7be5abb99f602b /llvm/lib/Analysis/LazyCallGraph.cpp
parenta95eae2d4b87e19e3d27aed844f9d6762b55de8a (diff)
downloadbcm5719-llvm-9c161e894af3dd7f54dd29218a476bc270864d24.tar.gz
bcm5719-llvm-9c161e894af3dd7f54dd29218a476bc270864d24.zip
[LCG] Fix an assert in a on-scope-exit lambda that checked the contents
of the returned value. Checking the returned value from inside of a scoped exit isn't actually valid. It happens to work when NRVO fires and the stars align, which they reliably do with Clang but don't, for example, on MSVC builds. llvm-svn: 310547
Diffstat (limited to 'llvm/lib/Analysis/LazyCallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/LazyCallGraph.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp
index b658fed40c4..5aeea9ef1f7 100644
--- a/llvm/lib/Analysis/LazyCallGraph.cpp
+++ b/llvm/lib/Analysis/LazyCallGraph.cpp
@@ -1105,14 +1105,10 @@ LazyCallGraph::RefSCC::removeInternalRefEdge(Node &SourceN,
// or we return new RefSCCs and this RefSCC is dead.
verify();
auto VerifyOnExit = make_scope_exit([&]() {
- if (Result.empty()) {
+ // If we didn't replace our RefSCC with new ones, check that this one
+ // remains valid.
+ if (G)
verify();
- } else {
- assert(!G && "A dead RefSCC should have its graph pointer nulled.");
- assert(SCCs.empty() && "A dead RefSCC should have no SCCs in it.");
- for (RefSCC *RC : Result)
- RC->verify();
- }
});
#endif
@@ -1325,6 +1321,12 @@ LazyCallGraph::RefSCC::removeInternalRefEdge(Node &SourceN,
SCCs.clear();
SCCIndices.clear();
+#ifndef NDEBUG
+ // Verify the new RefSCCs we've built.
+ for (RefSCC *RC : Result)
+ RC->verify();
+#endif
+
// Return the new list of SCCs.
return Result;
}
OpenPOWER on IntegriCloud