diff options
| author | Teresa Johnson <tejohnson@google.com> | 2018-06-26 02:29:08 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2018-06-26 02:29:08 +0000 |
| commit | 519055336d09b510273e1810161832a6e1336838 (patch) | |
| tree | 9f30628dcdd59cfdf5157b252ab20b24d3afecb0 /llvm/lib | |
| parent | e44acadf6ab0ec228dcba2e02b495c1dfe7338dd (diff) | |
| download | bcm5719-llvm-519055336d09b510273e1810161832a6e1336838.tar.gz bcm5719-llvm-519055336d09b510273e1810161832a6e1336838.zip | |
[ThinLTO] Add string saver onto index for value names
Summary:
Adds a string saver to the ModuleSummaryIndex so it can store value
names in the case of adding a ValueInfo for a GUID when we don't
have the name stored in a Module string table. This is motivated
by the upcoming summary parser patch, where we will read value names
from the summary entry and want to store them, even when a Module
is not available.
Currently this allows us to store the name in the legacy bitcode case,
and I have added a test to show that.
Reviewers: pcc, dexonsmith
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, llvm-commits
Differential Revision: https://reviews.llvm.org/D47842
llvm-svn: 335570
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 6a589b4ff25..17dae20ce3a 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -607,14 +607,14 @@ ModuleSummaryIndexWrapperPass::ModuleSummaryIndexWrapperPass() bool ModuleSummaryIndexWrapperPass::runOnModule(Module &M) { auto &PSI = *getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI(); - Index = buildModuleSummaryIndex( + Index.emplace(buildModuleSummaryIndex( M, [this](const Function &F) { return &(this->getAnalysis<BlockFrequencyInfoWrapperPass>( *const_cast<Function *>(&F)) .getBFI()); }, - &PSI); + &PSI)); return false; } diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index ce2eb077450..b0e04075516 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -4836,11 +4836,14 @@ void ModuleSummaryIndexBitcodeReader::setValueGUID( if (PrintSummaryGUIDs) dbgs() << "GUID " << ValueGUID << "(" << OriginalNameID << ") is " << ValueName << "\n"; - + // UseStrtab is false for legacy summary formats and value names are - // created on stack. We can't use them outside of parseValueSymbolTable. + // created on stack. In that case we save the name in a string saver in + // the index so that the value name can be recorded. ValueIdToValueInfoMap[ValueID] = std::make_pair( - TheIndex.getOrInsertValueInfo(ValueGUID, UseStrtab ? ValueName : ""), + TheIndex.getOrInsertValueInfo( + ValueGUID, + UseStrtab ? ValueName : TheIndex.saveString(ValueName.str())), OriginalNameID); } |

