|
@ -911,6 +911,25 @@ void Compiler::linkBasicBlocks() |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Remove dead basic blocks
|
|
|
|
|
|
auto sthErased = false; |
|
|
|
|
|
do |
|
|
|
|
|
{ |
|
|
|
|
|
sthErased = false; |
|
|
|
|
|
for (auto it = basicBlocks.begin(); it != basicBlocks.end();) |
|
|
|
|
|
{ |
|
|
|
|
|
auto llvmBB = it->second.llvm(); |
|
|
|
|
|
if (llvm::pred_begin(llvmBB) == llvm::pred_end(llvmBB)) |
|
|
|
|
|
{ |
|
|
|
|
|
llvmBB->eraseFromParent(); |
|
|
|
|
|
basicBlocks.erase(it++); |
|
|
|
|
|
sthErased = true; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
++it; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
while (sthErased); |
|
|
|
|
|
|
|
|
// TODO: It is crappy visiting of basic blocks.
|
|
|
// TODO: It is crappy visiting of basic blocks.
|
|
|
llvm::SmallPtrSet<llvm::BasicBlock*, 32> visitSet; |
|
|
llvm::SmallPtrSet<llvm::BasicBlock*, 32> visitSet; |
|
|