Program: 150158
Project: 150158
Buggy source:
/** 
 * Execute loop invariant code motion on the given IR.
 * @param ir
 */
public void perform(OPT_IR ir){
  this.ir=ir;
  if (DEBUG && ir.hasReachableExceptionHandlers()) {
    VM.sysWrite("String_Node_Str" + ir.method + "String_Node_Str");
    (new OPT_LiveAnalysis(false,false,true,false)).perform(ir);
    OPT_BasicBlockEnumeration e=ir.getBasicBlocks();
    while (e.hasMoreElements()) {
      OPT_BasicBlock b=e.next();
      if (b instanceof OPT_ExceptionHandlerBasicBlock)       VM.sysWrite("String_Node_Str" + b + "String_Node_Str"+ ((OPT_ExceptionHandlerBasicBlock)b).getLiveSet()+ "String_Node_Str");
    }
  }
  if (ir.hasReachableExceptionHandlers() || OPT_GCP.tooBig(ir)) {
    resetLandingPads();
    return;
  }
  verbose=ir.options.VERBOSE_GCP;
  if (verbose && ir.options.hasMETHOD_TO_PRINT()) {
    verbose=ir.options.fuzzyMatchMETHOD_TO_PRINT(ir.method.toString());
    if (!verbose) {
      resetLandingPads();
      return;
    }
  }
  if (verbose)   VM.sysWrite("String_Node_Str" + ir.method + "String_Node_Str");
  initialize(ir);
  if (verbose)   OPT_SSA.printInstructions(ir);
  OPT_Instruction inst=ir.firstInstructionInCodeOrder();
  while (inst != null) {
    OPT_Instruction next=inst.nextInstructionInCodeOrder();
    if (DEBUG)     System.out.println("String_Node_Str" + inst);
    scheduleEarly(inst);
    inst=next;
  }
  inst=ir.lastInstructionInCodeOrder();
  while (inst != null) {
    OPT_Instruction next=inst.prevInstructionInCodeOrder();
    scheduleLate(inst);
    inst=next;
  }
  resetLandingPads();
  if (DEBUG)   OPT_SSA.printInstructions(ir);
}

Fixed version (ground truth):
/** 
 * Execute loop invariant code motion on the given IR.
 * @param ir
 */
public void perform(OPT_IR ir){
  this.ir=ir;
  if (DEBUG && ir.hasReachableExceptionHandlers()) {
    VM.sysWrite("String_Node_Str" + ir.method + "String_Node_Str");
    (new OPT_LiveAnalysis(false,false,true,false)).perform(ir);
    OPT_BasicBlockEnumeration e=ir.getBasicBlocks();
    while (e.hasMoreElements()) {
      OPT_BasicBlock b=e.next();
      if (b instanceof OPT_ExceptionHandlerBasicBlock)       VM.sysWrite("String_Node_Str" + b + "String_Node_Str"+ ((OPT_ExceptionHandlerBasicBlock)b).getLiveSet()+ "String_Node_Str");
    }
  }
  if (ir.hasReachableExceptionHandlers() || OPT_GCP.tooBig(ir)) {
    resetLandingPads();
    return;
  }
  verbose=ir.options.VERBOSE_GCP;
  if (verbose && ir.options.hasMETHOD_TO_PRINT()) {
    verbose=ir.options.fuzzyMatchMETHOD_TO_PRINT(ir.method.toString());
    if (!verbose) {
      resetLandingPads();
      return;
    }
  }
  if (verbose)   VM.sysWrite("String_Node_Str" + ir.method + "String_Node_Str");
  initialize(ir);
  if (verbose)   OPT_SSA.printInstructions(ir);
  OPT_Instruction inst=ir.firstInstructionInCodeOrder();
  while (inst != null) {
    OPT_Instruction next=inst.nextInstructionInCodeOrder();
    if (DEBUG)     System.out.println("String_Node_Str" + inst);
    scheduleEarly(inst);
    inst=next;
  }
  inst=ir.lastInstructionInCodeOrder();
  while (inst != null) {
    OPT_Instruction next=inst.prevInstructionInCodeOrder();
    scheduleLate(inst);
    inst=next;
  }
  resetLandingPads();
  if (DEBUG)   OPT_SSA.printInstructions(ir);
  ir.actualSSAOptions.setScalarValid(false);
}