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

[Restructuring] Resolve unresolved reaching conditions #28

Open
ebehner opened this issue Jan 13, 2022 · 2 comments · May be fixed by #407
Open

[Restructuring] Resolve unresolved reaching conditions #28

ebehner opened this issue Jan 13, 2022 · 2 comments · May be fixed by #407
Assignees
Labels
feature-request New feature or request priority-low Low priority issue

Comments

@ebehner
Copy link
Collaborator

ebehner commented Jan 13, 2022

Proposal

During the restructuring, when we restructure a region, each node gets a reaching condition. Using these reaching conditions we try to find if-else and switch constructs. Nevertheless, not all reaching conditions are resolved by these algorithms, i.e., at the end of the restructuring, there may be still some nodes whose reaching condition is not true. Thus, these reaching conditions have to be transformed into if-constructs.

Currently, we simply add a condition node before a node with a reaching condition that has as condition the reaching condition of the node. But sometimes, this does not lead to the best possible output.

Here are some examples where another approach would be better:

  1. If we have two nodes with reaching conditions (!x1 & x2) and (!x1 & !x2), then we first restructure the if-else with the condition x2, resulting in the following AST (nodes 6, 7, 8):
    rc_140488574419296
    After resolving the unresolved reaching conditions it results in the following AST:
    rc_140488574736320
    A better solution would be to add the condition before node 6:
    good

This example belongs to test15 in test_condition.zip

  1. If we have already a condition node with the condition x1 and we have a node with reaching condition x1 & cond that we want to resolve, we do not add this node to the existing condition node (if it is possible due to reachability), where cond is an arbitrary condition that could also be true.

Consider, for example, the following AST, where we have a condition node with the condition x1 and a node with reaching condition !x1 & !x2.
rc_start
When resolving the reaching condition for code node 6, we get the following AST:
result_140230992892544
However, we could also add this node to the false-branch of the condition node, i.e., we would like to have the following AST:
result_140226722815520

This example belongs to test16 in test_condition.zip

Approach

No response

@ebehner ebehner added feature-request New feature or request priority-low Low priority issue labels Jan 13, 2022
@rihi rihi self-assigned this Jan 10, 2024
@rihi rihi removed their assignment Feb 21, 2024
@ebehner ebehner self-assigned this Apr 19, 2024
@ebehner
Copy link
Collaborator Author

ebehner commented Apr 19, 2024

/cib

Copy link
Contributor

github-actions bot added a commit that referenced this issue Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request priority-low Low priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants