[llvm] [MLGO] Add EvolutionInlineAdvisor (PR #166386)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 07:57:08 PST 2025
================
@@ -0,0 +1,64 @@
+//-------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements EvolutionInlineAdvisor.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Analysis/EvolutionInlineAdvisor.h"
+#include "llvm/Analysis/InlineAdvisor.h"
+#include "llvm/Analysis/OptimizationRemarkEmitter.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/Support/CommandLine.h"
+
+using namespace llvm;
+
+// EVOLVE-BLOCK-START
+// You can include additional LLVM headers here.
+
+std::unique_ptr<InlineAdvice>
+EvolutionInlineAdvisor::getEvolutionAdviceImpl(CallBase &CB) {
+ // Implementation of inlining strategy. Do not change the function interface.
+ bool IsInliningRecommended = false;
+ return std::make_unique<InlineAdvice>(
+ this, CB,
+ FAM.getResult<OptimizationRemarkEmitterAnalysis>(*CB.getCaller()),
+ IsInliningRecommended);
+}
+
+// EVOLVE-BLOCK-END
+
+std::unique_ptr<InlineAdvice>
+EvolutionInlineAdvisor::getAdviceImpl(CallBase &CB) {
+ // legality check
----------------
mtrofin wrote:
leave a TODO to refactor the legality checks and make them common with MLInlineAdvisor.
https://github.com/llvm/llvm-project/pull/166386
More information about the llvm-commits
mailing list