Branch Elimination

Eliminate a branch to a branch.

Example:

In the code fragment below, the branch to L1 and then to L2 can be replaced with a single branch to L2.

  goto L1;

  /* other code */

L1:
  goto L2;
  

Below is the code fragment after branch elimination.

  goto L2;

  /* other code */

L1:
  goto L2;