[PATCH] D81342: [Support] FoldingSetNodeID::AddString(): reserve memory
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 13:53:03 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG932ad9941def: [Support] FoldingSetNodeID::AddString(): reserve memory (authored by lebedev.ri).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81342/new/
https://reviews.llvm.org/D81342
Files:
llvm/lib/Support/FoldingSet.cpp
Index: llvm/lib/Support/FoldingSet.cpp
===================================================================
--- llvm/lib/Support/FoldingSet.cpp
+++ llvm/lib/Support/FoldingSet.cpp
@@ -86,6 +86,10 @@
void FoldingSetNodeID::AddString(StringRef String) {
unsigned Size = String.size();
+
+ unsigned NumInserts = 1 + divideCeil(Size, 4);
+ Bits.reserve(Bits.size() + NumInserts);
+
Bits.push_back(Size);
if (!Size) return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81342.269347.patch
Type: text/x-patch
Size: 435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200608/6ba9d9af/attachment.bin>
More information about the llvm-commits
mailing list