From 5506951ffb1c5f4195c77c6b245fa4f8916dd257 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Tue, 21 Feb 2023 21:38:30 +0100 Subject: [PATCH] LibJS: Don't try to merge unterminated BasicBlocks This was causing a Segfault, trying to access the non-present terminator --- Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp index fd3a19531c..cbbb27644f 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->is_terminated()) + continue; + if (entry.key->terminator()->type() != Instruction::Type::Jump) continue;