[llvm] 3ebc935 - [ADT] Simplify control flow in ImmutableSet (NFC) (#165133)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 26 08:20:17 PDT 2025
Author: Kazu Hirata
Date: 2025-10-26T08:20:13-07:00
New Revision: 3ebc935c24a352d5b82a65b9f1ef66661311056d
URL: https://github.com/llvm/llvm-project/commit/3ebc935c24a352d5b82a65b9f1ef66661311056d
DIFF: https://github.com/llvm/llvm-project/commit/3ebc935c24a352d5b82a65b9f1ef66661311056d.diff
LOG: [ADT] Simplify control flow in ImmutableSet (NFC) (#165133)
A conventional "if" statement is easier to read than the
do-while(false) pattern used here.
Added:
Modified:
llvm/include/llvm/ADT/ImmutableSet.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/ImmutableSet.h b/llvm/include/llvm/ADT/ImmutableSet.h
index 8b2425e4e8fef..1b40dac4d092c 100644
--- a/llvm/include/llvm/ADT/ImmutableSet.h
+++ b/llvm/include/llvm/ADT/ImmutableSet.h
@@ -635,9 +635,7 @@ class ImutAVLFactory {
// if find a collision compare those trees by their contents.
unsigned digest = TNew->computeDigest();
TreeTy *&entry = Cache[maskCacheIndex(digest)];
- do {
- if (!entry)
- break;
+ if (entry) {
for (TreeTy *T = entry ; T != nullptr; T = T->next) {
// Compare the Contents('T') with Contents('TNew')
typename TreeTy::iterator TI = T->begin(), TE = T->end();
@@ -653,7 +651,6 @@ class ImutAVLFactory {
entry->prev = TNew;
TNew->next = entry;
}
- while (false);
entry = TNew;
TNew->IsCanonicalized = true;
More information about the llvm-commits
mailing list