summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-05-20 19:12:14 +0000
committerPete Cooper <peter_cooper@apple.com>2015-05-20 19:12:14 +0000
commitb78008171b9f5f6aae3a57fc745e8db08daf23b5 (patch)
tree9f25e3c57b68a53b15308fb12161c6ec17298be8 /llvm/lib/MC/MCDwarf.cpp
parent56a781495a3dd1c67332ed2853ec8d93a1857f81 (diff)
downloadbcm5719-llvm-b78008171b9f5f6aae3a57fc745e8db08daf23b5.tar.gz
bcm5719-llvm-b78008171b9f5f6aae3a57fc745e8db08daf23b5.zip
Use a SmallString buffer instead of a std::string for debug info path lookup. NFC.
This code appends the filename to the directory then looks that up in a StringMap. We should be using the existing Twine::toStringRef method instead of Twine::str() as most times we'll succeed in the lookup. Its possible that we should also consider allowing StringMap to lookup a key using a Twine in addition to a StringRef but that would complicate the code with little known benefit above and beyond this change. This saves 170k temporary allocations when running llc on the verify_use_list_order bitcode with debug info for x86. llvm-svn: 237823
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 05c2a02a8ed..74eee83b73f 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -360,8 +360,10 @@ unsigned MCDwarfLineTableHeader::getFile(StringRef &Directory,
FileNumber = SourceIdMap.size() + 1;
assert((MCDwarfFiles.empty() || FileNumber == MCDwarfFiles.size()) &&
"Don't mix autonumbered and explicit numbered line table usage");
+ SmallString<256> Buffer;
auto IterBool = SourceIdMap.insert(
- std::make_pair((Directory + Twine('\0') + FileName).str(), FileNumber));
+ std::make_pair((Directory + Twine('\0') + FileName).toStringRef(Buffer),
+ FileNumber));
if (!IterBool.second)
return IterBool.first->second;
}
OpenPOWER on IntegriCloud