-
Notifications
You must be signed in to change notification settings - Fork 9
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
Labels
Comments
ebehner
added
feature-request
New feature or request
priority-low
Low priority issue
labels
Jan 13, 2022
/cib |
Branch issue-28-_Restructuring_Resolve_unresolved_reaching_conditions created! |
mari-mari
pushed a commit
that referenced
this issue
Jun 26, 2024
* Create draft PR for #28 * start with issue * some minor changes * no endless recursion * fix tests * add test * modify to always pair two * fix format * some refactoring and docstrings --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Eva-Maria Behner <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
(!x1 & x2)
and(!x1 & !x2)
, then we first restructure the if-else with the conditionx2
, resulting in the following AST (nodes 6, 7, 8):After resolving the unresolved reaching conditions it results in the following AST:
A better solution would be to add the condition before node 6:
This example belongs to
test15
in test_condition.zipx1
and we have a node with reaching conditionx1 & cond
that we want to resolve, we do not add this node to the existing condition node (if it is possible due to reachability), wherecond
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
.When resolving the reaching condition for code node 6, we get the following AST:
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:
This example belongs to
test16
in test_condition.zipApproach
No response
The text was updated successfully, but these errors were encountered: