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
This commit is contained in:
@@ -3327,16 +3327,11 @@ void ModuleBitcodeWriter::writePerModuleFunctionSummaryRecord(
|
||||
void ModuleBitcodeWriter::writeModuleLevelReferences(
|
||||
const GlobalVariable &V, SmallVector<uint64_t, 64> &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<GlobalVarSummary>(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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user