Skip to content

InlineCostAnnotationPrinter: Fix constructing random TargetTransformInfo #133637

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
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
11 changes: 7 additions & 4 deletions llvm/lib/Analysis/InlineCost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3295,9 +3295,12 @@ InlineCostAnnotationPrinterPass::run(Function &F,
[&](Function &F) -> AssumptionCache & {
return FAM.getResult<AssumptionAnalysis>(F);
};
Module *M = F.getParent();
ProfileSummaryInfo PSI(*M);
TargetTransformInfo TTI(M->getDataLayout());

auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
ProfileSummaryInfo *PSI =
MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
const TargetTransformInfo &TTI = FAM.getResult<TargetIRAnalysis>(F);

// FIXME: Redesign the usage of InlineParams to expand the scope of this pass.
// In the current implementation, the type of InlineParams doesn't matter as
// the pass serves only for verification of inliner's decisions.
Expand All @@ -3312,7 +3315,7 @@ InlineCostAnnotationPrinterPass::run(Function &F,
continue;
OptimizationRemarkEmitter ORE(CalledFunction);
InlineCostCallAnalyzer ICCA(*CalledFunction, *CB, Params, TTI,
GetAssumptionCache, nullptr, nullptr, &PSI,
GetAssumptionCache, nullptr, nullptr, PSI,
&ORE);
ICCA.analyze();
OS << " Analyzing call of " << CalledFunction->getName()
Expand Down
Loading