[llvm] 974dbb2 - [IR] Call DenseMap::erase directly (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 12 10:47:11 PDT 2022
Author: Kazu Hirata
Date: 2022-06-12T10:47:06-07:00
New Revision: 974dbb20bd67d23ae933f1165273c1e6c990e697
URL: https://github.com/llvm/llvm-project/commit/974dbb20bd67d23ae933f1165273c1e6c990e697
DIFF: https://github.com/llvm/llvm-project/commit/974dbb20bd67d23ae933f1165273c1e6c990e697.diff
LOG: [IR] Call DenseMap::erase directly (NFC)
We can erase an item in DenseMap without checking its membership first.
Added:
Modified:
llvm/lib/IR/Globals.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index 4f53f8ecf9df6..d2ddfd4d8a1e1 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -236,9 +236,7 @@ void GlobalValue::setSanitizerMetadata(const SanitizerMetadata &Meta) {
void GlobalValue::removeSanitizerMetadata() {
DenseMap<const GlobalValue *, SanitizerMetadata> &MetadataMap =
getContext().pImpl->GlobalValueSanitizerMetadata;
- auto It = MetadataMap.find(this);
- if (It != MetadataMap.end())
- MetadataMap.erase(It);
+ MetadataMap.erase(this);
HasSanitizerMetadata = false;
}
More information about the llvm-commits
mailing list