Fixes bug in GVN

This commit is contained in:
konsoletyper 2014-09-04 19:58:09 +04:00
parent 520008913e
commit 9fe66c4f2e
3 changed files with 6 additions and 1 deletions

View File

@ -37,6 +37,9 @@ public class PreOptimizingClassHolderSource implements ClassHolderSource {
ClassHolder cls = cache.get(name);
if (cls == null) {
cls = innerClassSource.get(name);
if (cls == null) {
return null;
}
for (MethodHolder method : cls.getMethods()) {
new GlobalValueNumbering().optimize(method, method.getProgram());
new UnusedVariableElimination().optimize(method, method.getProgram());

View File

@ -296,7 +296,7 @@ public class InstructionStringifier implements InstructionReader {
@Override
public void cloneArray(VariableReader receiver, VariableReader array) {
sb.append("@").append(receiver.getIndex()).append("@").append(array.getIndex()).append(".clone()");
sb.append("@").append(receiver.getIndex()).append(" := @").append(array.getIndex()).append(".clone()");
}
@Override

View File

@ -360,6 +360,8 @@ public class GlobalValueNumbering implements MethodOptimization {
@Override
public void visit(CloneArrayInstruction insn) {
int a = map[insn.getArray().getIndex()];
insn.setArray(program.variableAt(a));
}
@Override