private void compress(SsaBasicBlock in) {
    DFSInfo bbInfo = info[in.getIndex()];
    DFSInfo ancestorbbInfo = info[bbInfo.ancestor.getIndex()];

    if (ancestorbbInfo.ancestor != null) {
      ArrayList<SsaBasicBlock> worklist = new ArrayList<SsaBasicBlock>();
      HashSet<SsaBasicBlock> visited = new HashSet<SsaBasicBlock>();
      worklist.add(in);

      while (!worklist.isEmpty()) {
        int wsize = worklist.size();
        SsaBasicBlock v = worklist.get(wsize - 1);
        DFSInfo vbbInfo = info[v.getIndex()];
        SsaBasicBlock vAncestor = vbbInfo.ancestor;
        DFSInfo vabbInfo = info[vAncestor.getIndex()];

        // Make sure we process our ancestor before ourselves.
        if (visited.add(vAncestor) && vabbInfo.ancestor != null) {
          worklist.add(vAncestor);
          continue;
        }
        worklist.remove(wsize - 1);

        // Update based on ancestor info.
        if (vabbInfo.ancestor == null) {
          continue;
        }
        SsaBasicBlock vAncestorRep = vabbInfo.rep;
        SsaBasicBlock vRep = vbbInfo.rep;
        if (info[vAncestorRep.getIndex()].semidom < info[vRep.getIndex()].semidom) {
          vbbInfo.rep = vAncestorRep;
        }
        vbbInfo.ancestor = vabbInfo.ancestor;
      }
    }
  }
Performs path compress on the DFS info.

@param in Basic block whose DFS info we are path compressing.
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/Dominators.java