private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
      newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB =
        new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
  }
Replaces one of a block's successors with a different label. Constructs an updated BasicBlock
instance and places it in {@code newBlocks}.

@param block block to replace
@param oldLabel label of successor to replace
@param newLabel label of new successor
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/back/IdenticalBlockCombiner.java