if (result.isRegister() && val.isRegister() && result.asRegister().register.number == val.asRegister().register.number) {
if (result.similar(val)) {
  private void cleanUpAndInsertEpilogue() {    OPT_PhysicalRegisterSet phys = ir.regpool.getPhysicalRegisterSet();    OPT_Instruction inst = ir.firstInstructionInCodeOrder().getNext();    for (; inst != null; inst = inst.nextInstructionInCodeOrder()) {      switch (inst.getOpcode()) {        case IA32_MOV_opcode:          // remove frivolous moves          OPT_Operand result = MIR_Move.getResult(inst);          OPT_Operand val = MIR_Move.getValue(inst);          // SJF: for some unknown reason, the following code doesn't          // work. It appears that we're actually getting two different          // OPT_Register objects that both represent EAX.  How does this          // happen?  TODO: figure this out.          // if (result.similar(val)) {          //  inst = inst.remove();          // }          // In the meantime, use the following hack instead.          if (result.isRegister() && val.isRegister() &&              result.asRegister().register.number ==              val.asRegister().register.number) {            inst = inst.remove();          }          break;        case IA32_FMOV_opcode:          // remove frivolous moves          result = MIR_Move.getResult(inst);          val = MIR_Move.getValue(inst);          // SJF: for some unknown reason, the following code doesn't          // work. It appears that we're actually getting two different          // OPT_Register objects that both represent EAX.  How does this          // happen?  TODO: figure this out.          // if (result.similar(val)) {          //  inst = inst.remove();          // }          // In the meantime, use the following hack instead.          if (result.isRegister() && val.isRegister() &&              result.asRegister().register.number ==              val.asRegister().register.number) {            inst = inst.remove();          }          break;        case IA32_RET_opcode:          if (frameIsRequired()) {            insertEpilogue(inst);          }        default:          break;      }    }    // now that the frame size is fixed, fix up the spill location code    rewriteStackLocations();  }