Merged
Conversation
LocalOptimizationPass will propagate values. For example: ```ruby _tmp = true unless _tmp puts "Never" end ``` In this case by the end of this pass we will see a BB end with a b_false(true, some_label). This clearly cannot happen. If we eliminate this instr then we should also be able to lop off the bb(s) representing whatever is within the unless conditional. In this snippet the entire snippet should be dead code except _tmp = true. To fix this I added simplifyBranch to BranchInstr. This gives us the ability to swap out a branch with a noop or a jump (in case where something is unconditionally true). After we replace the instr with a new one we need to reexamine the basicblock it is in and correct any edge placement.
…w later when inliner is reconnected
headius
approved these changes
Sep 3, 2021
Member
|
nice, this could also work if arg1 is simply a |
Member
Author
|
@kares I am in the process of simplifying all branch types. |
The basic problem was I changed this branch/PR to save the original returnBBs as a field in the CFG. When I remove a BB I have to also update the returnBB list as well. Second fix was to remove incoming edges from BBs which no longer are reachable from the BBs by using the directed graphs removeEdge method. This is quite a bit cleaner looking as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
LocalOptimizationPass will propagate values. For example:
In this case by the end of this pass we will see a BB end with a
b_false(true, some_label). This clearly cannot happen. If we eliminate
this instr then we should also be able to lop off the bb(s) representing
whatever is within the unless conditional. In this snippet the entire
snippet should be dead code except _tmp = true.
To fix this I added simplifyBranch to BranchInstr. This gives us the
ability to swap out a branch with a noop or a jump (in case where something
is unconditionally true).
After we replace the instr with a new one we need to reexamine the basicblock
it is in and correct any edge placement.