Lines Matching +full:positive +full:- +full:phase
1 //===- InlineAdvisor.cpp - analysis pass implementation -------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
40 STATISTIC(NumCallerCallersAnalyzed, "Number of caller-callers analyzed");
42 /// Flag to add inline messages as callsite attributes 'inline-remark'.
44 InlineRemarkAttribute("inline-remark-attribute", cl::init(false),
46 cl::desc("Enable adding inline-remark attribute to"
50 static cl::opt<bool> EnableInlineDeferral("inline-deferral", cl::init(false),
57 InlineDeferralScale("inline-deferral-scale",
62 AnnotateInlinePhase("annotate-inline-phase", cl::Hidden, cl::init(false),
93 return OptimizationRemarkMissed(Advisor->getAnnotatedInlinePassName(),
113 return OptimizationRemarkMissed(Advisor->getAnnotatedInlinePassName(),
125 Advisor->getAnnotatedInlinePassName());
132 Advisor->getAnnotatedInlinePassName());
141 *CB.getParent()->getParent()->getParent());
144 auto GetAssumptionCache = [&](Function &F) -> AssumptionCache & {
147 auto GetBFI = [&](Function &F) -> BlockFrequencyInfo & {
150 auto GetTLI = [&](Function &F) -> const TargetLibraryInfo & {
158 Callee.getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled(
184 if (Advisor->ImportedFunctionsStats)
185 Advisor->ImportedFunctionsStats->recordInline(*Caller, *Callee);
231 LLVM_DEBUG(dbgs() << "Using development-mode inliner policy.\n");
236 LLVM_DEBUG(dbgs() << "Using release-mode inliner policy.\n");
253 if (!Caller->hasLocalLinkage() && !Caller->hasLinkOnceODRLinkage())
255 // If the cost of inlining CB is non-positive, it is not going to prevent the
261 // it B) is a static or linkonce-ODR function and is an inlining candidate
267 // This only applies to static and linkonce-ODR functions because those are
270 // decisions. Importantly the linkonce-ODR linkage covers inline functions
278 int CandidateCost = IC.getCost() - 1;
281 bool ApplyLastCallBonus = Caller->hasLocalLinkage() && !Caller->hasOneUse();
285 for (User *U : Caller->users()) {
291 if (!CS2 || CS2->getCalledFunction() != Caller) {
323 TotalSecondaryCost -= InlineConstants::LastCallToStaticBonus;
326 // inlining -- IC.getCost() multiplied by the number of callers to Caller.
368 Attribute Attr = Attribute::get(CB.getContext(), "inline-remark", Message);
442 for (DILocation *DIL = DLoc.get(); DIL; DIL = DIL->getInlinedAt()) {
449 DIL->getLine() - DIL->getScope()->getSubprogram()->getLine();
450 uint32_t Discriminator = DIL->getBaseDiscriminator();
451 StringRef Name = DIL->getScope()->getSubprogram()->getLinkageName();
453 Name = DIL->getScope()->getSubprogram()->getName();
456 CallSiteLoc << ":" << llvm::utostr(DIL->getColumn());
472 for (DILocation *DIL = DLoc.get(); DIL; DIL = DIL->getInlinedAt()) {
475 unsigned int Offset = DIL->getLine();
476 Offset -= DIL->getScope()->getSubprogram()->getLine();
477 unsigned int Discriminator = DIL->getBaseDiscriminator();
478 StringRef Name = DIL->getScope()->getSubprogram()->getLinkageName();
480 Name = DIL->getScope()->getSubprogram()->getName();
482 << ore::NV("Column", DIL->getColumn());
532 ImportedFunctionsStats->setModuleInfo(M);
539 ImportedFunctionsStats->dump(InlinerFunctionImportStats ==
567 return "always-inline";
569 return "cgscc-inline";
571 return "early-inline";
573 return "ml-inline";
575 return "module-inline";
577 return "replay-cgscc-inline";
579 return "replay-sample-profile-inline";
581 return "sample-profile-inline";
588 return std::string(getLTOPhase(IC.LTOPhase)) + "-" +
597 auto GetTLI = [&](Function &F) -> const TargetLibraryInfo & {
607 if (TrivialDecision->isSuccess())
635 IA->getAdvisor()->print(OS);
649 Module &M = *InitialC.begin()->getFunction().getParent();
654 IA->getAdvisor()->print(OS);