Skip to content

Commit a78b19d

Browse files
[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.
1 parent 106621b commit a78b19d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/IR/Metadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ void Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs) {
15901590
if (!Value::hasMetadata())
15911591
return; // Nothing to remove!
15921592

1593-
SmallSet<unsigned, 4> KnownSet;
1593+
SmallSet<unsigned, 32> KnownSet;
15941594
KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
15951595

15961596
// A DIAssignID attachment is debug metadata, don't drop it.

0 commit comments

Comments
 (0)