1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

[SimplifyCFGPass] mergeEmptyReturnBlocks(): skip blocks scheduled for removal as per DomTreeUpdater

Thus supporting lazy DomTreeUpdater mode,
where the domtree updates (and thus block removals)
aren't applied immediately, but are delayed
until last possible moment.
This commit is contained in:
Roman Lebedev 2021-01-12 00:35:15 +03:00
parent ef53c50f1a
commit 0938d81acb

View File

@ -86,8 +86,9 @@ static bool mergeEmptyReturnBlocks(Function &F, DomTreeUpdater *DTU) {
BasicBlock *RetBlock = nullptr;
// Scan all the blocks in the function, looking for empty return blocks.
for (Function::iterator BBI = F.begin(), E = F.end(); BBI != E; ) {
BasicBlock &BB = *BBI++;
for (BasicBlock &BB : make_early_inc_range(F)) {
if (DTU && DTU->isBBPendingDeletion(&BB))
continue;
// Only look at return blocks.
ReturnInst *Ret = dyn_cast<ReturnInst>(BB.getTerminator());