Program: 150197
Project: 150197
Buggy source:
/** 
 * Generate wrapper around branching type check to get a  value producing type check. 
 * @param s        The OPT_Instruction that is to be replaced by a value producing type check
 * @param ir       The OPT_IR containing the instruction to be expanded.
 * @param RHSobj   The OPT_RegisterOperand containing the rhs object.
 * @param LHStype  The VM_TypeReference to be tested against.
 * @param RHStib   The OPT_RegisterOperand containing the TIB of the rhs.
 * @param result   The OPT_RegisterOperand that the result of dynamic 
 * @return the opt instruction immediately before the instruction to continue expansion.
 */
private static OPT_Instruction convertToBranchingTypeCheck(OPT_Instruction s,OPT_IR ir,OPT_Operand RHSobj,VM_TypeReference LHStype,OPT_RegisterOperand RHStib,OPT_RegisterOperand result){
  OPT_BasicBlock myBlock=s.getBasicBlock();
  OPT_BasicBlock contBlock=myBlock.splitNodeAt(s,ir);
  OPT_BasicBlock trueBlock=myBlock.createSubBlock(s.bcIndex,ir);
  OPT_BasicBlock falseBlock=myBlock.createSubBlock(s.bcIndex,ir);
  myBlock.insertOut(trueBlock);
  myBlock.insertOut(falseBlock);
  trueBlock.insertOut(contBlock);
  falseBlock.insertOut(contBlock);
  ir.cfg.linkInCodeOrder(myBlock,trueBlock);
  ir.cfg.linkInCodeOrder(trueBlock,falseBlock);
  ir.cfg.linkInCodeOrder(falseBlock,contBlock);
  trueBlock.appendInstruction(Move.create(INT_MOVE,result,I(1)));
  trueBlock.appendInstruction(Goto.create(GOTO,contBlock.makeJumpTarget()));
  falseBlock.appendInstruction(Move.create(INT_MOVE,result.copyD2D(),I(0)));
  return generateBranchingTypeCheck(s,ir,RHSobj,LHStype,RHStib,trueBlock,falseBlock,null);
}

Fixed version (ground truth):
/** 
 * Generate wrapper around branching type check to get a  value producing type check. 
 * @param s        The OPT_Instruction that is to be replaced by a value producing type check
 * @param ir       The OPT_IR containing the instruction to be expanded.
 * @param RHSobj   The OPT_RegisterOperand containing the rhs object.
 * @param LHStype  The VM_TypeReference to be tested against.
 * @param RHStib   The OPT_RegisterOperand containing the TIB of the rhs.
 * @param result   The OPT_RegisterOperand that the result of dynamic 
 * @return the opt instruction immediately before the instruction to continue expansion.
 */
private static OPT_Instruction convertToBranchingTypeCheck(OPT_Instruction s,OPT_IR ir,OPT_Operand RHSobj,VM_TypeReference LHStype,OPT_RegisterOperand RHStib,OPT_RegisterOperand result){
  OPT_BasicBlock myBlock=s.getBasicBlock();
  OPT_BasicBlock contBlock=myBlock.splitNodeAt(s,ir);
  OPT_BasicBlock trueBlock=myBlock.createSubBlock(s.bcIndex,ir);
  OPT_BasicBlock falseBlock=myBlock.createSubBlock(s.bcIndex,ir);
  myBlock.insertOut(trueBlock);
  myBlock.insertOut(falseBlock);
  trueBlock.insertOut(contBlock);
  falseBlock.insertOut(contBlock);
  ir.cfg.linkInCodeOrder(myBlock,trueBlock);
  ir.cfg.linkInCodeOrder(trueBlock,falseBlock);
  ir.cfg.linkInCodeOrder(falseBlock,contBlock);
  trueBlock.appendInstruction(Move.create(INT_MOVE,result,I(1)));
  trueBlock.appendInstruction(Goto.create(GOTO,contBlock.makeJumpTarget()));
  falseBlock.appendInstruction(Move.create(INT_MOVE,result.copyD2D(),I(0)));
  return generateBranchingTypeCheck(s,ir,RHSobj,LHStype,RHStib,trueBlock,falseBlock,null,new OPT_BranchProfileOperand());
}