add ReversePostOrderBlockTraversal
and update DominanceFinder
#928
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implement RPO Traversal to Enhance CFG Analysis in Soot
Details
This PR addresses the specific issue raised in the Issue #923 concerning the potential problems due to the lack of Reverse Post-Order (RPO) traversal in the dominance analysis.
The proposed changes introduce an RPO traversal algorithm, which is integrated into the existing
ForwardStmtGraph
andBackwardStmtGraph
via thegetBlocksSorted
interface. Additionally, the changes apply RPO in theDominanceFinder
to enhance the accuracy and performance of dominator calculations.Key changes include:
sootup/core/graph/ReversePostOrderBlockTraversal.java
and create RPO one as a wrapper of PO.ForwardStmtGraph
andBackwardStmtGraph
.DominanceFinder
to ensure the correctness of dominator tree generation.DominanceFinder
(the head node should not have an immediate dominator). This was addressed by removing the@Nonnull
annotation fromgetImmediateDominator
and allowing a return value of null when the input is the head node.DominatorFinder
,PostDominatorFinder
,PostOrderBlockTraversal
,ReversePostOrderBlockTraversal
to verify the fixes.Thank you for reviewing this pull request and considering this update!