aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-07-15 09:19:15 -0700
committerGitHub <noreply@github.com>2024-07-15 09:19:15 -0700
commita78b19d8ea513a2e88fa431b549b65406384a12d (patch)
treefb036f247edc2f3dc918c59f3e7e780669ccceb3
parent106621b601d7dc7c4929fba293f7e5ffe6b92c58 (diff)
downloadllvm-a78b19d8ea513a2e88fa431b549b65406384a12d.zip
llvm-a78b19d8ea513a2e88fa431b549b65406384a12d.tar.gz
llvm-a78b19d8ea513a2e88fa431b549b65406384a12d.tar.bz2
[IR] Use SmallSet with more inline elements in dropUnknownNonDebugMetadata (NFC) (#98853)
SmallSet here often ends up allocating memory via std::set inside SmallSet because KnownIDs.size() goes up to 17 on an x86 host. This patch switches to SmallSet<unsigned, 32> to avoid memory allocations. The increased inline elements here save 0.57% of heap allocations during the compilation of X86ISelLowering.cpp.ii, a preprocessed version of X86ISelLowering.cpp.
-rw-r--r--llvm/lib/IR/Metadata.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 5f42ce2..3aec714 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -1590,7 +1590,7 @@ void Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs) {
if (!Value::hasMetadata())
return; // Nothing to remove!
- SmallSet<unsigned, 4> KnownSet;
+ SmallSet<unsigned, 32> KnownSet;
KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
// A DIAssignID attachment is debug metadata, don't drop it.