A method for eliminating a branch instruction in a control flow path of a
computer program. The method includes providing a computer program having
a plurality of basic blocks forming control flow paths, determining a
cost of executing a branch instruction terminating a basic block in one
of the control flow paths, determining a cost of combining basic blocks
when merging the control flow paths, and eliminating the branch
instruction from the basic block whose cost of execution is greater than
the cost of combining the basic blocks in merging the control flow paths.