diff --git a/svf/lib/Graphs/ConsG.cpp b/svf/lib/Graphs/ConsG.cpp index 27bb70ed5..6e856882f 100644 --- a/svf/lib/Graphs/ConsG.cpp +++ b/svf/lib/Graphs/ConsG.cpp @@ -149,6 +149,15 @@ void ConstraintGraph::buildCG() */ void ConstraintGraph::clearSolitaries() { + /// We don't remove return SVFVar from an indirect callsite + NodeSet retFromIndCalls; + for(auto cs_pair : pag->getIndirectCallsites()) + { + const RetICFGNode* retBlockNode = cs_pair.first->getRetICFGNode(); + if(pag->callsiteHasRet(retBlockNode)) + retFromIndCalls.insert(pag->getCallSiteRet(retBlockNode)->getId()); + } + Set nodesToRemove; for (auto it = this->begin(); it != this->end(); ++it) { @@ -156,6 +165,8 @@ void ConstraintGraph::clearSolitaries() continue; if (pag->getGNode(it->first)->isPointer()) continue; + if (retFromIndCalls.find(it->first)!=retFromIndCalls.end()) + continue; nodesToRemove.insert(it->second); }