private void replaceBranches() {
    for (SsaInsn insn : branchWorklist) {
      // Find if a successor block is never executed
      int oldSuccessor = -1;
      SsaBasicBlock block = insn.getBlock();
      int successorSize = block.getSuccessorList().size();
      for (int i = 0; i < successorSize; i++) {
        int successorBlock = block.getSuccessorList().get(i);
        if (!executableBlocks.get(successorBlock)) {
          oldSuccessor = successorBlock;
        }
      }

      /*
       * Prune branches that have already been handled and ones that no
       * longer have constant conditions (no nonexecutable successors)
       */
      if (successorSize != 2 || oldSuccessor == -1) continue;

      // Replace branch with goto
      Insn originalRopInsn = insn.getOriginalRopInsn();
      block.replaceLastInsn(
          new PlainInsn(Rops.GOTO, originalRopInsn.getPosition(), null, RegisterSpecList.EMPTY));
      block.removeSuccessor(oldSuccessor);
    }
  }
Replaces branches that have constant conditions with gotos
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/SCCP.java