Skip to content

[ctxprof][nfc] Make computeImportForFunction a member of ModuleImportsManager #134011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions llvm/lib/Transforms/IPO/FunctionImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,13 @@ static const char *getFailureName(FunctionImporter::ImportFailureReason Reason);

/// Determine the list of imports and exports for each module.
class ModuleImportsManager {
void computeImportForFunction(
const FunctionSummary &Summary, unsigned Threshold,
const GVSummaryMapTy &DefinedGVSummaries,
SmallVectorImpl<EdgeInfo> &Worklist, GlobalsImporter &GVImporter,
FunctionImporter::ImportMapTy &ImportList,
FunctionImporter::ImportThresholdsTy &ImportThresholds);

protected:
function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
IsPrevailing;
Expand Down Expand Up @@ -852,14 +859,11 @@ getFailureName(FunctionImporter::ImportFailureReason Reason) {
/// 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(
const FunctionSummary &Summary, const ModuleSummaryIndex &Index,
const unsigned Threshold, const GVSummaryMapTy &DefinedGVSummaries,
function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
isPrevailing,
void ModuleImportsManager::computeImportForFunction(
const FunctionSummary &Summary, const unsigned Threshold,
const GVSummaryMapTy &DefinedGVSummaries,
SmallVectorImpl<EdgeInfo> &Worklist, GlobalsImporter &GVImporter,
FunctionImporter::ImportMapTy &ImportList,
DenseMap<StringRef, FunctionImporter::ExportSetTy> *ExportLists,
FunctionImporter::ImportThresholdsTy &ImportThresholds) {
GVImporter.onImportingSummary(Summary);
static int ImportCount = 0;
Expand Down Expand Up @@ -1064,9 +1068,8 @@ void ModuleImportsManager::computeImportForModule(
// Skip import for global variables
continue;
LLVM_DEBUG(dbgs() << "Initialize import for " << VI << "\n");
computeImportForFunction(*FuncSummary, Index, ImportInstrLimit,
DefinedGVSummaries, IsPrevailing, Worklist, GVI,
ImportList, ExportLists, ImportThresholds);
computeImportForFunction(*FuncSummary, ImportInstrLimit, DefinedGVSummaries,
Worklist, GVI, ImportList, ImportThresholds);
}

// Process the newly imported functions and add callees to the worklist.
Expand All @@ -1076,9 +1079,8 @@ void ModuleImportsManager::computeImportForModule(
auto Threshold = std::get<1>(GVInfo);

if (auto *FS = dyn_cast<FunctionSummary>(Summary))
computeImportForFunction(*FS, Index, Threshold, DefinedGVSummaries,
IsPrevailing, Worklist, GVI, ImportList,
ExportLists, ImportThresholds);
computeImportForFunction(*FS, Threshold, DefinedGVSummaries, Worklist,
GVI, ImportList, ImportThresholds);
}

// Print stats about functions considered but rejected for importing
Expand Down
Loading