This optimization minimizes the span of branch instructions. The Compiler replaces a relative branch by an inverted condition branch across an unconditional jump, unless the offset of this branch is in the range [-128 to 127]:
BRcc dest
...; More than 127 bytes of code
dest:
Provided the code indicated by "..." doesn't contain another branch to label dest, the Compiler changes the previous code to:
BR~cc skip
JMP dest
skip:
... ; More than 127 bytes of code
dest:
Also, the Compiler may resolve branches to branches into two branches to the same target. The Compiler may remove redundant branches (for example, a branch to the instruction immediately following it).
The code above has the following effect:
The execution speed remains unchanged. Use the -OnB: Disable Branch Optimizer compiler option to disable this optimization.