Browse Source

Remove dead jump table block

cl-refactor
Paweł Bylica 10 years ago
parent
commit
b448dba6b9
  1. 13
      evmjit/libevmjit/Compiler.cpp

13
evmjit/libevmjit/Compiler.cpp

@ -91,6 +91,7 @@ void Compiler::createBasicBlocks(bytes const& _bytecode)
} }
} }
// TODO: Create Stop basic block on demand
m_stopBB = llvm::BasicBlock::Create(m_mainFunc->getContext(), "Stop", m_mainFunc); m_stopBB = llvm::BasicBlock::Create(m_mainFunc->getContext(), "Stop", m_mainFunc);
} }
@ -863,6 +864,18 @@ void Compiler::removeDeadBlocks()
} }
} }
while (sthErased); while (sthErased);
if (m_jumpTableBlock && llvm::pred_begin(m_jumpTableBlock->llvm()) == llvm::pred_end(m_jumpTableBlock->llvm()))
{
m_jumpTableBlock->llvm()->eraseFromParent();
m_jumpTableBlock.reset();
}
if (m_badJumpBlock && llvm::pred_begin(m_badJumpBlock->llvm()) == llvm::pred_end(m_badJumpBlock->llvm()))
{
m_badJumpBlock->llvm()->eraseFromParent();
m_badJumpBlock.reset();
}
} }
void Compiler::dumpCFGifRequired(std::string const& _dotfilePath) void Compiler::dumpCFGifRequired(std::string const& _dotfilePath)

Loading…
Cancel
Save