-
Notifications
You must be signed in to change notification settings - Fork 142
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 there a backward IFDS analysis example? #657
Comments
Hi @yuffon, currently we don't have an example regarding backward analysis. Can you give me some details on the error? |
The compiler gives the following error:
In my backward IFDS analysis, I use the following set:
Is it right? Update: I think I know where the compiler reports an error.
I use the following
The function ICFGBase::getCallersOf() is defined as follows:
Here LLVMBasedBackwardICFG is a subclass of ICFGBase. Here function ICFGBase::getCallGraph() is defined as:
But, the class LLVMBasedBackwardICFG does not have a method getCallGraphImpl(). To summarize, the I have also checked the old implementation is a previous version of phasar, the ICFGBase::getCallersOf() is implemented as
Here both LLVMBasedICFG and LLVMBasedBackwardICFG have their method getCallersOfImpl(). So I think the method LLVMBasedBackwardICFG.getCallersOf() function is not implemented correctly. The above error cannot be stepped over because I need to use the backward ICFG to define an IFDS problem solver as follows:
The above statement cannot be compiled. The similar error is also reported at
I think the similar case happens on function getReturnSitesOfCallAt() as well. I guess that the backward analysis is not tested after some version. |
Hi @fabianbs96, I will check it on LLVM 14 and report results later. |
Hi @fabianbs96 , I have test the backward analysis using branch f-fixBackwardICFG in my project.
I see that these functions have been implemented in LLVMBasedBackwardICFG. But my compiler reports that these functions are not implemented in LLVMBasedBackwardCFG (not ICFG). I notice that
and
ICFGBase has the following definitions:
and
See the class name in template. Should LLVMBasedBackwardCFG be changed to LLVMBasedBackwardICFG? I think that is why the compiler reports LLVMBasedBackwardCFG does not implement those function, although the current version of LLVMBasedBackwardICFG has implemented them.
By the way, I get the following in dumpResult()
I checked the code, and find that
in Printer.h receives a pointer of Data flow fact. The overrided operator << in my own data flow fact does not work. |
Hi @yuffon, the LLVMBasedBackwardCFG/LLVMBasedBackwardICFG confusion and the missing |
Hi @fabianbs96, I haved tested backward analysis on several small examples in my project. Up to now, Everything is OK to me. |
Hi @yuffon, you are right. This is, because how phasar works: The solver always propagates data flows from a current statement to the successor statements. During this propagation, it applies the flow functions to make the effects of the current statement visible at its successors. For the backwards analysis, the control-flow direction is reversed, so the successors of the current statement are actually its predecessors. |
Hi @fabianbs96, thanks. Take the following piece for example:
I want to get data flow facts before How can I get data flow facts at program point 2 after backward analysis? |
Hi @yuffon, we are facing a similar problem as well. For forward analyses, we use the Currently, we are discussing about how to fix this problem properly, e.g. introducing dummy statements within the ICFG, or adapting the solver. We will keep you updated. |
Just back from vacation. I have tested 'PropagateOntoStrategy' on one simple problem. It contains a branch whose two successors have different facts. It works. |
I am writing a backward IFDS analysis.
Currently, I meet some compilation error.
It is complicated to paste all the information needed here to explain this error.
But I guess it is due to some issues on the construction of backward ICFG or CFG.
Is there some example of backward IFDS analysis example that I can refer to?
Thanks.
The text was updated successfully, but these errors were encountered: