Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(complete-cg): remove call graph edges
The right way to remove an edge in the call graph is by using the method removeCallEdge. Because this method takes as input an iterator we are forced to remove edges while iterating over them so we need to be careful. Before, we were using removeCallEdgeFor that takes as input a call instruction. However, once we start resolving an indirect call we can have multiple edges from the same node and with the same callsite attached to the edge. Calling removeCallEdgeFor removes one of the edges but it is not clear which one. Probably the code was working because it was removing the first one which was the indirect call. For context, I add here an explanation about how the complete call graph looks like. A LLVM CallGraph consists of edges between nodes of type CallGraphNode. For CallGraphNode n1 and n2, and CallBase CB, an edge in CallGraph is a triple (n1, CB, n2) A _complete_ (seadsa) callgraph is just another LLVM CallGraph. If there is an edge E=(n1, CB, n2) where CB is an indirect call and therefore n2 is the (unique) _external node_ then we remove E and add possibly multiple edges (n1,CB,n3) where n3 is the CallGraphNode of each possible callee function identified by seadsa.
- Loading branch information