Selaa lähdekoodia

LibJS: Don't try to merge blocks not ending in Jumps

Hendiadyoin1 2 vuotta sitten
vanhempi
commit
186237aec8
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp

+ 4 - 0
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<BasicBlock const*> successors { current_block };
         for (;;) {
             auto const* last = successors.last();