[llvm] d782119 - [Analysis] Use SmallPtrSet::remove_if (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 01:24:49 PDT 2024
Author: Nikita Popov
Date: 2024-06-25T10:24:31+02:00
New Revision: d78211912391b724a064ef017dbf239eff10380a
URL: https://github.com/llvm/llvm-project/commit/d78211912391b724a064ef017dbf239eff10380a
DIFF: https://github.com/llvm/llvm-project/commit/d78211912391b724a064ef017dbf239eff10380a.diff
LOG: [Analysis] Use SmallPtrSet::remove_if (NFC)
Added:
Modified:
llvm/include/llvm/IR/Analysis.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Analysis.h b/llvm/include/llvm/IR/Analysis.h
index a7005285dd9bf..da250c031396b 100644
--- a/llvm/include/llvm/IR/Analysis.h
+++ b/llvm/include/llvm/IR/Analysis.h
@@ -190,9 +190,8 @@ class PreservedAnalyses {
PreservedIDs.erase(ID);
NotPreservedAnalysisIDs.insert(ID);
}
- for (auto *ID : PreservedIDs)
- if (!Arg.PreservedIDs.count(ID))
- PreservedIDs.erase(ID);
+ PreservedIDs.remove_if(
+ [&](void *ID) { return !Arg.PreservedIDs.contains(ID); });
}
/// Intersect this set with a temporary other set in place.
@@ -212,9 +211,8 @@ class PreservedAnalyses {
PreservedIDs.erase(ID);
NotPreservedAnalysisIDs.insert(ID);
}
- for (auto *ID : PreservedIDs)
- if (!Arg.PreservedIDs.count(ID))
- PreservedIDs.erase(ID);
+ PreservedIDs.remove_if(
+ [&](void *ID) { return !Arg.PreservedIDs.contains(ID); });
}
/// A checker object that makes it easy to query for whether an analysis or
@@ -316,4 +314,4 @@ class PreservedAnalyses {
};
} // namespace llvm
-#endif
\ No newline at end of file
+#endif
More information about the llvm-commits
mailing list