2015-11-24 14:07:49 +08:00
|
|
|
//===- FunctionImport.cpp - ThinLTO Summary-based Function Import ---------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements Function import based on summaries.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Transforms/IPO/FunctionImport.h"
|
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2016-03-27 23:27:30 +08:00
|
|
|
#include "llvm/ADT/Statistic.h"
|
2015-11-24 14:07:49 +08:00
|
|
|
#include "llvm/ADT/StringSet.h"
|
|
|
|
#include "llvm/IR/AutoUpgrade.h"
|
|
|
|
#include "llvm/IR/DiagnosticPrinter.h"
|
|
|
|
#include "llvm/IR/IntrinsicInst.h"
|
|
|
|
#include "llvm/IR/Module.h"
|
|
|
|
#include "llvm/IRReader/IRReader.h"
|
|
|
|
#include "llvm/Linker/Linker.h"
|
2016-03-15 08:04:37 +08:00
|
|
|
#include "llvm/Object/ModuleSummaryIndexObjectFile.h"
|
2015-11-24 14:07:49 +08:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
#include "llvm/Support/SourceMgr.h"
|
2016-02-11 02:11:31 +08:00
|
|
|
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
|
2015-12-09 16:17:35 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
#define DEBUG_TYPE "function-import"
|
2015-12-09 16:17:35 +08:00
|
|
|
|
2015-11-24 14:07:49 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2016-03-27 23:27:30 +08:00
|
|
|
STATISTIC(NumImported, "Number of functions imported");
|
|
|
|
|
2015-11-25 06:55:46 +08:00
|
|
|
/// Limit on instruction count of imported functions.
|
|
|
|
static cl::opt<unsigned> ImportInstrLimit(
|
|
|
|
"import-instr-limit", cl::init(100), cl::Hidden, cl::value_desc("N"),
|
|
|
|
cl::desc("Only import functions with less than N instructions"));
|
|
|
|
|
2016-02-11 07:31:45 +08:00
|
|
|
static cl::opt<float>
|
|
|
|
ImportInstrFactor("import-instr-evolution-factor", cl::init(0.7),
|
|
|
|
cl::Hidden, cl::value_desc("x"),
|
|
|
|
cl::desc("As we import functions, multiply the "
|
|
|
|
"`import-instr-limit` threshold by this factor "
|
|
|
|
"before processing newly imported functions"));
|
|
|
|
|
2016-03-27 23:27:30 +08:00
|
|
|
static cl::opt<bool> PrintImports("print-imports", cl::init(false), cl::Hidden,
|
|
|
|
cl::desc("Print imported functions"));
|
|
|
|
|
2016-04-21 09:59:39 +08:00
|
|
|
// Temporary allows the function import pass to disable always linking
|
|
|
|
// referenced discardable symbols.
|
|
|
|
static cl::opt<bool>
|
|
|
|
DontForceImportReferencedDiscardableSymbols("disable-force-link-odr",
|
|
|
|
cl::init(false), cl::Hidden);
|
|
|
|
|
2015-11-24 14:07:49 +08:00
|
|
|
// Load lazily a module from \p FileName in \p Context.
|
|
|
|
static std::unique_ptr<Module> loadFile(const std::string &FileName,
|
|
|
|
LLVMContext &Context) {
|
|
|
|
SMDiagnostic Err;
|
|
|
|
DEBUG(dbgs() << "Loading '" << FileName << "'\n");
|
2016-01-22 08:15:53 +08:00
|
|
|
// Metadata isn't loaded until functions are imported, to minimize
|
|
|
|
// the memory overhead.
|
2016-01-08 22:17:41 +08:00
|
|
|
std::unique_ptr<Module> Result =
|
|
|
|
getLazyIRFileModule(FileName, Err, Context,
|
|
|
|
/* ShouldLazyLoadMetadata = */ true);
|
2015-11-24 14:07:49 +08:00
|
|
|
if (!Result) {
|
|
|
|
Err.print("function-import", errs());
|
2016-04-01 13:33:11 +08:00
|
|
|
report_fatal_error("Abort");
|
2015-11-24 14:07:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2015-12-09 16:17:35 +08:00
|
|
|
namespace {
|
2016-02-11 07:31:45 +08:00
|
|
|
|
2016-04-27 08:32:13 +08:00
|
|
|
// Return true if the Summary describes a GlobalValue that can be externally
|
|
|
|
// referenced, i.e. it does not need renaming (linkage is not local) or renaming
|
|
|
|
// is possible (does not have a section for instance).
|
|
|
|
static bool canBeExternallyReferenced(const GlobalValueSummary &Summary) {
|
|
|
|
if (!Summary.needsRenaming())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (Summary.hasSection())
|
|
|
|
// Can't rename a global that needs renaming if has a section.
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return true if \p GUID describes a GlobalValue that can be externally
|
|
|
|
// referenced, i.e. it does not need renaming (linkage is not local) or
|
|
|
|
// renaming is possible (does not have a section for instance).
|
|
|
|
static bool canBeExternallyReferenced(const ModuleSummaryIndex &Index,
|
|
|
|
GlobalValue::GUID GUID) {
|
|
|
|
auto Summaries = Index.findGlobalValueSummaryList(GUID);
|
|
|
|
if (Summaries == Index.end())
|
|
|
|
return true;
|
|
|
|
if (Summaries->second.size() != 1)
|
|
|
|
// If there are multiple globals with this GUID, then we know it is
|
|
|
|
// not a local symbol, and it is necessarily externally referenced.
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// We don't need to check for the module path, because if it can't be
|
|
|
|
// externally referenced and we call it, it is necessarilly in the same
|
|
|
|
// module
|
|
|
|
return canBeExternallyReferenced(**Summaries->second.begin());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return true if the global described by \p Summary can be imported in another
|
|
|
|
// module.
|
|
|
|
static bool eligibleForImport(const ModuleSummaryIndex &Index,
|
|
|
|
const GlobalValueSummary &Summary) {
|
|
|
|
if (!canBeExternallyReferenced(Summary))
|
|
|
|
// Can't import a global that needs renaming if has a section for instance.
|
|
|
|
// FIXME: we may be able to import it by copying it without promotion.
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Check references (and potential calls) in the same module. If the current
|
|
|
|
// value references a global that can't be externally referenced it is not
|
|
|
|
// eligible for import.
|
|
|
|
bool AllRefsCanBeExternallyReferenced =
|
|
|
|
llvm::all_of(Summary.refs(), [&](const ValueInfo &VI) {
|
|
|
|
return canBeExternallyReferenced(Index, VI.getGUID());
|
|
|
|
});
|
|
|
|
if (!AllRefsCanBeExternallyReferenced)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (auto *FuncSummary = dyn_cast<FunctionSummary>(&Summary)) {
|
|
|
|
bool AllCallsCanBeExternallyReferenced = llvm::all_of(
|
|
|
|
FuncSummary->calls(), [&](const FunctionSummary::EdgeTy &Edge) {
|
|
|
|
return canBeExternallyReferenced(Index, Edge.first.getGUID());
|
|
|
|
});
|
|
|
|
if (!AllCallsCanBeExternallyReferenced)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
/// Given a list of possible callee implementation for a call site, select one
|
|
|
|
/// that fits the \p Threshold.
|
|
|
|
///
|
|
|
|
/// FIXME: select "best" instead of first that fits. But what is "best"?
|
|
|
|
/// - The smallest: more likely to be inlined.
|
|
|
|
/// - The one with the least outgoing edges (already well optimized).
|
|
|
|
/// - One from a module already being imported from in order to reduce the
|
|
|
|
/// number of source modules parsed/linked.
|
|
|
|
/// - One that has PGO data attached.
|
|
|
|
/// - [insert you fancy metric here]
|
2016-04-16 14:56:44 +08:00
|
|
|
static const GlobalValueSummary *
|
2016-04-27 08:32:13 +08:00
|
|
|
selectCallee(const ModuleSummaryIndex &Index,
|
|
|
|
const GlobalValueSummaryList &CalleeSummaryList,
|
2016-04-24 22:57:11 +08:00
|
|
|
unsigned Threshold) {
|
2016-03-26 13:40:34 +08:00
|
|
|
auto It = llvm::find_if(
|
2016-04-24 22:57:11 +08:00
|
|
|
CalleeSummaryList,
|
|
|
|
[&](const std::unique_ptr<GlobalValueSummary> &SummaryPtr) {
|
|
|
|
auto *GVSummary = SummaryPtr.get();
|
2016-05-11 09:26:06 +08:00
|
|
|
if (GlobalValue::isInterposableLinkage(GVSummary->linkage()))
|
2016-05-03 08:27:28 +08:00
|
|
|
// There is no point in importing these, we can't inline them
|
2016-04-20 12:17:36 +08:00
|
|
|
return false;
|
|
|
|
if (auto *AS = dyn_cast<AliasSummary>(GVSummary)) {
|
2016-04-16 14:56:44 +08:00
|
|
|
GVSummary = &AS->getAliasee();
|
2016-04-20 12:17:36 +08:00
|
|
|
// Alias can't point to "available_externally". However when we import
|
|
|
|
// linkOnceODR the linkage does not change. So we import the alias
|
|
|
|
// and aliasee only in this case.
|
|
|
|
// FIXME: we should import alias as available_externally *function*,
|
|
|
|
// the destination module does need to know it is an alias.
|
|
|
|
if (!GlobalValue::isLinkOnceODRLinkage(GVSummary->linkage()))
|
|
|
|
return false;
|
|
|
|
}
|
2016-03-26 13:40:34 +08:00
|
|
|
|
2016-04-20 12:17:36 +08:00
|
|
|
auto *Summary = cast<FunctionSummary>(GVSummary);
|
2016-03-26 13:40:34 +08:00
|
|
|
|
|
|
|
if (Summary->instCount() > Threshold)
|
|
|
|
return false;
|
|
|
|
|
2016-04-27 08:32:13 +08:00
|
|
|
if (!eligibleForImport(Index, *Summary))
|
|
|
|
return false;
|
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
return true;
|
|
|
|
});
|
2016-04-24 22:57:11 +08:00
|
|
|
if (It == CalleeSummaryList.end())
|
2016-03-26 13:40:34 +08:00
|
|
|
return nullptr;
|
2015-12-09 16:17:35 +08:00
|
|
|
|
2016-04-24 22:57:11 +08:00
|
|
|
return cast<GlobalValueSummary>(It->get());
|
2016-03-26 13:40:34 +08:00
|
|
|
}
|
2015-12-09 16:17:35 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
/// Return the summary for the function \p GUID that fits the \p Threshold, or
|
|
|
|
/// null if there's no match.
|
2016-04-16 14:56:44 +08:00
|
|
|
static const GlobalValueSummary *selectCallee(GlobalValue::GUID GUID,
|
|
|
|
unsigned Threshold,
|
|
|
|
const ModuleSummaryIndex &Index) {
|
2016-04-24 22:57:11 +08:00
|
|
|
auto CalleeSummaryList = Index.findGlobalValueSummaryList(GUID);
|
2016-04-27 08:32:13 +08:00
|
|
|
if (CalleeSummaryList == Index.end())
|
2016-03-26 13:40:34 +08:00
|
|
|
return nullptr; // This function does not have a summary
|
2016-04-27 08:32:13 +08:00
|
|
|
return selectCallee(Index, CalleeSummaryList->second, Threshold);
|
2015-12-09 16:17:35 +08:00
|
|
|
}
|
|
|
|
|
2016-04-24 07:29:24 +08:00
|
|
|
/// Mark the global \p GUID as export by module \p ExportModulePath if found in
|
|
|
|
/// this module. If it is a GlobalVariable, we also mark any referenced global
|
|
|
|
/// in the current module as exported.
|
|
|
|
static void exportGlobalInModule(const ModuleSummaryIndex &Index,
|
|
|
|
StringRef ExportModulePath,
|
|
|
|
GlobalValue::GUID GUID,
|
|
|
|
FunctionImporter::ExportSetTy &ExportList) {
|
2016-04-24 22:57:11 +08:00
|
|
|
auto FindGlobalSummaryInModule =
|
|
|
|
[&](GlobalValue::GUID GUID) -> GlobalValueSummary *{
|
|
|
|
auto SummaryList = Index.findGlobalValueSummaryList(GUID);
|
|
|
|
if (SummaryList == Index.end())
|
2016-04-24 07:29:24 +08:00
|
|
|
// This global does not have a summary, it is not part of the ThinLTO
|
|
|
|
// process
|
|
|
|
return nullptr;
|
2016-04-24 22:57:11 +08:00
|
|
|
auto SummaryIter = llvm::find_if(
|
|
|
|
SummaryList->second,
|
|
|
|
[&](const std::unique_ptr<GlobalValueSummary> &Summary) {
|
2016-04-24 07:29:24 +08:00
|
|
|
return Summary->modulePath() == ExportModulePath;
|
|
|
|
});
|
2016-04-24 22:57:11 +08:00
|
|
|
if (SummaryIter == SummaryList->second.end())
|
2016-04-24 07:29:24 +08:00
|
|
|
return nullptr;
|
2016-04-24 22:57:11 +08:00
|
|
|
return SummaryIter->get();
|
2016-04-24 07:29:24 +08:00
|
|
|
};
|
|
|
|
|
2016-04-24 22:57:11 +08:00
|
|
|
auto *Summary = FindGlobalSummaryInModule(GUID);
|
|
|
|
if (!Summary)
|
2016-04-24 07:29:24 +08:00
|
|
|
return;
|
|
|
|
// We found it in the current module, mark as exported
|
|
|
|
ExportList.insert(GUID);
|
|
|
|
|
|
|
|
auto GVS = dyn_cast<GlobalVarSummary>(Summary);
|
|
|
|
if (!GVS)
|
|
|
|
return;
|
|
|
|
// FunctionImportGlobalProcessing::doPromoteLocalToGlobal() will always
|
|
|
|
// trigger importing the initializer for `constant unnamed addr` globals that
|
|
|
|
// are referenced. We conservatively export all the referenced symbols for
|
|
|
|
// every global to workaround this, so that the ExportList is accurate.
|
|
|
|
// FIXME: with a "isConstant" flag in the summary we could be more targetted.
|
|
|
|
for (auto &Ref : GVS->refs()) {
|
|
|
|
auto GUID = Ref.getGUID();
|
2016-04-24 22:57:11 +08:00
|
|
|
auto *RefSummary = FindGlobalSummaryInModule(GUID);
|
|
|
|
if (RefSummary)
|
2016-04-24 07:29:24 +08:00
|
|
|
// Found a ref in the current module, mark it as exported
|
|
|
|
ExportList.insert(GUID);
|
|
|
|
}
|
2015-11-25 05:15:19 +08:00
|
|
|
}
|
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
using EdgeInfo = std::pair<const FunctionSummary *, unsigned /* Threshold */>;
|
|
|
|
|
|
|
|
/// Compute the list of functions to import for a given caller. Mark these
|
|
|
|
/// imported functions and the symbols they reference in their source module as
|
|
|
|
/// exported from their source module.
|
|
|
|
static void computeImportForFunction(
|
2016-04-10 23:17:26 +08:00
|
|
|
const FunctionSummary &Summary, const ModuleSummaryIndex &Index,
|
2016-04-26 05:09:51 +08:00
|
|
|
unsigned Threshold, const GVSummaryMapTy &DefinedGVSummaries,
|
2016-03-26 13:40:34 +08:00
|
|
|
SmallVectorImpl<EdgeInfo> &Worklist,
|
|
|
|
FunctionImporter::ImportMapTy &ImportsForModule,
|
2016-04-13 05:13:11 +08:00
|
|
|
StringMap<FunctionImporter::ExportSetTy> *ExportLists = nullptr) {
|
2016-03-26 13:40:34 +08:00
|
|
|
for (auto &Edge : Summary.calls()) {
|
2016-04-11 21:58:45 +08:00
|
|
|
auto GUID = Edge.first.getGUID();
|
2016-03-26 13:40:34 +08:00
|
|
|
DEBUG(dbgs() << " edge -> " << GUID << " Threshold:" << Threshold << "\n");
|
|
|
|
|
2016-04-16 15:02:16 +08:00
|
|
|
if (DefinedGVSummaries.count(GUID)) {
|
2016-03-26 13:40:34 +08:00
|
|
|
DEBUG(dbgs() << "ignored! Target already in destination module.\n");
|
2015-11-24 14:07:49 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
auto *CalleeSummary = selectCallee(GUID, Threshold, Index);
|
|
|
|
if (!CalleeSummary) {
|
|
|
|
DEBUG(dbgs() << "ignored! No qualifying callee with summary found.\n");
|
2015-11-25 06:55:46 +08:00
|
|
|
continue;
|
|
|
|
}
|
2016-04-16 14:56:44 +08:00
|
|
|
// "Resolve" the summary, traversing alias,
|
|
|
|
const FunctionSummary *ResolvedCalleeSummary;
|
2016-04-20 09:04:20 +08:00
|
|
|
if (isa<AliasSummary>(CalleeSummary)) {
|
2016-04-16 14:56:44 +08:00
|
|
|
ResolvedCalleeSummary = cast<FunctionSummary>(
|
|
|
|
&cast<AliasSummary>(CalleeSummary)->getAliasee());
|
2016-04-20 12:17:36 +08:00
|
|
|
assert(
|
|
|
|
GlobalValue::isLinkOnceODRLinkage(ResolvedCalleeSummary->linkage()) &&
|
|
|
|
"Unexpected alias to a non-linkonceODR in import list");
|
2016-04-20 09:04:20 +08:00
|
|
|
} else
|
2016-04-16 14:56:44 +08:00
|
|
|
ResolvedCalleeSummary = cast<FunctionSummary>(CalleeSummary);
|
|
|
|
|
|
|
|
assert(ResolvedCalleeSummary->instCount() <= Threshold &&
|
2016-03-26 13:40:34 +08:00
|
|
|
"selectCallee() didn't honor the threshold");
|
|
|
|
|
2016-04-16 14:56:44 +08:00
|
|
|
auto ExportModulePath = ResolvedCalleeSummary->modulePath();
|
|
|
|
auto &ProcessedThreshold = ImportsForModule[ExportModulePath][GUID];
|
2016-03-26 13:40:34 +08:00
|
|
|
/// Since the traversal of the call graph is DFS, we can revisit a function
|
|
|
|
/// a second time with a higher threshold. In this case, it is added back to
|
|
|
|
/// the worklist with the new threshold.
|
|
|
|
if (ProcessedThreshold && ProcessedThreshold > Threshold) {
|
|
|
|
DEBUG(dbgs() << "ignored! Target was already seen with Threshold "
|
|
|
|
<< ProcessedThreshold << "\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// Mark this function as imported in this module, with the current Threshold
|
|
|
|
ProcessedThreshold = Threshold;
|
|
|
|
|
|
|
|
// Make exports in the source module.
|
2016-04-13 05:13:11 +08:00
|
|
|
if (ExportLists) {
|
2016-04-13 09:52:32 +08:00
|
|
|
auto &ExportList = (*ExportLists)[ExportModulePath];
|
2016-04-13 05:13:11 +08:00
|
|
|
ExportList.insert(GUID);
|
|
|
|
// Mark all functions and globals referenced by this function as exported
|
|
|
|
// to the outside if they are defined in the same source module.
|
2016-04-16 14:56:44 +08:00
|
|
|
for (auto &Edge : ResolvedCalleeSummary->calls()) {
|
2016-04-13 05:13:11 +08:00
|
|
|
auto CalleeGUID = Edge.first.getGUID();
|
2016-04-24 07:29:24 +08:00
|
|
|
exportGlobalInModule(Index, ExportModulePath, CalleeGUID, ExportList);
|
2016-04-13 05:13:11 +08:00
|
|
|
}
|
2016-04-16 14:56:44 +08:00
|
|
|
for (auto &Ref : ResolvedCalleeSummary->refs()) {
|
2016-04-13 05:13:11 +08:00
|
|
|
auto GUID = Ref.getGUID();
|
2016-04-24 07:29:24 +08:00
|
|
|
exportGlobalInModule(Index, ExportModulePath, GUID, ExportList);
|
2016-04-13 05:13:11 +08:00
|
|
|
}
|
2016-03-26 13:40:34 +08:00
|
|
|
}
|
2015-11-25 06:55:46 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
// Insert the newly imported function to the worklist.
|
2016-04-16 14:56:44 +08:00
|
|
|
Worklist.push_back(std::make_pair(ResolvedCalleeSummary, Threshold));
|
2016-03-26 13:40:34 +08:00
|
|
|
}
|
|
|
|
}
|
2016-02-11 07:31:45 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
/// Given the list of globals defined in a module, compute the list of imports
|
|
|
|
/// as well as the list of "exports", i.e. the list of symbols referenced from
|
|
|
|
/// another module (that may require promotion).
|
|
|
|
static void ComputeImportForModule(
|
2016-04-26 05:09:51 +08:00
|
|
|
const GVSummaryMapTy &DefinedGVSummaries, const ModuleSummaryIndex &Index,
|
2016-03-26 13:40:34 +08:00
|
|
|
FunctionImporter::ImportMapTy &ImportsForModule,
|
2016-04-13 05:13:11 +08:00
|
|
|
StringMap<FunctionImporter::ExportSetTy> *ExportLists = nullptr) {
|
2016-03-26 13:40:34 +08:00
|
|
|
// Worklist contains the list of function imported in this module, for which
|
|
|
|
// we will analyse the callees and may import further down the callgraph.
|
|
|
|
SmallVector<EdgeInfo, 128> Worklist;
|
|
|
|
|
|
|
|
// Populate the worklist with the import for the functions in the current
|
|
|
|
// module
|
2016-04-24 22:57:11 +08:00
|
|
|
for (auto &GVSummary : DefinedGVSummaries) {
|
|
|
|
auto *Summary = GVSummary.second;
|
2016-04-16 14:56:44 +08:00
|
|
|
if (auto *AS = dyn_cast<AliasSummary>(Summary))
|
|
|
|
Summary = &AS->getAliasee();
|
2016-04-16 15:02:16 +08:00
|
|
|
auto *FuncSummary = dyn_cast<FunctionSummary>(Summary);
|
|
|
|
if (!FuncSummary)
|
|
|
|
// Skip import for global variables
|
|
|
|
continue;
|
2016-04-24 22:57:11 +08:00
|
|
|
DEBUG(dbgs() << "Initalize import for " << GVSummary.first << "\n");
|
2016-04-16 14:56:44 +08:00
|
|
|
computeImportForFunction(*FuncSummary, Index, ImportInstrLimit,
|
2016-04-16 15:02:16 +08:00
|
|
|
DefinedGVSummaries, Worklist, ImportsForModule,
|
2016-03-26 13:40:34 +08:00
|
|
|
ExportLists);
|
|
|
|
}
|
2015-11-24 14:07:49 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
while (!Worklist.empty()) {
|
|
|
|
auto FuncInfo = Worklist.pop_back_val();
|
|
|
|
auto *Summary = FuncInfo.first;
|
|
|
|
auto Threshold = FuncInfo.second;
|
2015-11-24 14:07:49 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
// Process the newly imported functions and add callees to the worklist.
|
|
|
|
// Adjust the threshold
|
|
|
|
Threshold = Threshold * ImportInstrFactor;
|
2015-12-09 16:17:35 +08:00
|
|
|
|
2016-04-16 15:02:16 +08:00
|
|
|
computeImportForFunction(*Summary, Index, Threshold, DefinedGVSummaries,
|
2016-04-10 23:17:26 +08:00
|
|
|
Worklist, ImportsForModule, ExportLists);
|
2016-03-26 13:40:34 +08:00
|
|
|
}
|
|
|
|
}
|
2015-12-09 16:17:35 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
} // anonymous namespace
|
|
|
|
|
2016-04-13 05:13:11 +08:00
|
|
|
/// Compute all the import and export for every module using the Index.
|
2016-03-26 13:40:34 +08:00
|
|
|
void llvm::ComputeCrossModuleImport(
|
|
|
|
const ModuleSummaryIndex &Index,
|
2016-04-26 05:09:51 +08:00
|
|
|
const StringMap<GVSummaryMapTy> &ModuleToDefinedGVSummaries,
|
2016-03-26 13:40:34 +08:00
|
|
|
StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
|
|
|
StringMap<FunctionImporter::ExportSetTy> &ExportLists) {
|
|
|
|
// For each module that has function defined, compute the import/export lists.
|
2016-04-16 15:02:16 +08:00
|
|
|
for (auto &DefinedGVSummaries : ModuleToDefinedGVSummaries) {
|
|
|
|
auto &ImportsForModule = ImportLists[DefinedGVSummaries.first()];
|
|
|
|
DEBUG(dbgs() << "Computing import for Module '"
|
|
|
|
<< DefinedGVSummaries.first() << "'\n");
|
|
|
|
ComputeImportForModule(DefinedGVSummaries.second, Index, ImportsForModule,
|
2016-04-13 05:13:11 +08:00
|
|
|
&ExportLists);
|
2016-03-26 13:40:34 +08:00
|
|
|
}
|
2015-11-24 14:07:49 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
DEBUG(dbgs() << "Import/Export lists for " << ImportLists.size()
|
|
|
|
<< " modules:\n");
|
|
|
|
for (auto &ModuleImports : ImportLists) {
|
|
|
|
auto ModName = ModuleImports.first();
|
|
|
|
auto &Exports = ExportLists[ModName];
|
|
|
|
DEBUG(dbgs() << "* Module " << ModName << " exports " << Exports.size()
|
|
|
|
<< " functions. Imports from " << ModuleImports.second.size()
|
|
|
|
<< " modules.\n");
|
|
|
|
for (auto &Src : ModuleImports.second) {
|
|
|
|
auto SrcModName = Src.first();
|
|
|
|
DEBUG(dbgs() << " - " << Src.second.size() << " functions imported from "
|
|
|
|
<< SrcModName << "\n");
|
|
|
|
}
|
2015-12-03 10:37:33 +08:00
|
|
|
}
|
2016-03-26 13:40:34 +08:00
|
|
|
#endif
|
2015-12-03 10:37:33 +08:00
|
|
|
}
|
|
|
|
|
2016-04-13 05:13:11 +08:00
|
|
|
/// Compute all the imports for the given module in the Index.
|
|
|
|
void llvm::ComputeCrossModuleImportForModule(
|
|
|
|
StringRef ModulePath, const ModuleSummaryIndex &Index,
|
|
|
|
FunctionImporter::ImportMapTy &ImportList) {
|
|
|
|
|
|
|
|
// Collect the list of functions this module defines.
|
|
|
|
// GUID -> Summary
|
2016-04-26 05:09:51 +08:00
|
|
|
GVSummaryMapTy FunctionSummaryMap;
|
2016-04-24 22:57:11 +08:00
|
|
|
Index.collectDefinedFunctionsForModule(ModulePath, FunctionSummaryMap);
|
2016-04-13 05:13:11 +08:00
|
|
|
|
|
|
|
// Compute the import list for this module.
|
|
|
|
DEBUG(dbgs() << "Computing import for Module '" << ModulePath << "'\n");
|
2016-04-24 22:57:11 +08:00
|
|
|
ComputeImportForModule(FunctionSummaryMap, Index, ImportList);
|
2016-04-13 05:13:11 +08:00
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
DEBUG(dbgs() << "* Module " << ModulePath << " imports from "
|
|
|
|
<< ImportList.size() << " modules.\n");
|
|
|
|
for (auto &Src : ImportList) {
|
|
|
|
auto SrcModName = Src.first();
|
|
|
|
DEBUG(dbgs() << " - " << Src.second.size() << " functions imported from "
|
|
|
|
<< SrcModName << "\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-05-10 21:48:23 +08:00
|
|
|
/// Compute the set of summaries needed for a ThinLTO backend compilation of
|
|
|
|
/// \p ModulePath.
|
|
|
|
void llvm::gatherImportedSummariesForModule(
|
|
|
|
StringRef ModulePath,
|
|
|
|
const StringMap<GVSummaryMapTy> &ModuleToDefinedGVSummaries,
|
|
|
|
const StringMap<FunctionImporter::ImportMapTy> &ImportLists,
|
|
|
|
std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex) {
|
|
|
|
// Include all summaries from the importing module.
|
|
|
|
ModuleToSummariesForIndex[ModulePath] =
|
|
|
|
ModuleToDefinedGVSummaries.lookup(ModulePath);
|
|
|
|
auto ModuleImports = ImportLists.find(ModulePath);
|
|
|
|
if (ModuleImports != ImportLists.end()) {
|
|
|
|
// Include summaries for imports.
|
|
|
|
for (auto &ILI : ModuleImports->second) {
|
|
|
|
auto &SummariesForIndex = ModuleToSummariesForIndex[ILI.first()];
|
|
|
|
const auto &DefinedGVSummaries =
|
|
|
|
ModuleToDefinedGVSummaries.lookup(ILI.first());
|
|
|
|
for (auto &GI : ILI.second) {
|
|
|
|
const auto &DS = DefinedGVSummaries.find(GI.first);
|
|
|
|
assert(DS != DefinedGVSummaries.end() &&
|
|
|
|
"Expected a defined summary for imported global value");
|
|
|
|
SummariesForIndex[GI.first] = DS->second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-10 23:54:09 +08:00
|
|
|
/// Emit the files \p ModulePath will import from into \p OutputFilename.
|
|
|
|
std::error_code llvm::EmitImportsFiles(
|
|
|
|
StringRef ModulePath, StringRef OutputFilename,
|
|
|
|
const StringMap<FunctionImporter::ImportMapTy> &ImportLists) {
|
|
|
|
auto ModuleImports = ImportLists.find(ModulePath);
|
|
|
|
std::error_code EC;
|
|
|
|
raw_fd_ostream ImportsOS(OutputFilename, EC, sys::fs::OpenFlags::F_None);
|
|
|
|
if (EC)
|
|
|
|
return EC;
|
|
|
|
if (ModuleImports != ImportLists.end())
|
|
|
|
for (auto &ILI : ModuleImports->second)
|
|
|
|
ImportsOS << ILI.first() << "\n";
|
|
|
|
return std::error_code();
|
|
|
|
}
|
|
|
|
|
2015-12-03 10:37:33 +08:00
|
|
|
// Automatically import functions in Module \p DestModule based on the summaries
|
|
|
|
// index.
|
|
|
|
//
|
2016-03-26 13:40:34 +08:00
|
|
|
bool FunctionImporter::importFunctions(
|
2016-04-21 09:59:39 +08:00
|
|
|
Module &DestModule, const FunctionImporter::ImportMapTy &ImportList,
|
|
|
|
bool ForceImportReferencedDiscardableSymbols) {
|
2015-12-09 07:04:19 +08:00
|
|
|
DEBUG(dbgs() << "Starting import for Module "
|
2015-12-03 10:58:14 +08:00
|
|
|
<< DestModule.getModuleIdentifier() << "\n");
|
2015-12-03 10:37:33 +08:00
|
|
|
unsigned ImportedCount = 0;
|
2015-11-24 14:07:49 +08:00
|
|
|
|
2015-12-03 10:37:33 +08:00
|
|
|
// Linker that will be used for importing function
|
2015-12-15 07:17:03 +08:00
|
|
|
Linker TheLinker(DestModule);
|
2015-12-09 16:17:35 +08:00
|
|
|
// Do the actual import of functions now, one Module at a time
|
2016-03-26 13:40:34 +08:00
|
|
|
std::set<StringRef> ModuleNameOrderedList;
|
|
|
|
for (auto &FunctionsToImportPerModule : ImportList) {
|
|
|
|
ModuleNameOrderedList.insert(FunctionsToImportPerModule.first());
|
|
|
|
}
|
|
|
|
for (auto &Name : ModuleNameOrderedList) {
|
2015-12-09 16:17:35 +08:00
|
|
|
// Get the module for the import
|
2016-03-26 13:40:34 +08:00
|
|
|
const auto &FunctionsToImportPerModule = ImportList.find(Name);
|
|
|
|
assert(FunctionsToImportPerModule != ImportList.end());
|
|
|
|
std::unique_ptr<Module> SrcModule = ModuleLoader(Name);
|
2015-12-09 16:17:35 +08:00
|
|
|
assert(&DestModule.getContext() == &SrcModule->getContext() &&
|
|
|
|
"Context mismatch");
|
|
|
|
|
2016-01-22 08:15:53 +08:00
|
|
|
// If modules were created with lazy metadata loading, materialize it
|
|
|
|
// now, before linking it (otherwise this will be a noop).
|
|
|
|
SrcModule->materializeMetadata();
|
|
|
|
UpgradeDebugInfo(*SrcModule);
|
2015-12-18 01:14:09 +08:00
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
auto &ImportGUIDs = FunctionsToImportPerModule->second;
|
|
|
|
// Find the globals to import
|
|
|
|
DenseSet<const GlobalValue *> GlobalsToImport;
|
|
|
|
for (auto &GV : *SrcModule) {
|
2016-04-05 02:52:23 +08:00
|
|
|
if (!GV.hasName())
|
|
|
|
continue;
|
|
|
|
auto GUID = GV.getGUID();
|
|
|
|
auto Import = ImportGUIDs.count(GUID);
|
2016-04-19 17:21:30 +08:00
|
|
|
DEBUG(dbgs() << (Import ? "Is" : "Not") << " importing function " << GUID
|
|
|
|
<< " " << GV.getName() << " from "
|
|
|
|
<< SrcModule->getSourceFileName() << "\n");
|
2016-04-05 02:52:23 +08:00
|
|
|
if (Import) {
|
2016-03-26 13:40:34 +08:00
|
|
|
GV.materialize();
|
|
|
|
GlobalsToImport.insert(&GV);
|
|
|
|
}
|
|
|
|
}
|
2016-04-16 14:56:44 +08:00
|
|
|
for (auto &GV : SrcModule->globals()) {
|
2016-03-26 13:40:34 +08:00
|
|
|
if (!GV.hasName())
|
|
|
|
continue;
|
|
|
|
auto GUID = GV.getGUID();
|
2016-04-05 02:52:23 +08:00
|
|
|
auto Import = ImportGUIDs.count(GUID);
|
2016-04-19 17:21:30 +08:00
|
|
|
DEBUG(dbgs() << (Import ? "Is" : "Not") << " importing global " << GUID
|
|
|
|
<< " " << GV.getName() << " from "
|
|
|
|
<< SrcModule->getSourceFileName() << "\n");
|
2016-04-05 02:52:23 +08:00
|
|
|
if (Import) {
|
2016-03-27 23:01:11 +08:00
|
|
|
GV.materialize();
|
|
|
|
GlobalsToImport.insert(&GV);
|
2016-03-26 13:40:34 +08:00
|
|
|
}
|
|
|
|
}
|
2016-04-16 14:56:44 +08:00
|
|
|
for (auto &GV : SrcModule->aliases()) {
|
2016-03-26 13:40:34 +08:00
|
|
|
if (!GV.hasName())
|
|
|
|
continue;
|
2016-03-29 22:49:26 +08:00
|
|
|
auto GUID = GV.getGUID();
|
2016-04-05 02:52:23 +08:00
|
|
|
auto Import = ImportGUIDs.count(GUID);
|
2016-04-19 17:21:30 +08:00
|
|
|
DEBUG(dbgs() << (Import ? "Is" : "Not") << " importing alias " << GUID
|
|
|
|
<< " " << GV.getName() << " from "
|
|
|
|
<< SrcModule->getSourceFileName() << "\n");
|
2016-04-05 02:52:23 +08:00
|
|
|
if (Import) {
|
2016-04-16 14:56:44 +08:00
|
|
|
// Alias can't point to "available_externally". However when we import
|
|
|
|
// linkOnceODR the linkage does not change. So we import the alias
|
2016-04-20 09:04:20 +08:00
|
|
|
// and aliasee only in this case. This has been handled by
|
|
|
|
// computeImportForFunction()
|
2016-04-16 14:56:44 +08:00
|
|
|
GlobalObject *GO = GV.getBaseObject();
|
2016-04-20 09:04:20 +08:00
|
|
|
assert(GO->hasLinkOnceODRLinkage() &&
|
|
|
|
"Unexpected alias to a non-linkonceODR in import list");
|
2016-04-16 14:56:44 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
if (!GlobalsToImport.count(GO))
|
|
|
|
DEBUG(dbgs() << " alias triggers importing aliasee " << GO->getGUID()
|
|
|
|
<< " " << GO->getName() << " from "
|
|
|
|
<< SrcModule->getSourceFileName() << "\n");
|
|
|
|
#endif
|
|
|
|
GO->materialize();
|
|
|
|
GlobalsToImport.insert(GO);
|
2016-03-26 13:40:34 +08:00
|
|
|
GV.materialize();
|
|
|
|
GlobalsToImport.insert(&GV);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-09 16:17:35 +08:00
|
|
|
// Link in the specified functions.
|
2016-03-26 13:40:34 +08:00
|
|
|
if (renameModuleForThinLTO(*SrcModule, Index, &GlobalsToImport))
|
2016-03-19 08:40:31 +08:00
|
|
|
return true;
|
|
|
|
|
2016-03-27 23:27:30 +08:00
|
|
|
if (PrintImports) {
|
|
|
|
for (const auto *GV : GlobalsToImport)
|
|
|
|
dbgs() << DestModule.getSourceFileName() << ": Import " << GV->getName()
|
|
|
|
<< " from " << SrcModule->getSourceFileName() << "\n";
|
|
|
|
}
|
|
|
|
|
2016-04-21 09:59:39 +08:00
|
|
|
// Instruct the linker that the client will take care of linkonce resolution
|
|
|
|
unsigned Flags = Linker::Flags::None;
|
|
|
|
if (!ForceImportReferencedDiscardableSymbols)
|
|
|
|
Flags |= Linker::Flags::DontForceLinkLinkonceODR;
|
|
|
|
|
|
|
|
if (TheLinker.linkInModule(std::move(SrcModule), Flags, &GlobalsToImport))
|
2015-12-09 16:17:35 +08:00
|
|
|
report_fatal_error("Function Import: link error");
|
|
|
|
|
2016-03-26 13:40:34 +08:00
|
|
|
ImportedCount += GlobalsToImport.size();
|
2015-12-09 16:17:35 +08:00
|
|
|
}
|
2015-12-18 01:14:09 +08:00
|
|
|
|
2016-03-27 23:27:30 +08:00
|
|
|
NumImported += ImportedCount;
|
|
|
|
|
2015-12-09 16:17:35 +08:00
|
|
|
DEBUG(dbgs() << "Imported " << ImportedCount << " functions for Module "
|
2015-12-03 10:37:33 +08:00
|
|
|
<< DestModule.getModuleIdentifier() << "\n");
|
|
|
|
return ImportedCount;
|
2015-11-24 14:07:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Summary file to use for function importing when using -function-import from
|
|
|
|
/// the command line.
|
|
|
|
static cl::opt<std::string>
|
|
|
|
SummaryFile("summary-file",
|
|
|
|
cl::desc("The summary file to use for function importing."));
|
|
|
|
|
|
|
|
static void diagnosticHandler(const DiagnosticInfo &DI) {
|
|
|
|
raw_ostream &OS = errs();
|
|
|
|
DiagnosticPrinterRawOStream DP(OS);
|
|
|
|
DI.print(DP);
|
|
|
|
OS << '\n';
|
|
|
|
}
|
|
|
|
|
2016-03-15 08:04:37 +08:00
|
|
|
/// Parse the summary index out of an IR file and return the summary
|
2015-11-24 14:07:49 +08:00
|
|
|
/// index object if found, or nullptr if not.
|
2016-03-15 08:04:37 +08:00
|
|
|
static std::unique_ptr<ModuleSummaryIndex>
|
|
|
|
getModuleSummaryIndexForFile(StringRef Path, std::string &Error,
|
|
|
|
DiagnosticHandlerFunction DiagnosticHandler) {
|
2015-11-24 14:07:49 +08:00
|
|
|
std::unique_ptr<MemoryBuffer> Buffer;
|
|
|
|
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
|
|
|
|
MemoryBuffer::getFile(Path);
|
|
|
|
if (std::error_code EC = BufferOrErr.getError()) {
|
|
|
|
Error = EC.message();
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
Buffer = std::move(BufferOrErr.get());
|
2016-03-15 08:04:37 +08:00
|
|
|
ErrorOr<std::unique_ptr<object::ModuleSummaryIndexObjectFile>> ObjOrErr =
|
|
|
|
object::ModuleSummaryIndexObjectFile::create(Buffer->getMemBufferRef(),
|
|
|
|
DiagnosticHandler);
|
2015-11-24 14:07:49 +08:00
|
|
|
if (std::error_code EC = ObjOrErr.getError()) {
|
|
|
|
Error = EC.message();
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return (*ObjOrErr)->takeIndex();
|
|
|
|
}
|
|
|
|
|
2015-12-24 18:03:35 +08:00
|
|
|
namespace {
|
2015-11-24 14:07:49 +08:00
|
|
|
/// Pass that performs cross-module function import provided a summary file.
|
|
|
|
class FunctionImportPass : public ModulePass {
|
2016-03-15 08:04:37 +08:00
|
|
|
/// Optional module summary index to use for importing, otherwise
|
2015-12-08 03:21:11 +08:00
|
|
|
/// the summary-file option must be specified.
|
2016-03-15 08:04:37 +08:00
|
|
|
const ModuleSummaryIndex *Index;
|
2015-11-24 14:07:49 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/// Pass identification, replacement for typeid
|
|
|
|
static char ID;
|
|
|
|
|
2015-12-08 03:21:11 +08:00
|
|
|
/// Specify pass name for debug output
|
2016-04-16 14:56:44 +08:00
|
|
|
const char *getPassName() const override { return "Function Importing"; }
|
2015-12-08 03:21:11 +08:00
|
|
|
|
2016-03-15 08:04:37 +08:00
|
|
|
explicit FunctionImportPass(const ModuleSummaryIndex *Index = nullptr)
|
2015-12-08 03:21:11 +08:00
|
|
|
: ModulePass(ID), Index(Index) {}
|
2015-11-24 14:07:49 +08:00
|
|
|
|
|
|
|
bool runOnModule(Module &M) override {
|
2016-04-23 06:06:11 +08:00
|
|
|
if (skipModule(M))
|
|
|
|
return false;
|
|
|
|
|
2015-12-08 03:21:11 +08:00
|
|
|
if (SummaryFile.empty() && !Index)
|
|
|
|
report_fatal_error("error: -function-import requires -summary-file or "
|
|
|
|
"file from frontend\n");
|
2016-03-15 08:04:37 +08:00
|
|
|
std::unique_ptr<ModuleSummaryIndex> IndexPtr;
|
2015-12-08 03:21:11 +08:00
|
|
|
if (!SummaryFile.empty()) {
|
|
|
|
if (Index)
|
|
|
|
report_fatal_error("error: -summary-file and index from frontend\n");
|
|
|
|
std::string Error;
|
2016-03-15 08:04:37 +08:00
|
|
|
IndexPtr =
|
|
|
|
getModuleSummaryIndexForFile(SummaryFile, Error, diagnosticHandler);
|
2015-12-08 03:21:11 +08:00
|
|
|
if (!IndexPtr) {
|
|
|
|
errs() << "Error loading file '" << SummaryFile << "': " << Error
|
|
|
|
<< "\n";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
Index = IndexPtr.get();
|
2015-11-24 14:07:49 +08:00
|
|
|
}
|
|
|
|
|
2016-04-13 05:13:11 +08:00
|
|
|
// First step is collecting the import list.
|
|
|
|
FunctionImporter::ImportMapTy ImportList;
|
|
|
|
ComputeCrossModuleImportForModule(M.getModuleIdentifier(), *Index,
|
|
|
|
ImportList);
|
2016-03-26 13:40:34 +08:00
|
|
|
|
|
|
|
// Next we need to promote to global scope and rename any local values that
|
2016-01-09 01:06:29 +08:00
|
|
|
// are potentially exported to other modules.
|
2016-03-26 13:40:34 +08:00
|
|
|
if (renameModuleForThinLTO(M, *Index, nullptr)) {
|
2016-01-09 01:06:29 +08:00
|
|
|
errs() << "Error renaming module\n";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-11-24 14:07:49 +08:00
|
|
|
// Perform the import now.
|
2015-12-09 06:39:40 +08:00
|
|
|
auto ModuleLoader = [&M](StringRef Identifier) {
|
|
|
|
return loadFile(Identifier, M.getContext());
|
|
|
|
};
|
2015-12-15 07:17:03 +08:00
|
|
|
FunctionImporter Importer(*Index, ModuleLoader);
|
2016-04-21 09:59:39 +08:00
|
|
|
return Importer.importFunctions(
|
|
|
|
M, ImportList, !DontForceImportReferencedDiscardableSymbols);
|
2015-11-24 14:07:49 +08:00
|
|
|
}
|
|
|
|
};
|
2015-12-24 18:03:35 +08:00
|
|
|
} // anonymous namespace
|
2015-11-24 14:07:49 +08:00
|
|
|
|
|
|
|
char FunctionImportPass::ID = 0;
|
|
|
|
INITIALIZE_PASS_BEGIN(FunctionImportPass, "function-import",
|
|
|
|
"Summary Based Function Import", false, false)
|
|
|
|
INITIALIZE_PASS_END(FunctionImportPass, "function-import",
|
|
|
|
"Summary Based Function Import", false, false)
|
|
|
|
|
|
|
|
namespace llvm {
|
2016-03-15 08:04:37 +08:00
|
|
|
Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr) {
|
2015-12-08 03:21:11 +08:00
|
|
|
return new FunctionImportPass(Index);
|
|
|
|
}
|
2015-11-24 14:07:49 +08:00
|
|
|
}
|