Skip to content

Commit acd29e0

Browse files
committed
LibJS/Bytecode: Don't replace the entry block in MergeBlocks
The entry block must stay in place, although it's okay to merge stuff into it. This fixes 4 test262 tests and brings us to parity with optimization disabled. :^)
1 parent 5b29974 commit acd29e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ void MergeBlocks::perform(PassPipelineExecutable& executable)
3636
if (entry.key->terminator()->type() != Instruction::Type::Jump)
3737
continue;
3838

39-
{
39+
// NOTE: We can't replace the first block in a function, as it's the entry block.
40+
if (entry.key != executable.executable.basic_blocks.first()) {
4041
InstructionStreamIterator it { entry.key->instruction_stream() };
4142
auto& first_instruction = *it;
4243
if (first_instruction.type() == Instruction::Type::Jump) {

0 commit comments

Comments
 (0)