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

Implement handling of multiple independent groups in Relooper #7025

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vyom1611
Copy link

This pull request enhances the Relooper's ability to handle control flow graphs with more than two independent groups. Previously, the Analyzer::Process() function was optimized only for cases with two independent groups, as indicated by the TODO comments in the code. This limitation could lead to inefficient handling of more complex graphs.

Changes Made:

Generalized Independent Group Handling:

Modified the Analyzer::Process() function in Relooper.cpp to support scenarios with multiple independent groups.
Implemented logic to identify dead-end groups among the independent groups and process them separately.
Optimized the Relooper to reduce unnecessary nesting and recursion when handling multiple groups.

Code Implementation:

Replaced the conditional check for exactly two groups with a loop that handles any number of independent groups.
Separated dead-end groups from non-dead-end groups for efficient processing.
Ensured that deferred groups are added to NextEntries for later processing, reducing immediate complexity.

all 175 binaryen unittests passing

@kripken
Copy link
Member

kripken commented Oct 21, 2024

Looks like there are test errors on CI. Aside from them, can you explain a bit more what is optimized here? What is a situation that would now be handled better? We would also need test for those things in this PR, to move forward.

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