Author: Roman Lebedev Date: 2021-01-12T02:09:47+03:00 New Revision: 81afeacd379f160495718438d6dd5e9b848a169d
URL: https://github.com/llvm/llvm-project/commit/81afeacd379f160495718438d6dd5e9b848a169d DIFF: https://github.com/llvm/llvm-project/commit/81afeacd379f160495718438d6dd5e9b848a169d.diff LOG: [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. Added: Modified: llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp Removed: ################################################################################ diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp index 44b9ddd3e1ee..944331932495 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -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()); _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits