Subzero: Add branch optimization.
1. Unconditional branch to the next basic block is removed.
2. For a conditional branch with a "false" edge to the next basic block, remove the unconditional branch to the fallthrough block.
3. For a conditional branch with a "true" edge to the next basic block, invert the condition and do like #2.
This is enabled only for O2, particularly because inverting the branch condition is a marginally risky operation.
This decreases the instruction count by about 5-6%.
Also, --stats prints a final tally to make it easier to post-process the output.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/580903005
Showing
tests_lit/llvm2ice_tests/branch-opt.ll
0 → 100644
Please
register
or
sign in
to comment