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

Improve expression propagation by removing redundant Phi functions #382

Merged
merged 7 commits into from
Feb 22, 2024

Conversation

rihi
Copy link
Collaborator

@rihi rihi commented Feb 8, 2024

In some cases the decompiler fails to reconstruct simple control structures, because the decompiled code contains redundant variables. These variables are caused by Phi functions, that use the same value indifferent to the control flow path taken.

This PR adds code that removes these redundant Phi functions before each expression propagation iteration, enabling more expressions to be propagated.

An example where this causes a switch to not be constructed is test17 in systemtest/32/3/test_condition.

@rihi rihi self-assigned this Feb 8, 2024
@rihi
Copy link
Collaborator Author

rihi commented Feb 15, 2024

I've actually noticed that we already have a class to cleanup redundant Phi functions. (PhiFunctionCleaner)
I'm gonna check if I can use that class directly instead of repeating the same code.

@rihi rihi marked this pull request as draft February 15, 2024 13:14
@rihi rihi marked this pull request as ready for review February 21, 2024 13:04
@mari-mari mari-mari merged commit b26c6ed into main Feb 22, 2024
1 check passed
@mari-mari mari-mari deleted the ep-redundant-phi branch February 22, 2024 08:32
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