-
Couldn't load subscription status.
- Fork 467
Add functions for mapping from SVFG nodes to LLVM values and back #492
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
Conversation
Function equivalent but gives better error detection of the compiler.
|
How can I reproduce the tests locally? I have tried: This results in: However, Github reports 405 tests. |
|
Unfortunately, the test suite failed. It seems to me that it was because Could you break down this patch into two? |
|
I will do a binary search via forced push. Please do not merge. Howe can I reproduce the tests locally? |
You can take a look at this github workflow file. It basically tells the configuration for testing locally. |
| if(hasDef(pagNode)) { | ||
| ret.emplace(getDefSVFGNode(pagNode)); | ||
| } | ||
| return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not return the local set. Pass a reference set as a parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The set is moved in these cases, so there shouldn't be a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make this function public, it may be accidentally used by other users. I would suggest making the function like:
void SVFG::fromLLVMValue(const llvm::Value* value, std::set<const SVFGNode*>& nodeset) const;' where nodeset` is a reference referring to set in the caller, so that we will not return a local set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here applies what I said in the other comment. Returning a set or specifying a reference parameter leads to the same code.
Theoretical, the local set is returned by a copy. However, in practice it is moved, see https://isocpp.org/blog/2013/02/no-really-moving-a-return-value-is-easy-stackoverflow
lib/SVF-FE/PAGBuilder.cpp
Outdated
| edge_count++; | ||
| } | ||
| } | ||
| errs() << "NodeCount" << node_count << " NodeNum: " << pag->getTotalNodeNum() << " " << pag->getPAGNodeNum() << "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete these output messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have inserted these messages only because the assertion a few lines later does not work. Can you elaborate on that?
Why is getTotalEdgeNum() different to edge_count?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is strange. Could you have a look at where these two counters getTotalEdgeNum() and edge_count are increamented?
A PHIVFGNode links to a PAGNode instead of an edge.
Backmapping does not work with - ActualParmSVFGNode - FormalRetVFGNode - IntraPHIVFGNode Closes: SVF-tools#485
|
|
||
| /// Return the corresponding SVFGNodes to a given llvm::Value. | ||
| /// return an empty list, if the no mapping is possible | ||
| std::set<const SVFGNode*> fromLLVMValue(const llvm::Value* value) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also remove the namespace here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I also change the function name to fromValue then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change this name so that I could merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was on vacation. See #497.
See SVF-tools#492 for details.
|
Appearantly, the newly added function Edit: I have replaced it now with Is this more less equivalent? |
|
Yes, please add it back. The reason was that we may have SVFValue to replace llvm::Value later. |
|
I have edited my post previously. Is the proposed solution more less equivalent? Especially, the old solution relies on the |
Yes.
|
See #485.
I have tested the code with https://gitlab.com/geri0n/svf-test/-/tree/llvmtovfg.
The back map seems not to work with these nodes (since the PAGNodes are not linked to llvm::Values):
Moreover an
assertin the map filling code does not work:pag->getPAGEdgeNum()give me way more edges, than I can find in the graph.