do not need 'allow dead instructions'
after copies are collected (instruction is dead only if all copies are dead)
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user