private boolean isCircularNoSideEffect(int regV, BitSet set) {
    if ((set != null) && set.get(regV)) {
      return true;
    }

    for (SsaInsn use : useList[regV]) {
      if (hasSideEffect(use)) {
        return false;
      }
    }

    if (set == null) {
      set = new BitSet(regCount);
    }

    // This register is only used in operations that have no side effect.
    set.set(regV);

    for (SsaInsn use : useList[regV]) {
      RegisterSpec result = use.getResult();

      if (result == null || !isCircularNoSideEffect(result.getReg(), set)) {
        return false;
      }
    }

    return true;
  }
Returns true if the only uses of this register form a circle of operations with no side
effects.

@param regV register to examine
@param set a set of registers that we've already determined are only used as sources in
    operations with no side effect or null if this is the first recursion
@return true if usage is circular without side effect
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/DeadCodeRemover.java