Common subexpression elimination for vasm#6843
Open
octmoraru wants to merge 3 commits into
Open
Conversation
Contributor
|
This pull request has been imported into Phabricator, and discussion and review of the diff will take place at https://reviews.facebook.net/D54435 |
This diff adds a local common subexpression elimination vasm pass. It has basic block scope and works as described below: * searches for binary expressions inside a BB and saves them into a list * an instruction is considered to be a binary expression if it uses two operands and defines at least one * if an expression is already in the saved expression list, it's replaced by a "nop" instruction * all uses of registers which are defined by a redundant expression are replaced with registers defined by the matching expression (i.e. the expression found in the list) * if a register used by a saved expression is redefined by another instruction, the binary expression is removed from the list. This can only happen for physical registers, which are not in SSA form * SF registers are also considered non-SSA, since vasm-xls does not support overlapping liveness intervals for them.
First simplifier is used to remove redundant fallbackcc instructions from a basic block. The second one transforms a "jcc" into an unconditional "jmp" when a fallbackcc with the same condition and same SF is present in the same basic block. Example: cmpbim 0, [%rbp - 0x8] => %132 fallbackcc NE, (id 0x181f)@7, 1, %132, {%rbp, %r12} cmpbim 0, [%rbp - 0x8] => %133 jcc NE, %133, B5, else B12 After vasm-cse: cmpbim 0, [%rbp - 0x8] => %132 fallbackcc NE, (id 0x181f)@7, 1, %132, {%rbp, %r12} jcc NE, %132, B5, else B12 After vasm-simplify: cmpbim 0, [%rbp - 0x8] => %132 fallbackcc NE, (id 0x181f)@7, 1, %132, {%rbp, %r12} jmp B12
Contributor
|
Hi, |
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.
No description provided.