Index: llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h =================================================================== --- llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h +++ llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h @@ -1,4 +1,4 @@ -//===- InlineFeaturesAnalysis.h - ML Policy Feature extraction -*- C++ -*-===// +//=- FunctionPropertiesAnalysis.h - Function Properties extraction -*- C++ -=// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,16 +6,16 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_INLINEFEATURESANALYSIS_H_ -#define LLVM_INLINEFEATURESANALYSIS_H_ +#ifndef LLVM_FUNCTIONPROPERTIESANALYSIS_H_ +#define LLVM_FUNCTIONPROPERTIESANALYSIS_H_ #include "llvm/IR/PassManager.h" namespace llvm { class Function; -class InlineFeaturesAnalysis - : public AnalysisInfoMixin { +class FunctionPropertiesAnalysis + : public AnalysisInfoMixin { public: static AnalysisKey Key; struct Result { @@ -42,4 +42,4 @@ }; } // namespace llvm -#endif // LLVM_INLINEFEATURESANALYSIS_H_ \ No newline at end of file +#endif // LLVM_FUNCTIONPROPERTIESANALYSIS_H_ \ No newline at end of file Index: llvm/lib/Analysis/CMakeLists.txt =================================================================== --- llvm/lib/Analysis/CMakeLists.txt +++ llvm/lib/Analysis/CMakeLists.txt @@ -49,6 +49,7 @@ DomTreeUpdater.cpp DominanceFrontier.cpp EHPersonalities.cpp + FunctionPropertiesAnalysis.cpp GlobalsModRef.cpp GuardUtils.cpp HeatUtils.cpp @@ -57,7 +58,6 @@ IndirectCallPromotionAnalysis.cpp InlineCost.cpp InlineAdvisor.cpp - InlineFeaturesAnalysis.cpp InlineSizeEstimatorAnalysis.cpp InstCount.cpp InstructionPrecedenceTracking.cpp Index: llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp =================================================================== --- llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp +++ llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp @@ -1,4 +1,4 @@ -//===- InlineFeaturesAnalysis.cpp - Feature extraction for ML Policies ----===// +//===- FunctionPropertiesAnalysis.cpp - Function properties extraction ----===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,15 +11,16 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/InlineFeaturesAnalysis.h" +#include "llvm/Analysis/FunctionPropertiesAnalysis.h" #include "llvm/IR/Instructions.h" using namespace llvm; -AnalysisKey InlineFeaturesAnalysis::Key; +AnalysisKey FunctionPropertiesAnalysis::Key; -InlineFeaturesAnalysis::Result -InlineFeaturesAnalysis::run(const Function &F, FunctionAnalysisManager &FAM) { +FunctionPropertiesAnalysis::Result +FunctionPropertiesAnalysis::run(const Function &F, + FunctionAnalysisManager &FAM) { Result Ret; Ret.Uses = ((!F.hasLocalLinkage()) ? 1 : 0) + F.getNumUses(); for (const auto &BB : F) { Index: llvm/lib/Analysis/MLInlineAdvisor.cpp =================================================================== --- llvm/lib/Analysis/MLInlineAdvisor.cpp +++ llvm/lib/Analysis/MLInlineAdvisor.cpp @@ -20,8 +20,8 @@ #include "llvm/ADT/SCCIterator.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/Analysis/FunctionPropertiesAnalysis.h" #include "llvm/Analysis/InlineCost.h" -#include "llvm/Analysis/InlineFeaturesAnalysis.h" #include "llvm/Analysis/MLInlineAdvisor.h" #include "llvm/Analysis/MLModelRunner.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" Index: llvm/lib/Passes/PassBuilder.cpp =================================================================== --- llvm/lib/Passes/PassBuilder.cpp +++ llvm/lib/Passes/PassBuilder.cpp @@ -31,10 +31,10 @@ #include "llvm/Analysis/DemandedBits.h" #include "llvm/Analysis/DependenceAnalysis.h" #include "llvm/Analysis/DominanceFrontier.h" +#include "llvm/Analysis/FunctionPropertiesAnalysis.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/IVUsers.h" #include "llvm/Analysis/InlineAdvisor.h" -#include "llvm/Analysis/InlineFeaturesAnalysis.h" #include "llvm/Analysis/InlineSizeEstimatorAnalysis.h" #include "llvm/Analysis/LazyCallGraph.h" #include "llvm/Analysis/LazyValueInfo.h" Index: llvm/lib/Passes/PassRegistry.def =================================================================== --- llvm/lib/Passes/PassRegistry.def +++ llvm/lib/Passes/PassRegistry.def @@ -132,7 +132,7 @@ FUNCTION_ANALYSIS("loops", LoopAnalysis()) FUNCTION_ANALYSIS("lazy-value-info", LazyValueAnalysis()) FUNCTION_ANALYSIS("da", DependenceAnalysis()) -FUNCTION_ANALYSIS("inliner-features", InlineFeaturesAnalysis()) +FUNCTION_ANALYSIS("func-properties", FunctionPropertiesAnalysis()) FUNCTION_ANALYSIS("inliner-size-estimator", InlineSizeEstimatorAnalysis()) FUNCTION_ANALYSIS("memdep", MemoryDependenceAnalysis()) FUNCTION_ANALYSIS("memoryssa", MemorySSAAnalysis()) Index: llvm/unittests/Analysis/CMakeLists.txt =================================================================== --- llvm/unittests/Analysis/CMakeLists.txt +++ llvm/unittests/Analysis/CMakeLists.txt @@ -27,7 +27,7 @@ DivergenceAnalysisTest.cpp DomTreeUpdaterTest.cpp GlobalsModRefTest.cpp - InlineFeaturesAnalysisTest.cpp + FunctionPropertiesAnalysisTest.cpp IVDescriptorsTest.cpp LazyCallGraphTest.cpp LoadsTest.cpp Index: llvm/unittests/Analysis/FunctionPropertiesAnalysisTest.cpp =================================================================== --- llvm/unittests/Analysis/FunctionPropertiesAnalysisTest.cpp +++ llvm/unittests/Analysis/FunctionPropertiesAnalysisTest.cpp @@ -1,4 +1,4 @@ -//===- InlineFeaturesAnalysisTest.cpp - inline features unit tests --------===// +//===- FunctionPropertiesAnalysisTest.cpp - function properties unit tests-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/InlineFeaturesAnalysis.h" +#include "llvm/Analysis/FunctionPropertiesAnalysis.h" #include "llvm/AsmParser/Parser.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/LLVMContext.h" @@ -24,7 +24,7 @@ return Mod; } -TEST(InlineFeaturesTest, BasicTest) { +TEST(FunctionPropertiesTest, BasicTest) { LLVMContext C; std::unique_ptr M = parseIR(C, R"IR( @@ -59,7 +59,7 @@ )IR"); FunctionAnalysisManager FAM; - InlineFeaturesAnalysis FA; + FunctionPropertiesAnalysis FA; auto BranchesFeatures = FA.run(*M->getFunction("branches"), FAM); EXPECT_EQ(BranchesFeatures.BasicBlockCount, 4);