From bc6f52da82b4a0383fa2f2c4e056b43b6e5ddaf7 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 31 Oct 2017 21:52:15 +0000 Subject: [codeview] Merge file checksum entries for DIFiles with the same absolute path Change the map key from DIFile* to the absolute path string. Computing the absolute path isn't expensive because we already have a map that caches the full path keyed on DIFile*. llvm-svn: 317041 --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 4 ++-- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter') diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 7d50d643c99..67bab8c7684 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -154,11 +154,11 @@ StringRef CodeViewDebug::getFullFilepath(const DIFile *File) { } unsigned CodeViewDebug::maybeRecordFile(const DIFile *F) { + StringRef FullPath = getFullFilepath(F); unsigned NextId = FileIdMap.size() + 1; - auto Insertion = FileIdMap.insert(std::make_pair(F, NextId)); + auto Insertion = FileIdMap.insert(std::make_pair(FullPath, NextId)); if (Insertion.second) { // We have to compute the full filepath and emit a .cv_file directive. - StringRef FullPath = getFullFilepath(F); std::string Checksum = fromHex(F->getChecksum()); void *CKMem = OS.getContext().allocate(Checksum.size(), 1); memcpy(CKMem, Checksum.data(), Checksum.size()); diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h index 5e424baf852..9eff4a7fd81 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h @@ -161,8 +161,9 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { /// emit at the end of the TU. MapVector FnDebugInfo; - /// Map from DIFile to .cv_file id. - DenseMap FileIdMap; + /// Map from full file path to .cv_file id. Full paths are built from DIFiles + /// and are stored in FileToFilepathMap; + DenseMap FileIdMap; /// All inlined subprograms in the order they should be emitted. SmallSetVector InlinedSubprograms; -- cgit v1.2.3