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

Is data-dependence analysis driven by self-defined pointer analysis or SVF? #451

Open
for-just-we opened this issue Dec 20, 2022 · 8 comments
Labels

Comments

@for-just-we
Copy link

Hi, author. I try to integrate dg into other project and when I use data-dependence analysis. I found not like llvm-cda-dump.cpp, in llvm-dda-dump, there seems to be no code for leveraging SVF pointer analysis. So is there support for SVF in data-dependence analysis?

@mchalupa
Copy link
Owner

DG can use SVF for points-to analysis and this then propagates to data dependence analysis. If you want to use the value-flow analysis from SVF, you must do that directly via SVF API.

@mchalupa
Copy link
Owner

To answer the question from the title: both, depends on the options you pass on the command line (and if you compile DG with SVF support).

@for-just-we
Copy link
Author

data

DG can use SVF for points-to analysis and this then propagates to data dependence analysis. If you want to use the value-flow analysis from SVF, you must do that directly via SVF API.

So I just simply need to replace DGLLVMPointerAnalysis with SVFPointerAnalysis?

@mchalupa
Copy link
Owner

Yes, that should do the trick, check this code: https://github.com/mchalupa/dg/blob/master/tools/llvm-pta-dump.cpp#L816

@for-just-we
Copy link
Author

Yes, that should do the trick, check this code: https://github.com/mchalupa/dg/blob/master/tools/llvm-pta-dump.cpp#L816

ok, and I want to map instructions in a bc file to the instructions they depend on. So the code for data dependence analysis is

LLVMDataDependenceAnalysis DDA(M.get(), &PTA, options.dgOptions.DDAOptions);
DDA.run();
auto *SSA = static_cast<MemorySSATransformation *>(
                DDA->getDDA()->getImpl());
SSA->computeAllDefinitions();

right?

@mchalupa
Copy link
Owner

mchalupa commented Dec 20, 2022

This part is important:

LLVMDataDependenceAnalysis DDA(M.get(), &PTA, options.dgOptions.DDAOptions);
DDA.run();

Then you can query directly the DDA object for the definitions.

@for-just-we
Copy link
Author

This part is important:

LLVMDataDependenceAnalysis DDA(M.get(), &PTA, options.dgOptions.DDAOptions);
DDA.run();

Then you can query directly the DDA object for the definitions.

So, this part

auto *SSA = static_cast<MemorySSATransformation *>(
                DDA->getDDA()->getImpl());
SSA->computeAllDefinitions();

is only optional? If I don't run SSA, would there be differences in the data dependence results?

@mchalupa
Copy link
Owner

mchalupa commented Dec 21, 2022

SSA is run either way, but this code makes it to compute all the results immediately (otherwise they are computed on-demand upon querying DDA object) so that llvm-dda-dump can show dump all the results including some internal information obtained from the SSA object.

There should be no differences in the results if you omit this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants