ControlFlow () { if (transparentInstructionCount == 0) return getControlFlow(); ArrayList<Instruction> result = new ArrayList<>(instructionCount); int processedTransparentInstructions = 0; for (Instruction instruction : instructions) { if (instruction instanceof TransparentInstruction) { processedTransparentInstructions++; Collection<Instruction> predecessors = instruction.allPred(); Collection<Instruction> successors = instruction.allSucc(); for (Instruction predecessor : predecessors) { predecessor.replaceSucc(instruction, successors); } for (Instruction successor : successors) { successor.replacePred(instruction, predecessors); } } else { result.add(instruction); } } if (result.size() != instructionCount || processedTransparentInstructions != transparentInstructionCount) { LOG.error("Control flow graph is inconsistent. Instructions: (" + result.size() + ", " + instructionCount + ")\n" + "Transparent instructions: (" + processedTransparentInstructions + ", " + transparentInstructionCount + ")"); } if (!pending.isEmpty()) { LOG.error("Control flow is used incorrectly. All pending node must be connected to fake exit point. Pending: " + pending); } return new ControlFlowImpl(result.toArray(Instruction.EMPTY_ARRAY)); }