Fix liveness analysis in split AST optimizer

This commit is contained in:
Alexey Andreev 2017-01-25 22:46:15 +03:00
parent 02d8439920
commit 58563a3e2d
2 changed files with 2 additions and 4 deletions

View File

@ -125,7 +125,7 @@ public class Optimizer {
DefinitionExtractor defExtractor = new DefinitionExtractor();
UsageExtractor useExtractor = new UsageExtractor();
BasicBlock block = originalProgram.basicBlockAt(originalBlocks[i]);
Instruction splitPoint = splitPoints[i];
Instruction splitPoint = splitPoints[i].getPrevious();
for (Instruction insn = block.getLastInstruction(); insn != splitPoint; insn = insn.getPrevious()) {
insn.acceptVisitor(defExtractor);
insn.acceptVisitor(useExtractor);

View File

@ -36,9 +36,7 @@ public class ProgramNodeSplittingBackend implements GraphSplittingBackend {
int node = nodes[i];
BasicBlock block = program.basicBlockAt(node);
BasicBlock blockCopy = program.createBasicBlock();
blockCopy.addAll(ProgramUtils.copyInstructions(block.getFirstInstruction(), null, program));
blockCopy.getTryCatchBlocks().addAll(ProgramUtils.copyTryCatches(block, program));
blockCopy.setExceptionVariable(block.getExceptionVariable());
ProgramUtils.copyBasicBlock(block, blockCopy);
copies[i] = blockCopy.getIndex();
map.put(nodes[i], copies[i] + 1);
}