diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java index 72a8b008d50..15815c629a2 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java @@ -189,18 +189,23 @@ public class PseudocodeImpl implements Pseudocode { return deadInstructions; } deadInstructions = Lists.newArrayList(); - Collection 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 getLabels() {