mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 01:25:10 +00:00
[unwind removal] We no longer have 'unwind' instructions being generated, so
remove the code that handles them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149901 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -50,33 +50,13 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
|
||||
// return.
|
||||
//
|
||||
std::vector<BasicBlock*> ReturningBlocks;
|
||||
std::vector<BasicBlock*> UnwindingBlocks;
|
||||
std::vector<BasicBlock*> UnreachableBlocks;
|
||||
for(Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
|
||||
if (isa<ReturnInst>(I->getTerminator()))
|
||||
ReturningBlocks.push_back(I);
|
||||
else if (isa<UnwindInst>(I->getTerminator()))
|
||||
UnwindingBlocks.push_back(I);
|
||||
else if (isa<UnreachableInst>(I->getTerminator()))
|
||||
UnreachableBlocks.push_back(I);
|
||||
|
||||
// Handle unwinding blocks first.
|
||||
if (UnwindingBlocks.empty()) {
|
||||
UnwindBlock = 0;
|
||||
} else if (UnwindingBlocks.size() == 1) {
|
||||
UnwindBlock = UnwindingBlocks.front();
|
||||
} else {
|
||||
UnwindBlock = BasicBlock::Create(F.getContext(), "UnifiedUnwindBlock", &F);
|
||||
new UnwindInst(F.getContext(), UnwindBlock);
|
||||
|
||||
for (std::vector<BasicBlock*>::iterator I = UnwindingBlocks.begin(),
|
||||
E = UnwindingBlocks.end(); I != E; ++I) {
|
||||
BasicBlock *BB = *I;
|
||||
BB->getInstList().pop_back(); // Remove the unwind insn
|
||||
BranchInst::Create(UnwindBlock, BB);
|
||||
}
|
||||
}
|
||||
|
||||
// Then unreachable blocks.
|
||||
if (UnreachableBlocks.empty()) {
|
||||
UnreachableBlock = 0;
|
||||
|
Reference in New Issue
Block a user