DSTest: Fail test if any, not all, specified callees are reported.
Test included.
llvm-svn: 238374
diff --git a/poolalloc/lib/DSA/DSTest.cpp b/poolalloc/lib/DSA/DSTest.cpp
index 7d50f7d..20ca7f6 100644
--- a/poolalloc/lib/DSA/DSTest.cpp
+++ b/poolalloc/lib/DSA/DSTest.cpp
@@ -621,12 +621,11 @@
const DSCallGraph callgraph = DS->getCallGraph();
FuncSetTy analysisCallees = getCalleesFor(caller, callgraph);
- if (std::includes(analysisCallees.begin(), analysisCallees.end(),
- notCallees.begin(), notCallees.end())) {
- FuncSetTy invalid;
- std::set_intersection(analysisCallees.begin(), analysisCallees.end(),
- notCallees.begin(), notCallees.end(),
- std::inserter(invalid, invalid.begin()));
+ FuncSetTy invalid;
+ std::set_intersection(analysisCallees.begin(), analysisCallees.end(),
+ notCallees.begin(), notCallees.end(),
+ std::inserter(invalid, invalid.begin()));
+ if (!invalid.empty()) {
errs() << "ERROR: Callgraph check failed for: \t" << caller->getName() << "\n";
errs() << " Analysis says calls: \t";
printCallees(analysisCallees, errs()); errs() << "\n";
diff --git a/poolalloc/test/dsa/callgraph/dstest_anynotall.ll b/poolalloc/test/dsa/callgraph/dstest_anynotall.ll
new file mode 100644
index 0000000..59ce260
--- /dev/null
+++ b/poolalloc/test/dsa/callgraph/dstest_anynotall.ll
@@ -0,0 +1,25 @@
+;RUN: dsaopt %s -dsa-td -analyze -check-callees=main,A
+;RUN: dsaopt %s -dsa-td -analyze -check-not-callees=main
+; Verify -check-not-callee behavior as error if any not all
+; specified callees are reported by the callgraph.
+; Test this using an empty set of callees.
+; ModuleID = 'calltargets.o'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define internal void @A() nounwind {
+entry:
+ ret void
+}
+
+define internal void @B() nounwind {
+entry:
+ ret void
+}
+
+define void @main() nounwind {
+entry:
+ call void @A() nounwind
+ ret void
+}
+