Repository navigation
Build the call graph once in findFunctionCyclesVia - #935
Open
JonasAlaif wants to merge 3 commits into
Open
JonasAlaif wants to merge 3 commits into
JonasAlaif wants to merge 3 commits into
Conversation
findFunctionCyclesVia rebuilt the call graph of the whole program for every function, which made the consistency check quadratic in the number of functions (e.g. over a minute for a program with 3k functions). Collect the callees of every function once and search each function's cycles only in its strongly connected component of the graph with both kinds of edges. Written with Claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
findFunctionCyclesVia(used by thecheckNoFunctionRecursesViaPreconditionsconsistency check) rebuilt the call graph of the whole program once per function, so the check was quadratic in the number of functions. On Prusti-generated programs it took 20-70s for ~1.5k-3k functions, and much longer for larger ones.This collects the callees of every function once, and searches each function's cycles only within its strongly connected component of the graph that has both the
viaandsubsedges (every per-function graph is a subgraph of it). Callees keep their original order, since the cycle sets reported by jgrapht'sCycleDetectordepend on the edge traversal order.The results are identical to the old implementation (compared on 3000 random programs and several large Prusti-generated ones), e.g. 69s -> 0.1s for a program with 3207 functions.