remaining |= (activeGuard == null);
  public void perform (OPT_IR ir) {    for (OPT_BasicBlock bb = ir.firstBasicBlockInCodeOrder();          bb != null; bb = bb.nextBasicBlockInCodeOrder()) {      if (!bb.isEmpty()) {        OPT_Instruction lastInstr = bb.lastInstruction();        boolean combined;        boolean remaining;        // (1) Combine null checks in bb into the first load/store in         // bb they guard.        // Restrict this to respect PEI ordering.        // Only do locally, since we don't understand control flow here.        // We could be more aggressive about moving PEIs past stores         // by determining which stores actually update global or         // handler-visible state.        do {          combined = remaining = false;          OPT_Instruction activeNullCheck = null;          OPT_Operand activeGuard = null;          for (OPT_Instruction instr = bb.firstRealInstruction(),               nextInstr = null;               instr != lastInstr; instr = nextInstr) {            nextInstr = instr.nextInstructionInCodeOrder();            OPT_Operator op = instr.operator();            if (op == GUARD_MOVE) {              if (activeGuard != null &&                   Move.getVal(instr).similar(activeGuard)) {                activeGuard = Move.getResult(instr);              }            } else if (op == GUARD_COMBINE) {              if (activeGuard != null &&                   (Binary.getVal1(instr) == activeGuard ||                    Binary.getVal2(instr) == activeGuard)) {                remaining |= (activeGuard == null);                activeGuard = null;              }            } else if (op == NULL_CHECK) {              remaining |= (activeGuard == null);              activeGuard = NullCheck.getGuardResult(instr);              activeNullCheck = instr;            } else if (isExplicitStore(instr, op)) {              if (instr.isPEI()) {                // can't reorder PEI's                 // NOTE: don't mark remaining, since we'd hit the same problem instr again.                activeGuard = null;              } else {                if (activeGuard != null && canFold(instr, activeGuard, true)) {                  instr.markAsPEI();                  activeNullCheck.remove();                  activeGuard = null;                  combined = true;                }                remaining |= (activeGuard == null);                activeGuard = null;   // don't attempt to move PEI past a store; could do better.              }            } else if (isExplicitLoad(instr, op)) {              if (activeGuard != null && canFold(instr, activeGuard, false)) {                instr.markAsPEI();                activeNullCheck.remove();                activeGuard = null;                combined = true;              } else                if (instr.isPEI()) {                // can't reorder PEI's                 // NOTE: don't mark remaining, since we'd hit the same problem instr again.                activeGuard = null;              }            } else {              if (op.isImplicitStore() || op.isPEI()) {                // NOTE: don't mark remaining, since we'd hit the same problem instr again.                activeGuard = null; // don't reorder PEI's; be conservative about stores.              }            }          }        } while (combined & remaining);        // (2) Blow away all validation registers in bb.        for (OPT_Instruction instr = bb.firstRealInstruction(), nextInstr = null;              instr != lastInstr; instr = nextInstr) {          nextInstr = instr.nextInstructionInCodeOrder();          OPT_Operator op = instr.operator();          if (op == GUARD_MOVE || op == GUARD_COMBINE) {            instr.remove();          } else {            if (GuardResultCarrier.conforms(op)) {              GuardResultCarrier.setGuardResult(instr, null);            }            if (GuardCarrier.conforms(op)) {              GuardCarrier.setGuard(instr, null);            }          }        }      }    }  }