Program: 132980
Project: 132980
Buggy source:
/** 
 * Try to hoist this instruction
 * @param logger
 * @param inst
 * @param state
 * @return true if hoisted
 */
private boolean tryHoist(Logger logger,Instruction inst,HoistTracking state){
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + inst + "String_Node_Str"+ state.maxHoist+ "String_Node_Str"+ state.maxLoopHoist);
  }
  if (inst.hasSideEffects()) {
    logger.trace("String_Node_Str");
    return false;
  }
  int maxHoist=state.maxHoist;
  for (  Arg in : inst.getInputs()) {
    if (maxHoist <= 0)     return false;
    if (in.isVar()) {
      Var inVar=in.getVar();
      maxHoist=Math.min(maxHoist,maxInputHoist(logger,state,inVar));
    }
  }
  for (  Var readOutput : inst.getReadOutputs()) {
    maxHoist=Math.min(maxHoist,maxInputHoist(logger,state,readOutput));
  }
  for (  Var out : inst.getOutputs()) {
    if (trackDeclares(out)) {
      int declareDepth=state.declareMap.getDepth(out);
      if (logger.isTraceEnabled())       logger.trace("String_Node_Str" + out + "String_Node_Str"+ declareDepth);
      assert(declareDepth >= 0);
      if (declareDepth > state.maxLoopHoist && !inst.isIdempotent()) {
        maxHoist=Math.min(maxHoist,state.maxLoopHoist);
        if (logger.isTraceEnabled())         logger.trace("String_Node_Str" + state.maxLoopHoist);
      }
    }
  }
  for (  Var out : inst.getOutputs()) {
    if (out.storage() == VarStorage.ALIAS) {
      if (!inst.getInitializedAliases().contains(out)) {
        int initDepth=state.initializedMap.getDepth(out);
        if (logger.isTraceEnabled())         logger.trace("String_Node_Str" + initDepth + "String_Node_Str"+ "String_Node_Str"+ out);
        maxHoist=Math.min(maxHoist,initDepth);
        return false;
      }
    }
  }
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + maxHoist);
  if (maxHoist > 0) {
    doHoist(logger,inst,maxHoist,state);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Try to hoist this instruction
 * @param logger
 * @param inst
 * @param state
 * @return true if hoisted
 */
private boolean tryHoist(Logger logger,Instruction inst,HoistTracking state){
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + inst + "String_Node_Str"+ state.maxHoist+ "String_Node_Str"+ state.maxLoopHoist);
  }
  if (inst.hasSideEffects()) {
    logger.trace("String_Node_Str");
    return false;
  }
  int maxHoist=state.maxHoist;
  for (  Arg in : inst.getInputs()) {
    if (maxHoist <= 0)     return false;
    if (in.isVar()) {
      Var inVar=in.getVar();
      maxHoist=Math.min(maxHoist,maxInputHoist(logger,state,inVar));
    }
  }
  for (  Var readOutput : inst.getReadOutputs()) {
    maxHoist=Math.min(maxHoist,maxInputHoist(logger,state,readOutput));
  }
  for (  Var out : inst.getOutputs()) {
    if (trackDeclares(out)) {
      int declareDepth=state.declareMap.getDepth(out);
      if (logger.isTraceEnabled())       logger.trace("String_Node_Str" + out + "String_Node_Str"+ declareDepth);
      assert(declareDepth >= 0);
      if (declareDepth > state.maxLoopHoist && !inst.isIdempotent()) {
        maxHoist=Math.min(maxHoist,state.maxLoopHoist);
        if (logger.isTraceEnabled())         logger.trace("String_Node_Str" + state.maxLoopHoist);
      }
    }
  }
  for (  Var out : inst.getPiecewiseAssignedOutputs()) {
    maxHoist=Math.min(maxHoist,state.maxLoopHoist);
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str" + out + "String_Node_Str"+ "String_Node_Str"+ state.maxLoopHoist);
  }
  for (  Var out : inst.getOutputs()) {
    if (out.storage() == VarStorage.ALIAS) {
      if (!inst.getInitializedAliases().contains(out)) {
        int initDepth=state.initializedMap.getDepth(out);
        if (logger.isTraceEnabled())         logger.trace("String_Node_Str" + initDepth + "String_Node_Str"+ "String_Node_Str"+ out);
        maxHoist=Math.min(maxHoist,initDepth);
        return false;
      }
    }
  }
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + maxHoist);
  if (maxHoist > 0) {
    doHoist(logger,inst,maxHoist,state);
    return true;
  }
 else {
    return false;
  }
}