Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup verifier #1675

Merged
merged 2 commits into from
Mar 26, 2025
Merged

Speedup verifier #1675

merged 2 commits into from
Mar 26, 2025

Conversation

Frankenween
Copy link
Contributor

I faced an issue when wpa spends most of the time in verifyCallGraph, but this function doesn't do anything useful without -dwarn=false.

Without patch:

  62,56%  wpa      libSvfCore.so         [.] SVF::CallGraphNode::isReachableFromProgEntry() const                                                                                                                                       
  16,23%  wpa      libstdc++.so.6.0.33   [.] std::_Rb_tree_increment(std::_Rb_tree_node_base const*)                                                                                                                                    
   5,79%  wpa      libSvfCore.so         [.] std::_Rb_tree_increment(std::_Rb_tree_node_base const*)@plt                                                                                                                                
   2,59%  wpa      libSvfCore.so         [.] std::_Rb_tree<SVF::ConstraintEdge*, SVF::ConstraintEdge*, std::_Identity<SVF::ConstraintEdge*>, SVF::GenericEdge<SVF::ConstraintNode>::equalGEdge, std::allocator<SVF::ConstraintEdge*> >::
   1,75%  wpa      libSvfCore.so         [.] SVF::PointerAnalysis::resolveIndCalls(SVF::CallICFGNode const*, SVF::PointsTo const&, std::map<SVF::CallICFGNode const*, std::unordered_set<SVF::FunObjVar const*, SVF::Hash<SVF::FunObjVar
   1,03%  wpa      libSvfCore.so         [.] SVF::ConstraintGraph::addCopyCGEdge(unsigned int, unsigned int)                                                                                                                            
   0,96%  wpa      libSvfLLVM.so.16      [.] SVF::GenericGraph<SVF::SVFVar, SVF::SVFStmt>::getGNode(unsigned int) const

With patch and without warnings:

  15,26%  wpa      libSvfCore.so         [.] std::_Rb_tree<SVF::ConstraintEdge*, SVF::ConstraintEdge*, std::_Identity<SVF::ConstraintEdge*>, SVF::GenericEdge<SVF::ConstraintNode>::equalGEdge, std::allocator<SVF::ConstraintEdge*> >::
  10,03%  wpa      libSvfCore.so         [.] SVF::PointerAnalysis::resolveIndCalls(SVF::CallICFGNode const*, SVF::PointsTo const&, std::map<SVF::CallICFGNode const*, std::unordered_set<SVF::FunObjVar const*, SVF::Hash<SVF::FunObjVar
   6,53%  wpa      libSvfCore.so         [.] SVF::ConstraintGraph::addCopyCGEdge(unsigned int, unsigned int)                                                                                                                            
   6,28%  wpa      libSvfLLVM.so.16      [.] SVF::GenericGraph<SVF::SVFVar, SVF::SVFStmt>::getGNode(unsigned int) const

With patch and warnings:

  15,83%  wpa      libSvfCore.so         [.] std::_Rb_tree<SVF::ConstraintEdge*, SVF::ConstraintEdge*, std::_Identity<SVF::ConstraintEdge*>, SVF::GenericEdge<SVF::ConstraintNode>::equalGEdge, std::allocator<SVF::ConstraintEdge*> >::
  10,01%  wpa      libSvfCore.so         [.] SVF::PointerAnalysis::resolveIndCalls(SVF::CallICFGNode const*, SVF::PointsTo const&, std::map<SVF::CallICFGNode const*, std::unordered_set<SVF::FunObjVar const*, SVF::Hash<SVF::FunObjVar
   6,44%  wpa      libSvfCore.so         [.] SVF::ConstraintGraph::addCopyCGEdge(unsigned int, unsigned int)                                                                                                                            
   5,96%  wpa      libSvfLLVM.so.16      [.] SVF::GenericGraph<SVF::SVFVar, SVF::SVFStmt>::getGNode(unsigned int) const 
   ...
   0,14%  wpa      libSvfCore.so         [.] std::_Function_handler<bool (SVF::CallGraphNode const*), SVF::CallGraphNode::isReachableFromProgEntry(std::unordered_map<unsigned int, bool, SVF::Hash<unsigned int>, std::equal_to<unsigned int>, std
   0,00%  wpa      libSvfCore.so         [.] SVF::CallGraphNode::isReachableFromProgEntry(std::unordered_map<unsigned int, bool, SVF::Hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, bool> > >&, SVF

Let's skip verification when there will be no debug output. Also, memorize graph traversal results to achieve linear time.

Copy link

codecov bot commented Mar 14, 2025

Codecov Report

Attention: Patch coverage is 11.76471% with 15 lines in your changes missing coverage. Please review.

Project coverage is 63.58%. Comparing base (b661b1c) to head (2c0421a).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
svf/lib/Graphs/CallGraph.cpp 11.76% 15 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1675      +/-   ##
==========================================
- Coverage   63.91%   63.58%   -0.34%     
==========================================
  Files         248      244       -4     
  Lines       26003    25728     -275     
  Branches     4528     4503      -25     
==========================================
- Hits        16621    16358     -263     
+ Misses       9382     9370      -12     
Files with missing lines Coverage Δ
svf/include/Graphs/CallGraph.h 92.98% <ø> (ø)
svf/lib/Graphs/CallGraph.cpp 67.46% <11.76%> (-11.29%) ⬇️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Frankenween
Copy link
Contributor Author

@yuleisui hi, could you take a look?

@yuleisui
Copy link
Collaborator

Sorry for the late reply. The patch looks good to me and thanks for the contribution.

@yuleisui yuleisui merged commit bfaf1de into SVF-tools:master Mar 26, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants