[llvm] b6a94b6 - [OMPIRBuilder] Use SmallPtrSet::remove_if() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 05:43:08 PDT 2024
Author: Nikita Popov
Date: 2024-06-26T14:43:01+02:00
New Revision: b6a94b6bfb2cbcfcb64c354d3ab876ec52bfcd14
URL: https://github.com/llvm/llvm-project/commit/b6a94b6bfb2cbcfcb64c354d3ab876ec52bfcd14
DIFF: https://github.com/llvm/llvm-project/commit/b6a94b6bfb2cbcfcb64c354d3ab876ec52bfcd14.diff
LOG: [OMPIRBuilder] Use SmallPtrSet::remove_if() (NFC)
Added:
Modified:
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 65231f50566c3..5154c33502526 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3248,16 +3248,8 @@ static void removeUnusedBlocksFromParent(ArrayRef<BasicBlock *> BBs) {
return false;
};
- while (true) {
- bool Changed = false;
- for (BasicBlock *BB : make_early_inc_range(BBsToErase)) {
- if (HasRemainingUses(BB)) {
- BBsToErase.erase(BB);
- Changed = true;
- }
- }
- if (!Changed)
- break;
+ while (BBsToErase.remove_if(HasRemainingUses)) {
+ // Try again if anything was removed.
}
SmallVector<BasicBlock *, 7> BBVec(BBsToErase.begin(), BBsToErase.end());
More information about the llvm-commits
mailing list