Program: 79487
Project: 79487
Buggy source:
public void run(){
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=new FuncInfo();
    funcInfoMap.put(irFunction,funcInfo);
    Map<IRRegister,IRRegister> renameMap=new HashMap<>();
    for (    BasicBlock bb : irFunction.getReversePostOrder()) {
      for (IRInstruction inst=bb.getFirstInst(); inst != null; inst=inst.getNextInst()) {
        if (isStaticLoadStore(inst))         continue;
        List<IRRegister> usedRegisters=inst.getUsedRegisters();
        if (!usedRegisters.isEmpty()) {
          renameMap.clear();
          for (          IRRegister reg : usedRegisters) {
            if (reg instanceof StaticData && !(reg instanceof StaticString)) {
              renameMap.put(reg,getStaticDataVreg(funcInfo.staticDataVregMap,(StaticData)reg));
            }
 else {
              renameMap.put(reg,reg);
            }
          }
          inst.setUsedRegisters(renameMap);
        }
        IRRegister definedRegister=inst.getDefinedRegister();
        if (definedRegister != null && definedRegister instanceof StaticData) {
          VirtualRegister vreg=getStaticDataVreg(funcInfo.staticDataVregMap,(StaticData)definedRegister);
          inst.setDefinedRegister(vreg);
          funcInfo.definedStaticData.add((StaticData)definedRegister);
        }
      }
    }
    BasicBlock startBB=irFunction.getStartBB();
    IRInstruction firtInst=startBB.getFirstInst();
    funcInfo.staticDataVregMap.forEach((staticData,virtualRegister) -> firtInst.prependInst(new IRLoad(startBB,virtualRegister,Configuration.getRegSize(),staticData,staticData instanceof StaticString)));
  }
  for (  IRFunction builtFunc : ir.getBuiltInFuncs().values()) {
    funcInfoMap.put(builtFunc,new FuncInfo());
  }
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=funcInfoMap.get(irFunction);
    funcInfo.recursiveUsedStaticData.addAll(funcInfo.staticDataVregMap.keySet());
    for (    IRFunction calleeFunc : irFunction.recursiveCalleeSet) {
      FuncInfo calleeFuncInfo=funcInfoMap.get(calleeFunc);
      funcInfo.recursiveUsedStaticData.addAll(calleeFuncInfo.staticDataVregMap.keySet());
    }
  }
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=funcInfoMap.get(irFunction);
    Set<StaticData> usedStaticData=funcInfo.staticDataVregMap.keySet();
    if (usedStaticData.isEmpty())     continue;
    for (    BasicBlock bb : irFunction.getReversePostOrder()) {
      for (IRInstruction inst=bb.getFirstInst(); inst != null; inst=inst.getNextInst()) {
        if (!(inst instanceof IRFunctionCall))         continue;
        IRFunction calleeFunc=((IRFunctionCall)inst).getFunc();
        FuncInfo calleeFuncInfo=funcInfoMap.get(calleeFunc);
        for (        StaticData staticData : funcInfo.definedStaticData) {
          if (staticData instanceof StaticString)           continue;
          if (calleeFuncInfo.recursiveUsedStaticData.contains(staticData)) {
            inst.prependInst(new IRStore(bb,funcInfo.staticDataVregMap.get(staticData),Configuration.getRegSize(),staticData));
          }
        }
        if (calleeFuncInfo.definedStaticData.isEmpty())         continue;
        Set<StaticData> loadStaticDataSet=new HashSet<>();
        loadStaticDataSet.addAll(calleeFuncInfo.definedStaticData);
        loadStaticDataSet.retainAll(usedStaticData);
        for (        StaticData staticData : loadStaticDataSet) {
          if (staticData instanceof StaticString)           continue;
          inst.appendInst(new IRLoad(bb,funcInfo.staticDataVregMap.get(staticData),Configuration.getRegSize(),staticData,staticData instanceof StaticString));
        }
      }
    }
  }
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=funcInfoMap.get(irFunction);
    IRReturn retInst=irFunction.getRetInstList().get(0);
    for (    StaticData staticData : funcInfo.definedStaticData) {
      retInst.prependInst(new IRStore(retInst.getParentBB(),funcInfo.staticDataVregMap.get(staticData),Configuration.getRegSize(),staticData));
    }
  }
}

Fixed version (ground truth):
public void run(){
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=new FuncInfo();
    funcInfoMap.put(irFunction,funcInfo);
    Map<IRRegister,IRRegister> renameMap=new HashMap<>();
    for (    BasicBlock bb : irFunction.getReversePostOrder()) {
      for (IRInstruction inst=bb.getFirstInst(); inst != null; inst=inst.getNextInst()) {
        if (isStaticLoadStore(inst))         continue;
        List<IRRegister> usedRegisters=inst.getUsedRegisters();
        if (!usedRegisters.isEmpty()) {
          renameMap.clear();
          for (          IRRegister reg : usedRegisters) {
            if (reg instanceof StaticData && !(reg instanceof StaticString)) {
              renameMap.put(reg,getStaticDataVreg(funcInfo.staticDataVregMap,(StaticData)reg));
            }
 else {
              renameMap.put(reg,reg);
            }
          }
          inst.setUsedRegisters(renameMap);
        }
        IRRegister definedRegister=inst.getDefinedRegister();
        if (definedRegister != null && definedRegister instanceof StaticData) {
          VirtualRegister vreg=getStaticDataVreg(funcInfo.staticDataVregMap,(StaticData)definedRegister);
          inst.setDefinedRegister(vreg);
          funcInfo.definedStaticData.add((StaticData)definedRegister);
        }
      }
    }
    BasicBlock startBB=irFunction.getStartBB();
    IRInstruction firtInst=startBB.getFirstInst();
    funcInfo.staticDataVregMap.forEach((staticData,virtualRegister) -> firtInst.prependInst(new IRLoad(startBB,virtualRegister,Configuration.getRegSize(),staticData,staticData instanceof StaticString)));
  }
  for (  IRFunction builtFunc : ir.getBuiltInFuncs().values()) {
    funcInfoMap.put(builtFunc,new FuncInfo());
  }
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=funcInfoMap.get(irFunction);
    funcInfo.recursiveUsedStaticData.addAll(funcInfo.staticDataVregMap.keySet());
    funcInfo.recursiveDefinedStaticData.addAll(funcInfo.definedStaticData);
    for (    IRFunction calleeFunc : irFunction.recursiveCalleeSet) {
      FuncInfo calleeFuncInfo=funcInfoMap.get(calleeFunc);
      funcInfo.recursiveUsedStaticData.addAll(calleeFuncInfo.staticDataVregMap.keySet());
      funcInfo.recursiveDefinedStaticData.addAll(calleeFuncInfo.definedStaticData);
    }
  }
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=funcInfoMap.get(irFunction);
    Set<StaticData> usedStaticData=funcInfo.staticDataVregMap.keySet();
    if (usedStaticData.isEmpty())     continue;
    for (    BasicBlock bb : irFunction.getReversePostOrder()) {
      for (IRInstruction inst=bb.getFirstInst(); inst != null; inst=inst.getNextInst()) {
        if (!(inst instanceof IRFunctionCall))         continue;
        IRFunction calleeFunc=((IRFunctionCall)inst).getFunc();
        FuncInfo calleeFuncInfo=funcInfoMap.get(calleeFunc);
        for (        StaticData staticData : funcInfo.definedStaticData) {
          if (staticData instanceof StaticString)           continue;
          if (calleeFuncInfo.recursiveUsedStaticData.contains(staticData)) {
            inst.prependInst(new IRStore(bb,funcInfo.staticDataVregMap.get(staticData),Configuration.getRegSize(),staticData));
          }
        }
        if (calleeFuncInfo.recursiveDefinedStaticData.isEmpty())         continue;
        Set<StaticData> loadStaticDataSet=new HashSet<>();
        loadStaticDataSet.addAll(calleeFuncInfo.recursiveDefinedStaticData);
        loadStaticDataSet.retainAll(usedStaticData);
        for (        StaticData staticData : loadStaticDataSet) {
          if (staticData instanceof StaticString)           continue;
          inst.appendInst(new IRLoad(bb,funcInfo.staticDataVregMap.get(staticData),Configuration.getRegSize(),staticData,staticData instanceof StaticString));
        }
      }
    }
  }
  for (  IRFunction irFunction : ir.getFuncs().values()) {
    FuncInfo funcInfo=funcInfoMap.get(irFunction);
    IRReturn retInst=irFunction.getRetInstList().get(0);
    for (    StaticData staticData : funcInfo.definedStaticData) {
      retInst.prependInst(new IRStore(retInst.getParentBB(),funcInfo.staticDataVregMap.get(staticData),Configuration.getRegSize(),staticData));
    }
  }
}