Description[turbofan] Redundant branch elimination.
Removes a branch that checks for a condition that has been checked on dominators of the branch.
This introduces a new reducer that propagates the list of checked conditions (and their boolean values) through the control flow graph. If it encounters a branch checking a condition with a known value, the branch is eliminated.
The analysis relies on loops being reducible: if a condition has been checked on all paths to loop entry, then it is checked in the loop (regardless what of the conditions checked inside the loop).
The implementation is fairly naive and could be improved:
- all the operation on the condition lists could be made allocation-free when revisited.
- we could try to use a map structure rather than a linked list (to make
lookups faster).
- the merging of control flow could be changed to take into account
conditions from non-dominating paths (as long as all paths check
the condition).
Committed: https://crrev.com/106aecf26200188647ea22c2d142067113d496b8
Cr-Commit-Position: refs/heads/master@{#31347}
Patch Set 1 #Patch Set 2 : Simple tests #Patch Set 3 : Test #Patch Set 4 : Check equality on update, comment goodness #Patch Set 5 : Make IfTrue/IfFalse branch dead based on condition #Patch Set 6 : Get rid of the eliminated branch #Patch Set 7 : Loop test #
Total comments: 3
Patch Set 8 : Switched to unsorted linked lists. #Patch Set 9 : Rename branch-condition-elimination to branch-elimination #Patch Set 10 : Comments #
Messages
Total messages: 10 (3 generated)
|