Displaying 3 results from an estimated 3 matches for "deadcodeblock".
2018 May 24
0
LLVM Pass To Remove Dead Code In A Basic Block
> On 25 May 2018, at 01:46, Aaron via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hi all,
>
> LLVM optimization pass gives an error "Terminator found in the middle of a basic block!" since basic block IR may have multiple "ret" instructions. It seems LLVM does not accept multiple return in a basic block by default.
>
Yes, if you’re inserting
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
Hi all,
LLVM optimization pass gives an error "Terminator found in the middle of a
basic block!" since basic block IR may have multiple "ret" instructions. It
seems LLVM does not accept multiple return in a basic block by default.
Is there a specific optimization or pass that I can enable to remove
unreachable codes in basic blocks?
Best,
Aaron
-------------- next part
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
...t)
{
// Split after first return instruction.
if (it->getOpcode() == llvm::Instruction::Ret)
{
++it;
// Split only if there is a following instruction.
if (it != basicBlock->getInstList().end())
{
auto deadCodeBlock = SplitBasicBlock(basicBlock, it);
deadCodeBlock->eraseFromParent();
}
return;
}
}
}
llvm::BasicBlock * CodeGenPass::SplitBasicBlock(llvm::BasicBlock *
basicBlock, llvm::BasicBlock::iterator it)
{
assert(basicBlock->getTerminator() &am...