do not need 'allow dead instructions'

after copies are collected

(instruction is dead only if all copies are dead)
This commit is contained in:
Svetlana Isakova
2012-12-13 19:36:09 +04:00
parent d778952512
commit 8584a76750
@@ -189,18 +189,23 @@ public class PseudocodeImpl implements Pseudocode {
return deadInstructions;
}
deadInstructions = Lists.newArrayList();
Collection<Instruction> allowedDeadInstructions = collectAllowedDeadInstructions();
for (Instruction instruction : mutableInstructionList) {
if (((InstructionImpl)instruction).isDead()) {
if (!allowedDeadInstructions.contains(instruction)) {
deadInstructions.add(instruction);
}
if (isDead(instruction)) {
deadInstructions.add(instruction);
}
}
return deadInstructions;
}
private static boolean isDead(@NotNull Instruction instruction) {
if (!((InstructionImpl)instruction).isDead()) return false;
for (Instruction copy : instruction.getCopies()) {
if (!((InstructionImpl)copy).isDead()) return false;
}
return true;
}
//for tests only
@NotNull
public List<PseudocodeLabel> getLabels() {