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

Changes and fixes to run dev14 successfully CI #156

Merged
merged 10 commits into from
Sep 16, 2023
Merged

Conversation

caballa
Copy link
Contributor

@caballa caballa commented Sep 15, 2023

dev14 was never run in CI so some of the tests were broken.
This PR passes all tests.

Changes:

  • Updated docker to use LLVM 14
  • Recompile the bitcode of some tests to use LLVM 14
  • Fixes in DsaCompleteCompleteGraph.cc

priyasiddharth and others added 10 commits September 12, 2023 21:04
We needed to modify slightly the expected graphs because the bitcode
changed from LLVM 5.0 to LLVM 14.0. For LLVM 14, I just use clang -c
-emit-llvm ... Unfortunately, I do not remember which flags we used
for LLVM 5.0
We wrote the code ourselves that ensures a resolved call is
type-compatible with the actual call. Since LLVM 14 (maybe some
earlier version) we can use isLegalToPromote for that.

This change was already committed in 156e5f1 in dev14-jn branch but it
was not ported to dev14.
We need to strip bitcasts in order to resolve trivial indirect calls.
We modified the code that strips bitcasts to catch all patterns from
the test suite.
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.
@caballa caballa requested a review from agurfinkel September 15, 2023 20:25
@caballa caballa merged commit a284e59 into dev14 Sep 16, 2023
1 check failed
@caballa caballa deleted the dev14-fix-tests branch September 16, 2023 16:25
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.

2 participants