From 186237aec8d100303711c39b548dd7770e19d773 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Tue, 8 Nov 2022 20:13:55 +0100 Subject: [PATCH] LibJS: Don't try to merge blocks not ending in Jumps --- Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp index ba693964f3..0b25b313f6 100644 --- a/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp @@ -30,6 +30,9 @@ void MergeBlocks::perform(PassPipelineExecutable& executable) if (executable.exported_blocks->contains(*entry.value.begin())) continue; + if (entry.key->terminator()->type() != Instruction::Type::Jump) + continue; + { InstructionStreamIterator it { entry.key->instruction_stream() }; auto& first_instruction = *it; @@ -95,6 +98,7 @@ void MergeBlocks::perform(PassPipelineExecutable& executable) auto it = blocks_to_merge.begin(); auto const* current_block = *it; blocks_to_merge.remove(it); + Vector successors { current_block }; for (;;) { auto const* last = successors.last();