Program: 150216
Project: 150216
Buggy source:
private void unary(OPT_Instruction s,OPT_Operator opCode,OPT_IR ir){
  OPT_RegisterOperand result=Unary.getClearResult(s);
  OPT_Operand op1=Unary.getClearVal(s);
  if (result.similar(op1)) {
    OPT_DefUse.removeUse(op1.asRegister());
    OPT_DefUse.removeDef(result);
    OPT_DefUse.recordDefUse(result);
    UnaryAcc.mutate(s,opCode,result);
    return;
  }
  if (OPTIMIZE) {
    if (op1.isRegister()) {
      OPT_RegisterOperand rop1=op1.asRegister();
      if (!rop1.register.spansBasicBlock() && isDead(rop1.register)) {
        if (result.register.isSSA() && !result.register.spansBasicBlock()) {
          OPT_DefUse.removeUse(rop1);
          OPT_DefUse.removeDef(result);
          OPT_DefUse.recordDefUse(rop1);
          OPT_DefUse.mergeRegisters(ir,rop1.register,result.register);
          rop1.register.putSSA(false);
          UnaryAcc.mutate(s,opCode,rop1);
          return;
        }
 else {
          OPT_DefUse.removeDef(result);
          OPT_DefUse.removeUse(rop1);
          OPT_DefUse.recordDefUse(rop1);
          UnaryAcc.mutate(s,opCode,rop1);
          OPT_Instruction move=Move.create(getMoveOp(result.type),result,rop1.copy());
          OPT_DefUse.updateDUForNewInstruction(move);
          s.insertAfter(move);
          return;
        }
      }
    }
  }
  OPT_Instruction move=Move.create(getMoveOp(result.type),result.copyRO(),op1.copy());
  OPT_DefUse.updateDUForNewInstruction(move);
  s.insertBefore(move);
  OPT_DefUse.removeDef(result);
  OPT_DefUse.recordDefUse(result);
  if (op1.isRegister()) {
    OPT_DefUse.removeUse(op1.asRegister());
  }
  UnaryAcc.mutate(s,opCode,result);
}

Fixed version (ground truth):
private void unary(OPT_Instruction s,OPT_Operator opCode,OPT_IR ir){
  OPT_RegisterOperand result=Unary.getClearResult(s);
  OPT_Operand op1=Unary.getClearVal(s);
  if (result.similar(op1)) {
    OPT_DefUse.removeUse(op1.asRegister());
    OPT_DefUse.removeDef(result);
    OPT_DefUse.recordDefUse(result);
    UnaryAcc.mutate(s,opCode,result);
    return;
  }
  if (OPTIMIZE) {
    if (op1.isRegister()) {
      OPT_RegisterOperand rop1=op1.asRegister();
      if (!rop1.register.spansBasicBlock() && isDead(rop1.register)) {
        if (result.register.isSSA() && !result.register.spansBasicBlock() && rop1.register.isSSA()) {
          OPT_DefUse.removeUse(rop1);
          OPT_DefUse.removeDef(result);
          OPT_DefUse.recordDefUse(rop1);
          OPT_DefUse.mergeRegisters(ir,rop1.register,result.register);
          rop1.register.putSSA(false);
          UnaryAcc.mutate(s,opCode,rop1);
          return;
        }
 else {
          OPT_DefUse.removeDef(result);
          OPT_DefUse.removeUse(rop1);
          OPT_DefUse.recordDefUse(rop1);
          UnaryAcc.mutate(s,opCode,rop1);
          OPT_Instruction move=Move.create(getMoveOp(result.type),result,rop1.copy());
          OPT_DefUse.updateDUForNewInstruction(move);
          s.insertAfter(move);
          return;
        }
      }
    }
  }
  OPT_Instruction move=Move.create(getMoveOp(result.type),result.copyRO(),op1.copy());
  OPT_DefUse.updateDUForNewInstruction(move);
  s.insertBefore(move);
  OPT_DefUse.removeDef(result);
  OPT_DefUse.recordDefUse(result);
  if (op1.isRegister()) {
    OPT_DefUse.removeUse(op1.asRegister());
  }
  UnaryAcc.mutate(s,opCode,result);
}