From b6a11a78794b196cf8cda59d584cbe0d3243c06b Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 9 Nov 2016 01:45:13 +0000 Subject: Revert "[ThinLTO] Prevent exporting of locals used/defined in module level asm" This reverts commit r286297. Introduces a dependency from libAnalysis to libObject, which I missed during the review. llvm-svn: 286329 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 7b49aac0..8de61bc 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3327,16 +3327,11 @@ void ModuleBitcodeWriter::writePerModuleFunctionSummaryRecord( void ModuleBitcodeWriter::writeModuleLevelReferences( const GlobalVariable &V, SmallVector &NameVals, unsigned FSModRefsAbbrev) { - auto Summaries = - Index->findGlobalValueSummaryList(GlobalValue::getGUID(V.getName())); - if (Summaries == Index->end()) { - // Only declarations should not have a summary (a declaration might however - // have a summary if the def was in module level asm). - assert(V.isDeclaration()); + // Only interested in recording variable defs in the summary. + if (V.isDeclaration()) return; - } - auto *Summary = Summaries->second.front().get(); NameVals.push_back(VE.getValueID(&V)); + auto *Summary = Index->getGlobalValueSummary(V); GlobalVarSummary *VS = cast(Summary); NameVals.push_back(getEncodedGVSummaryFlags(VS->flags())); @@ -3414,20 +3409,14 @@ void ModuleBitcodeWriter::writePerModuleGlobalValueSummary() { // Iterate over the list of functions instead of the Index to // ensure the ordering is stable. for (const Function &F : M) { + if (F.isDeclaration()) + continue; // Summary emission does not support anonymous functions, they have to // renamed using the anonymous function renaming pass. if (!F.hasName()) report_fatal_error("Unexpected anonymous function when writing summary"); - auto Summaries = - Index->findGlobalValueSummaryList(GlobalValue::getGUID(F.getName())); - if (Summaries == Index->end()) { - // Only declarations should not have a summary (a declaration might - // however have a summary if the def was in module level asm). - assert(F.isDeclaration()); - continue; - } - auto *Summary = Summaries->second.front().get(); + auto *Summary = Index->getGlobalValueSummary(F); writePerModuleFunctionSummaryRecord(NameVals, Summary, VE.getValueID(&F), FSCallsAbbrev, FSCallsProfileAbbrev, F); } -- cgit v1.1